<%
/******************************************************************************
 * Copyright (c) 2000-2008 e-Deal
 *
 * e-Deal S.A.
 * 55 rue Brillat Savarin
 * 75013 Paris
 * France
 *
 * T: +33 (0)1 53 80 80 30
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous êtes autorisés à modifier ce code source uniquement pour votre usage
 * propre et sous réserve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour
 * responsable des dommages pouvant résulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
%><%@page session="true" import="com.edeal.frontline.*"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.ExpenseCategoryBean" id="ExpenseCategory" scope="request"/>
<%
	String contextPath = (String) session.getAttribute("contextPath");
	FlContext context = null;
	if (contextPath!=null) {
		context = Frontline.getContext(contextPath);
	} else {
		context = Frontline.getContext(request.getContextPath());
	}
	FlRequest flRequest=new FlRequest(request);
	DataDictionary dico = context.getDataDictionary();
	String cpgId =ExpenseCategory.getExcCampID();
	CampaignBean cBean = new CampaignBean(cpgId, context);
	String cpgDep = null;
	try {
		cpgDep = cBean.getCpgDept();		
	} catch(FieldNotInitializedException fn) {
	}

	DepartmentBean dBean = new DepartmentBean(cpgDep, context);
	String dptID = null;
	String cpgEn = "";
	try {
		dptID = dBean.getDptID();
		DepartmentBean cpgDepartement = new DepartmentBean(dptID,context);
		cpgEn = cpgDepartement.getDptEnt();
	} catch (FieldNotInitializedException fne) {
	}
	
	
    String refdisp = null;
	try {
		refdisp = (String)dico.getRefDisp(session, "Ety","Te1",cpgEn);		
	} catch(FieldNotInitializedException fn1) {	
		refdisp = "";
	}

	String refTe2 = null;
	String excPostID = null;
	try {
		excPostID =  ExpenseCategory.getExcPosteID();
		refTe2 = (String)dico.getRefDisp(session, "Pst", "Te2", excPostID);
		refTe2 = dico.getRefIdByCode("Ptf", "Te1", refTe2); 	
		refTe2 = (String)dico.getRefDisp(session, "Ptf","Te1",refTe2);
	} catch (FieldNotInitializedException e) {
	}
%>
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
<fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"A3067\", false, true, \"Poste bugétaire\")%>" ou="<%= \"/read_expensecategory.fl\" +ExpenseCategory.getID() %>">

<table class="container" cellpadding="0">
	<tr class="fieldline">
		<td class="titreFiche" colspan="3">
			<fl:getMessage code="F60E5" alt="Poste Budgetaire pour"/> 
			<fl:getMessage code="L2026" alt="Campagne"/> - 
			<a href="<fl:webapp/>/read_campaign.fl?id=<%=cpgId+"&SfwID="+ request.getParameter("SfwID")%>" target="_parent">
					<%= cBean.getCpgCode() %>
			</a>
		</td>
	</tr>
<tr><td colspan="3" class="ligne_separation"/></tr>
	<tr valign=top>
	<td class="column2">
		<table>
			<tr>
				<td class="dataLabel"><fl:getMessage code="F2079" alt="Département"/></td>
				<td class="dataValue">
					<% if (dptID == null) { %>
						&nbsp;
					<% } else { %>
						<a href="<fl:webapp/>/read_department.fl?id=<%=dBean.getID()+"&SfwID="+ request.getParameter("SfwID")%>" target="_parent">
							<%= dBean.getDptTitle() + " " + dBean.getDptCode() %></td>
						</a>
					<% } %>
			</tr>
			<tr>
				<td class="dataLabel"><fl:getMessage code="F60DE" alt="Entité"/></td>
				<td class="dataValue"><%=refdisp!=null?refdisp:""%></td>
			</tr>
			<fl:fieldRead property="ExcUnitP" postText="&nbsp;&euro;"/>
		</table>
	</td>
	<td class="separation"><div class="separation"></div></td>
	<td class="column2">
		<table>
			<fl:fieldRead property="ExcDesc"/>
			<tr>
				<td class="dataLabel"><fl:getMessage code="F1023" alt="Type"/></td>
				<td class="dataValue"><%= refTe2 %></td>
			</tr>
			<fl:fieldRead property="ExcQuant" postText="&nbsp;Unités"/>

		</table>
	</td>
	</tr>
</table>
&nbsp;
<fl:notes name="EntNotes" title="<%= Utils.getMessage(session, \"F2024\", \"Notes\") %>" nbPix="30"><fl:getProperty name="ExpenseCategory" property="ExcNotes" alt=""/></fl:notes>
</fl:bigTabs>
