Edit C:\galaxie\Back\galaxie\marketing\contribution\edit.jsp
<%/****************************************************************************** * 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"%> <%@ 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="java.util.Vector" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.text.DecimalFormat" %> <%@ page import="com.edeal.frontline.CampaignBean" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.ExpenseCategoryBean" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <jsp:useBean class="com.edeal.frontline.ContributionBean" id="Contribution" 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 id = null; try { id = Contribution.getID(); } catch (FieldNotInitializedException fnie) { } String cpgId = null; CampaignBean cBean = null; try { cpgId = Contribution.getCtbCampID(); cBean = new CampaignBean(cpgId, context); request.setAttribute("Campaign", cBean); } catch (FieldNotInitializedException fnie) { } Vector refList = dico.getRefList(session, "Ctt", "Te1"); float costUnit = 0; int unitNo = 0; try { unitNo = (new Integer(cBean.getCpgUnitNo())).intValue(); costUnit = (new Float(cBean.getCpgCost())).floatValue();; } catch (Exception e) { } // Figure out our total budget float excBudget = 0; String[] excKeys = { "ExcQuant", "ExcUnitP" }; String[][] excQuery = { { "ExcCampID = " + Utils.formatToSQL(context, cpgId) } }; Vector excResult = ExpenseCategoryBean.listSummary(context, excKeys, excQuery); for (int cnt = 0; cnt < excResult.size(); ++cnt) { Hashtable row = (Hashtable) excResult.elementAt(cnt); Integer quant = (Integer) row.get("ExcQuant"); Float unitP = (Float) row.get("ExcUnitP"); if (quant == null || unitP == null) { continue; } excBudget += quant.intValue() * unitP.floatValue(); } float CtbNumUnits = 0; try { CtbNumUnits = Contribution.getCtbNumUnits(); } catch (Exception e) { } int CtbType = 0; try { CtbType = Integer.parseInt(Utils.getRequestParameter(context, request, "TypeSelected")); } catch (Exception e) { try { CtbType = Contribution.getCtbType(); } catch (Exception e2) { } } DecimalFormat intFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0;- #,##0"); DecimalFormat floatFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.##;- #,##0.##"); DecimalFormat moneyFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.##;- #,##0.##"); moneyFormat.setMaximumFractionDigits(2); moneyFormat.setMinimumFractionDigits(2); int cpgUnitNos = 0; try { cpgUnitNos = cBean.getCpgUnitNo(); } catch (FieldNotInitializedException fnie) { } %> <style> <!-- .dataVal{ margin: 0px; font-size: small; font-size: expression("x-small"); color: rgb(0, 0, 0); font-family: Arial, Verdana, sans-serif; } --> </style> <script type="text/javascript" language="javascript"> function doSubmit() { f = document.forms[0]; f.CtbType.value = f.TypeSelected.value; f.CtbNumUnits.value = f.InValue.value; presentFieldsValue(); if (verifyFields() == false) return false; return true; } function verifyFields() { f = document.forms[0]; if (f.InValue.value == '' || f.InValue.value == '0') { window.alert('<fl:getMessage code="M60BA" alt="Veuillez saisir la montant de la contribution" js="true"/>'); return false; } } function getLimit() { f = document.forms[0]; if (f.op.value != "save") return f.CtbNumUnits.value; switch (f.TypeSelected.value) { case "0": return <%= cpgUnitNos %>; case "1": return 100; case "2": return <%= excBudget %>; } } function doRefresh() { var f = document.forms[0]; f.action = '<%=flRequest.computeURL("/refresh_contribution.fl")+ (id != null ? "?id="+id : "")%>'; doExitConf = false; presentFieldsValue(); window.document.forms[0].submit(); } </script> <fl:form action="/save_contribution.fl" bean="Contribution"> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L6356\", false, true, \"Contribution\")%>" ou="<%= \"/edit_contribution.fl\" + (id != null ? \"?id=\" + id : \"\")%>"> <input type="hidden" name="CtbNumUnits" value="0"> <input type="hidden" name="CtbType" value="<%= CtbType %>"> <input type="hidden" name="initIntCpgID" value="<%= cpgId %>"> <input type="hidden" name="CtbCampID" value="<%= cpgId %>"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="labelTitreFiche" valign="top"> <fl:getMessage code="F6103" alt="Contribution de"/> </td> <td class="fieldTitreFiche"> <fl:input property="CtbDeptID" mandatoryMsgCode="M60B9" column1="true"/> </td> </tr> <tr class="ligne_separation"><td colspan="3"></td></tr> </table> <table class="container" cellpadding="0"> <tr> <td width="50%"> <table class="container" cellpadding="0"> <fl:fieldRead property="CtbCampID" bean="true"/> <!-- fl:fieldEdit property="CtbType" onchange="doRefresh();" alt=""/--> <tr class="fieldline"> <td class="dataLabel"> <fl:label code="F1023"/> </td> <td class="dataValue" colspan="3"> <div class="input select"><select name="TypeSelected" tabindex="80" onchange="doRefresh();" class="input select"> <% String val; String ref; Vector codes; for (int cnt = 0; cnt < refList.size(); ++cnt) { codes = (Vector) refList.get(cnt); val = (String) codes.get(1); %> <option value="<%= cnt %>" <% if (cnt == CtbType) { %> selected <% } %>><%= val %></option> <% } %> </select></div> </td> </tr> <% if (CtbType == 0) { %> <tr class="fieldline"> <td class="dataLabel"><fl:label code="F60D6"/></td> <td class="dataValue"> <input name="InValue" style="text-align:right;" value="<%= intFormat.format(CtbNumUnits) %>" type="text" class="input text" size="15" onblur="ctrlNumField(this, 'integer', 'Format incorrect. Veuillez corriger');"></td><td class="postText"> <fl:getMessage code="L6010" alt="sur"/> <%= intFormat.format(cpgUnitNos) %> </td> </tr> <% } if (CtbType == 1) { %> <tr class="fieldline"> <td class="dataLabel"><fl:label code="F610B"/></td> <td class="dataValue"><input name="InValue" style="text-align:right;" value="<%= floatFormat.format(CtbNumUnits) %>" type="text" class="input text" size="15" onblur="ctrlNumField(this, 'float', 'Format incorrect. Veuillez corriger');"></td><td class="postText"> %</td> </tr> <% } if (CtbType == 2) { %> <tr class="fieldline"> <td class="dataLabel"><fl:label code="L2009"/></td> <td class="dataValue"><input name="InValue" style="text-align:right;" value="<%= moneyFormat.format(CtbNumUnits) %>" type="text" class="input text" size="15" onblur="ctrlNumField(this, 'float', 'Format incorrect. Veuillez corriger');"></td><td class="postText"> € <fl:getMessage code="L6010" alt="sur"/> <%= moneyFormat.format(excBudget) %> €</td> </tr> <% } %> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2" width="50%"> <table class="container" cellpadding="0"> <fl:fieldRead name="Campaign" property="CpgDept" bean="true"/> <fl:fieldRead name="Campaign" property="CpgEnt" bean="true"/> </table> </td> </tr> </table> <table class="container" cellpadding="0"> <tr class="ligne_separation"><td colspan="3"></td></tr> <tr class="ligne_separation"><td></td></tr> <tr> <td class="titrePartie"><fl:getMessage code="F2024" alt="Notes"/></td> </tr> <tr> <td class="dataValue noPaddingLeft"><fl:input property="CtbNotes" nodiv="false"/></td> </tr> <tr class="ligne_separation"><td></td></tr> <%--<tr class="ligne_separation_couleur"><td></td></tr> <tr class="ligne_separation"><td></td></tr>--%> </table> </fl:bigTabs> </fl:form> <% /****************************************************************************** * * * m.ichahane@e-deal.ma : 2006/08/29 10:11:25 : Mustapha * * *****************************************************************************/ %>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de