<%
/******************************************************************************
 * Copyright (c) 2000-2005 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" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.edeal.frontline.ObjectsBean" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="com.edeal.frontline.FlLocale" %>
<%@ page import="com.edeal.frontline.CampaignBean" %>
<%@ page import="java.util.Vector" %>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.CampaignBean" id="Campaign" scope="request"/>
<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	DataDictionary dico = context.getDataDictionary();

	String copyCpgID = (String)request.getAttribute("copyCpgID");
	if (copyCpgID != null) {
		try {
			Campaign = new CampaignBean(copyCpgID, context);
			request.setAttribute("Campaign", Campaign);
		} catch (Exception e) {
		}
	}

	String id = null;
	try {
		id = Campaign.getID();
	} catch (FieldNotInitializedException fnie) {
	}
	
	int eveEnt = 0;
	int evePer = 0;
	try {
		eveEnt = Campaign.getCpgEventEnt();
	} catch (FieldNotInitializedException e) {
	}
	try {
		evePer = Campaign.getCpgEventPer();
	} catch (FieldNotInitializedException e) {
	}

	String salesModel = context.getContextParameter("SalesModel");
	boolean isB2C = "B2C".equalsIgnoreCase(salesModel);
	
	Vector stages;
	ObjectsBean stg = null;
	try {
		stages = Campaign.getCpgStgID();
		stg = dico.getTable("sql", "Stage");
	} catch (FieldNotInitializedException e) {
		stages = new Vector();
	}

	DecimalFormat intFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0;- #,##0");
	DecimalFormat floatFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.00;- #,##0.00");

	int budgetEst;
	try {
		budgetEst = Integer.parseInt((String)request.getAttribute("budgetEst"));
	} catch (Exception e) {
		budgetEst = 0;
	}
	
	int budgetReal;
	try {
		budgetReal = Integer.parseInt((String)request.getAttribute("budgetReal"));
	} catch (Exception e) {
		budgetReal = 0;
	}

	double budgetDiffN;
	try {
		budgetDiffN = Double.parseDouble((String)request.getAttribute("budgetDiffN"));
	} catch (Exception e) {
		budgetDiffN = 0;
	}

	double budgetDiffP;
	try {
		budgetDiffP = Double.parseDouble((String)request.getAttribute("budgetDiffP"));
	} catch (Exception e) {
		budgetDiffP = 0;
	}

	//Intitulés des indicateurs par defaut
	String defIndic1 = (String)dico.getRefDisp(session, "Cai", "Te1", dico.getRefIdByCode("Cai", "Te1", "INDIC1"));
	String defIndic2 = (String)dico.getRefDisp(session, "Cai", "Te1", dico.getRefIdByCode("Cai", "Te1", "INDIC2"));
	String defIndic3 = (String)dico.getRefDisp(session, "Cai", "Te1", dico.getRefIdByCode("Cai", "Te1", "INDIC3"));
	String defIndic4 = (String)dico.getRefDisp(session, "Cai", "Te1", dico.getRefIdByCode("Cai", "Te1", "INDIC4"));
	String defIndic5 = (String)dico.getRefDisp(session, "Cai", "Te1", dico.getRefIdByCode("Cai", "Te1", "INDIC5"));
	
	String defIndic1JS = Utils.formatToJavascript(defIndic1);
	String defIndic2JS = Utils.formatToJavascript(defIndic2);
	String defIndic3JS = Utils.formatToJavascript(defIndic3);
	String defIndic4JS = Utils.formatToJavascript(defIndic4);
	String defIndic5JS = Utils.formatToJavascript(defIndic5);
	Vector units = dico.getRefCodeList("CpgIndicUnit1");
	
	String errorMsg = Utils.getMessage(session, "M2000", true, "Format du champ incorrect");	
%>
<script type="text/javascript" language="javascript">

function doSubmit() {

	var mf = document.forms[0];
	if (mf.CpgDateBeg.value!="" && mf.CpgDateEnd.value!="" && compareDate(mf.CpgDateBeg.value,'',mf.CpgDateEnd.value,'') > 0) {
		window.alert("<fl:getMessage code="M0021" alt="La date de début doit être infèrieure à la date de fin." js="true"/>");
		mf.CpgDateEnd.focus();
		return false;
	}
	if (mf.CpgCost.value == '') {
		mf.CpgCost.value = 0;
	} 
	
	if (mf.CpgUnitNo.value == '') {
		mf.CpgUnitNo.value = 0;
	} 
	
	if (mf.CpgTargetNo.value == '') {
		mf.CpgTargetNo.value = 0;
	} 
	
<%
if (!"B2C".equalsIgnoreCase(salesModel)) {
	if (eveEnt != 2) {

%>
	if(mf.CpgEventEnt.value != '2') {
		if (mf.EventEnt.checked) {
			mf.CpgEventEnt.value = '1';
		} else {
			mf.CpgEventEnt.value = '';
		}
	}
<%
	}
}

	if (evePer != 2) {
%>	
	if(mf.CpgEventPer.value != '2') {
		if (mf.EventPer.checked) {
			mf.CpgEventPer.value = '1';
		} else {
			mf.CpgEventPer.value = '';
		}
	}

<%
	}
%>	
	return true;
}

</script>

<fl:form action="/save_campaign.fl" bean="Campaign">
<% if (!"B2C".equalsIgnoreCase(salesModel)) { %>
	<input type="hidden" name="CpgEventEnt" value="<fl:getProperty name="Campaign" property="CpgEventEnt" alt="" edit="true" format="int"/>">
<% } %>
<input type="hidden" name="CpgEventPer" value="<fl:getProperty name="Campaign" property="CpgEventPer" alt="" edit="true" format="int"/>">
<fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L2026\", false, true, \"Campagne\")  %>" ou="<%= \"/edit_campaign.fl\" + (id != null ? \"?id=\" + id : \"\") %>">
	<table class="container" cellpadding="0">
		<tr>
			<td colspan="5" class="width: 100%; margin: 0px; padding: 0px;">
				<table class="container" cellpadding="0">
					<tr class="fieldline">
						<td><fl:label field="CpgTitle" labelClassName="labelTitreFiche" code="F2016"/></td>
						<td class="fieldTitreFiche"><fl:input property="CpgTitle" mandatoryMsgCode="L63DC"/></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
	<table class="container" cellpadding="0">	
		<tr>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="CpgCode" mandatoryMsgCode="M2001"  unicityMsgCode="M60CE" onblur="this.value = checkString(this.value, 'upper');" />
					<fl:fieldEdit property="CpgDateBeg"/>
					<fl:fieldEdit property="CpgDateEnd"/>
					<fl:fieldEdit property="CpgEnd"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="CpgDept" column3="true"/>
					<fl:fieldEdit property="CpgLevel" alt=" "/>
					<% 
						String CpgYearID = null;
						try {
							CpgYearID = Campaign.getCpgYear();
						} catch (FieldNotInitializedException e) {
						}
						
						if (CpgYearID == null) {
					%>
						<tr class="fieldline">
							<td class="dataLabel">
								<fl:label code="F6102"/>
							</td>
							<td class="dataValue" colspan="3">
								<div class="input select">
								<select class="input select" id="CpgYear" name="CpgYear">
							<%
								Vector yearRefList = dico.getRefList(session, "Anf", "Te2");
								Vector tmpVector;
								Iterator it = yearRefList.iterator();
								String refID;
								String refVal;
								String yearVal;
								
								while (it.hasNext()) {
									tmpVector = (Vector) it.next();
									refID = (String) tmpVector.get(0);
									refVal = (String) tmpVector.get(1);
									yearVal = (String) dico.getRefCode("Anf", "Te1", refID);
							%>
									<option value="<%= refID %>" <%= refVal.equalsIgnoreCase("O") ? "selected" : "" %>><%= yearVal %> </option>
							<%
								}
							%>
								</select>
								</div>
							</td>
						</tr>
							<%
						} else {
						%>
							<fl:fieldEdit labelCode="F6102" property="CpgYear"/>
						<% } 
						
						// Marqueur Enterprise
						
						 if (!isB2C) { %>
						<tr class="fieldline">
							<% if (eveEnt != 2) { %>
								<td class="dataLabel">
									<div><label for="EventEnt" title="<fl:getMessage code="L2001" alt="Marqueur entreprise"/>"><fl:getMessage code="L2001" alt="Marqueur entreprise"/></label></div>
								</td>
								<td class="dataValue">
									<div><input class="checkbox" style="margin-left: 0px;" type="checkbox" id="EventEnt" name="EventEnt" value="1"></div>
								</td>
							<% } else { %>
								<td colspan="2">
									<div><label class="dataLabel"><fl:getMessage code="L2002" alt="Un évènement entreprise associé a été créé"/></label></div>
								</td>
							<% } %>
						</tr>
					<% } %>
							
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="CpgCost" postText="&nbsp;&euro;" />
					<fl:fieldEdit property="CpgUnitNo"/>
					<fl:fieldEdit property="CpgTargetNo" />
					
					<tr class="fieldline">
						<% if (evePer != 2) { %>
							<td class="dataLabel">
								<div><label for="EventPer" title="<fl:getMessage code="L2003" alt="Marqueur personne"/>"><fl:getMessage code="L2003" alt="Marqueur personne"/></label></div>
							</td>
							<td class="dataValue">
								<div><input class="checkbox" style="margin-left: 0px;" type="checkbox" id="EventPer" name="EventPer" value="1"></div>
							</td>
						<% } else { %>
							<td colspan="2">
								<div><label class="dataLabel"><fl:getMessage code="L2004" alt="Un évènement personne associé a été créé"/></label></div>
							</td>
						<% } %>
					</tr>
				</table>
			</td>
		</tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
	<% if (id != null) { %>
		<table class="container" cellpadding="0">
			<tr class="ligne_separation"><td></td></tr>
			<tr>
				<td class="titrePartie"><fl:getMessage code="L2008" alt="Etapes"/></td>
			</tr>
			<tr class="ligne_separation_couleur"><td colspan="2"></td></tr>
			<tr class="ligne_separation"><td></td></tr>
			<tr class="fieldline">
				<td class="column2" nowrap>
					<input type="hidden" name="CpgStgID" value="<fl:getProperty name="Campaign" property="CpgStgID" separator="|" alt="" />">
					<select multiple name="stages">
					<% for (int i=0; i<stages.size(); i++) {
						String stgID = (String)stages.elementAt(i);
						String stgTitle = stg.toString(session, stgID);
					%>
						<option value="<%= stgID %>"><%= Utils.formatToWeb(stgTitle, true) %></option>
					<% } %>
					</select>
					&nbsp;
					<table class="container" cellpadding="0" style="display:inline;"> 
						<tr><td><a href="javascript:moveSelect(document.forms[0].stages, 1, document.forms[0].CpgStgID);"><img src="<fl:webapp/>/icons/ico/flecheH.gif" border="0" height="16" width="16"></a></td></tr>
						<tr><td><a href="javascript:moveSelect(document.forms[0].stages, -1, document.forms[0].CpgStgID);"><img src="<fl:webapp/>/icons/ico/flecheB.gif" border="0" height="16" width="16"></a></td></tr>
					</table>
				</td>
			</tr>
			<tr class="ligne_separation"><td></td></tr>
		</table>
	<% } %>
	<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
	
	<fl:smallTabs name="CampaignTabs">
		<fl:sTab id="DESCRIP" title="<%= Utils.getMessage(session, \"L2007\", false, true, \"Description\") %>">
			<table class="container" cellpadding="0">
				<tr>
					<td class="column2">
						<table class="data_column" cellpadding="0">
							<fl:fieldEdit property="CpgAim"/>
							<fl:fieldEdit property="CpgTarget"/>
						</table>
					</td>
					<td class="separation"><div class="separation"></div></td>
					<td class="column2">
						<table class="data_column" cellpadding="0">
							<fl:fieldEdit property="CpgMeans"/>
							<tr class="fieldline">
								<td class="dataLabel"><div><label><fl:getMessage code="F2008" alt="Prévisionnel"/></label></div></td>
								<td class="dataValue"><div><%= intFormat.format(budgetEst) %> &euro;</div></td>
							</tr>
							<tr class="fieldline">
								<td class="dataLabel"><div><label><fl:getMessage code="F2009" alt="Réel"/></label></div></td>
								<td class="dataValue"><div><%= intFormat.format(budgetReal) %> &euro;</div></td>
							</tr>
							<tr class="fieldline">
								<td class="dataLabel"><div><label><fl:getMessage code="L200A" alt="Ecart"/></label></div></td>
								<td class="dataValue"><div><%= intFormat.format(budgetDiffN) %> &euro; : <%= floatFormat.format(budgetDiffP) %> %</div></td>
							</tr>
							<tr> 	
								<td class="dataLabel">
									<div><label for="CpgROIEst" title="<fl:getMessage code="F200A" alt="Retour sur investissement prévisionnel"/>"><fl:getMessage code="F200A" alt="Retour sur investissement prévisionnel"/></label></div>
								</td>
								<td class="dataValue">
									<div class="fieldTable" >
										<table class="fieldTable" cellpadding="0">
											<tbody>
												<tr>
													<td class="principalText">
														<%
															int roi = 0;
															try {
																roi = Campaign.getCpgROIEst();
															} catch (FieldNotInitializedException e) {
															}
														%>
														<select class="input select" id="CpgROIEst" name="CpgROIEst">
															<% for (int i = 1; i < 25; i++) { %>
																<option value="<%= i %>" <%= i == roi ? "selected" : "" %>><%= i %></option>
															<% } %>
														</select>
													
													</td>
													<td class="postText">&nbsp;<fl:getMessage code="L200B" alt=" mois"/></td>
												</tr>
											</tbody>
										</table>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</fl:sTab>
		<fl:sTab id="CAMPAIGN1" title="<%= context.getAutoDisplayManager().getTitle(session, \"Campaign\", \"Campagne 1\") %>" visible="<%= context.getAutoDisplayManager().hasEntry(\"Campaign\", \"Campagne 1\") %>">
			<fl:autodisplay name="Campaign" zone="Campagne 1" edit="true"/>
		</fl:sTab>
		<fl:sTab id="INDIC" title="<%= Utils.getMessage(session, \"L620C\", false, true, \"Indicateurs\") %>">
			<table class="container" cellpadding="0">
				<tr class="fieldline">
					<td class="headerDataGrid" style="width: 35%;"></td>
					<td class="headerDataGrid" style=" width:20%;"><fl:getMessage code="F2008" alt="Prévisionnel"/></td>
					<td class="headerDataGrid" style=" width:20%;  "><fl:getMessage code="F2009" alt="Réel"/></td>
					<td class="headerDataGrid" style=" width:25%; "><fl:getMessage code="L200A" alt="Ecart"/></td>
				</tr>
				<tr class="tabSimpleFdBleu">
					<td class="dataValue" nowrap style="width: 35%; "><input class="input text" NAME="CpgIndicLabel1" VALUE="<fl:getProperty name="Campaign" property="CpgIndicLabel1" alt="<%=defIndic1%>" edit="true"/>" SIZE="25" maxlength="100" onBlur="if(this.value=='')this.value='<%=defIndic1JS%>';">
						<select name="CpgIndicUnit1" class="input select auto">
							<% for (int i = 0; i < units.size(); i++) { 
								String idInd = (String)((Vector)units.elementAt(i)).elementAt(0);
								String display = (String)dico.getRefDisp(session, "CpgIndicUnit1", idInd);
								if (display == null) {
									display = "";
								}
								String selected = "";
								try { selected = idInd.equals(Campaign.getCpgIndicUnit1()) ? " selected" : ""; }
								catch (FieldNotInitializedException e) {}
								%>
								<OPTION VALUE="<%= idInd %>"<%= selected %>><%= display %></OPTION>
								<%
							}	
							%>
						</select>
					</td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;">
						<INPUT NAME="CpgIndicEst1" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicEst1" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;">
						<INPUT NAME="CpgIndicReal1" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicReal1" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 25%; text-align: right;">
						<INPUT NAME="QEcartN" class="input number" VALUE="" SIZE="6" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>')" onFocus="this.blur()"> : <INPUT NAME="QEcartP" class="input number" VALUE="" SIZE="6" onFocus="this.blur()">%</td>
				</tr>
				<tr class="tabSimpleFdBlanc">
					<td class="dataValue" nowrap style="width: 35%; ">
						<input class="input text" NAME="CpgIndicLabel2" VALUE="<fl:getProperty name="Campaign" property="CpgIndicLabel2" alt="<%= defIndic2 %>" edit="true"/>" SIZE="25" maxlength="100" onBlur="if(this.value=='')this.value='<%= defIndic2JS %>';">
						<select name="CpgIndicUnit2" class="input select auto">
							<% for (int i=0 ; i<units.size() ; i++) { 
								String idInd = (String)((Vector)units.elementAt(i)).elementAt(0);
								String display = (String)dico.getRefDisp(session, "CpgIndicUnit2", idInd);
								if (display == null) {
									display = "";
								}
								String selected = "";
								try { selected = idInd.equals(Campaign.getCpgIndicUnit2()) ? " selected" : ""; }
								catch (FieldNotInitializedException e) {}
								%>
								<OPTION VALUE="<%= idInd %>"<%= selected %>><%= display %></OPTION>
								<%
							}	
							%>
						</select>
					</td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicEst2" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicEst2" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicReal2" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicReal2" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 25%; text-align: right;"><INPUT NAME="LEcartN" class="input number" VALUE="" SIZE="6" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>')" onFocus="this.blur()"> : <INPUT NAME="LEcartP" class="input number" VALUE="" SIZE="6" onFocus="this.blur()">%</td>
				</tr>
				<tr class="tabSimpleFdBleu">
					<td class="dataValue" nowrap style="width: 35%; ">
						<input class="input text" NAME="CpgIndicLabel3" VALUE="<fl:getProperty name="Campaign" property="CpgIndicLabel3" alt="<%= defIndic3 %>" edit="true"/>" SIZE="25" maxlength="100" onBlur="if(this.value=='')this.value='<%= defIndic3JS %>';">
						<select name="CpgIndicUnit3" class="input select auto">
							<% for (int i=0 ; i<units.size() ; i++) { 
								String idInd = (String)((Vector)units.elementAt(i)).elementAt(0);
								String display = (String)dico.getRefDisp(session, "CpgIndicUnit3", idInd);
								if (display == null) {
									display = "";
								}
								String selected = "";
								try { selected = idInd.equals(Campaign.getCpgIndicUnit3()) ? " selected" : ""; }
								catch (FieldNotInitializedException e) {}
								%>
								<OPTION VALUE="<%= idInd %>"<%= selected %>><%= display %></OPTION>
								<%
							}	
							%>
						</select>
					</td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicEst3" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicEst3" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicReal3" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicReal3" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 25%; text-align: right;"><INPUT NAME="REcartN" class="input number" VALUE="" SIZE="6" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>')" onFocus="this.blur()"> : <INPUT NAME="REcartP" class="input number" VALUE="" SIZE="6" onFocus="this.blur()">%</td>
				</tr>
				<tr class="tabSimpleFdBlanc">
					<td class="dataValue" nowrap style="width: 35%; "><input class="input text" NAME="CpgIndicLabel4" VALUE="<fl:getProperty name="Campaign" property="CpgIndicLabel4" alt="<%= defIndic4 %>" edit="true"/>" SIZE="25" maxlength="100" onBlur="if(this.value=='')this.value='<%= defIndic4JS %>';">
						<select name="CpgIndicUnit4" class="input select auto">
							<% for (int i=0 ; i<units.size() ; i++) { 
								String idInd = (String)((Vector)units.elementAt(i)).elementAt(0);
								String display = (String)dico.getRefDisp(session, "CpgIndicUnit4", idInd);
								if (display == null) {
									display = "";
								}
								String selected = "";
								try { selected = idInd.equals(Campaign.getCpgIndicUnit4()) ? " selected" : ""; }
								catch (FieldNotInitializedException e) {}
								%>
								<OPTION VALUE="<%= idInd %>"<%= selected %>><%= display %></OPTION>
								<%
							}	
							%>
						</select>
					</td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicEst4" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicEst4" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicReal4" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicReal4" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 25%; text-align: right;"><INPUT NAME="CEcartN" class="input number" VALUE="" SIZE="6" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>')" onFocus="this.blur()"> : <INPUT NAME="CEcartP" class="input number" VALUE="" SIZE="6" onFocus="this.blur()">%</td>
				</tr>
				<tr class="tabSimpleFdBleu">
					<td class="dataValue" nowrap style="width: 35%; "><input class="input text" NAME="CpgIndicLabel5" VALUE="<fl:getProperty name="Campaign" property="CpgIndicLabel5" alt="<%= defIndic5 %>" edit="true"/>" SIZE="25" maxlength="100" onBlur="if(this.value=='')this.value='<%= defIndic5JS %>';">
						<select name="CpgIndicUnit5" class="input select auto">
							<% for (int i=0 ; i<units.size() ; i++) { 
								String idInd = (String)((Vector)units.elementAt(i)).elementAt(0);
								String display = (String)dico.getRefDisp(session, "CpgIndicUnit5", idInd);
								if (display == null) {
									display = "";
								}
								String selected = "";
								try { selected = idInd.equals(Campaign.getCpgIndicUnit5()) ? " selected" : ""; }
								catch (FieldNotInitializedException e) {}
								%>
								<OPTION VALUE="<%= idInd %>"<%= selected %>><%= display %></OPTION>
								<%
							}	
							%>
						</select>
					</td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicEst5" class="input number"  VALUE="<fl:getProperty name="Campaign" property="CpgIndicEst5" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 20%; text-align: right;"><INPUT NAME="CpgIndicReal5" class="input number" VALUE="<fl:getProperty name="Campaign" property="CpgIndicReal5" alt="" edit="true" format="#,##0.##;- #,##0.##"/>" SIZE="15" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>');doCalculResultat(this)"></td>
					<td class="dataValue" nowrap style="width: 25%; text-align: right;"><INPUT NAME="CaEcartN" class="input number" VALUE="" SIZE="6" onBlur="ctrlNumField(this , 'float', '<fl:getMessage code="M2000" alt="Format du champs est incorrect" js="true"/>')" onFocus="this.blur()"> : <INPUT NAME="CaEcartP" class="input number" VALUE="" SIZE="6" onFocus="this.blur()">%</td>
				</tr>
			</table>
		</fl:sTab>
		<fl:sTab id="CAMPAIGN2" title="<%= context.getAutoDisplayManager().getTitle(session, \"Campaign\", \"Campagne 2\") %>" visible="<%= context.getAutoDisplayManager().hasEntry(\"Campaign\", \"Campagne 2\") %>">
			<fl:autodisplay name="Campaign" zone="Campagne 2" edit="true"/>
		</fl:sTab>
		<fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"L201C\", false, true, \"Documents joints\") %>">
			<fl:attach name="Campaign" colID="CpgAttID" />
		</fl:sTab>
	</fl:smallTabs>
</fl:bigTabs>
</fl:form>
