<% /****************************************************************************** * Copyright (c) 2000-2006 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.DataDictionary" %> <%@ page import="com.edeal.frontline.*" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="java.text.DecimalFormat" %> <%@ page import="com.edeal.frontline.DepartmentBean" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="java.util.*" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.CampaignBean" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% 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 SfwID = flRequest.getRequestParameterOrAttribute("SfwID"); String id = null; try { id = Campaign.getID(); } catch (FieldNotInitializedException fnie) { } 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); float cpgCostPerUnit = 0; try { cpgCostPerUnit = Campaign.getCpgCost(); } catch (FieldNotInitializedException fnie) { } int cpgNumberUnits = 0; try { cpgNumberUnits = Campaign.getCpgUnitNo(); } catch (FieldNotInitializedException fnie) { } int cpgTargetNo = 0; try { cpgTargetNo = Campaign.getCpgTargetNo(); } catch (FieldNotInitializedException fnie) { } float cpgTotalBudget = cpgCostPerUnit * cpgNumberUnits; DepartmentBean Department = null; try { Department = new DepartmentBean(Campaign.getCpgDept(), context); } catch (Exception e) { } session.setAttribute("Department", Department); int budgetEst = 0; try { Integer str = (Integer)flRequest.getAttribute("budgetEst"); if (str != null) { budgetEst = str.intValue(); } } catch (Exception e) { budgetEst = 0; } int budgetReal = 0; try { Integer str = (Integer)flRequest.getAttribute("budgetReal"); if (str != null) { budgetReal = str.intValue(); } } catch (Exception e) { budgetReal = 0; } double budgetDiffN = 0; try { Double str = (Double)flRequest.getAttribute("budgetDiffN"); if (str != null) { budgetDiffN = str.doubleValue(); } } catch (Exception e) { budgetDiffN = 0; } double budgetDiffP = 0; try { Double str = (Double)flRequest.getAttribute("budgetDiffP"); if (str != null) { budgetDiffP = str.doubleValue(); } } catch (Exception e) { budgetDiffP = 0; } float excBudget = 0; try { excBudget = ((Float)session.getAttribute("excBudget_CpgExc")).floatValue(); } catch (Exception e) { excBudget = 0; } float financement = 0; try { financement = ((Float)session.getAttribute("financement_CpgCtb")).floatValue(); } catch (Exception e) { financement = 0; } float totalTarget=0; try { totalTarget = ((Float)session.getAttribute("totalTarget_CpgStg")).floatValue(); } catch (Exception e) { totalTarget = 0; } float totalImputed=0; try { totalImputed = ((Float)session.getAttribute("totalImputed_CpgStg")).floatValue(); } catch (Exception e) { totalImputed = 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"); %> " ou="<%= \"/read_campaign.fl\" + (id != null ? \"?id=\" + id : \"\") %>">
<% boolean isEnd = false; Date CpgDateEnd=null; try { isEnd = Campaign.isCpgEnd(); logger.info("cloturée::::"+isEnd); }catch (FieldNotInitializedException e){} if (isEnd) { String close = " ( " + Utils.getMessage(session, "F2004", "Cloturée") + " ) "; try { CpgDateEnd = Campaign.getCpgDateEnd(); }catch (FieldNotInitializedException e){} if (CpgDateEnd==null){ %> <%} else {%> <%} }else {%> <%}%>
" />
" nbPix="30"> " nbPix="30"> " nbPix="30"> ">
<%= intFormat.format(budgetEst) %> €
 
<%= intFormat.format(budgetReal) %> €
<%= intFormat.format(budgetDiffN) %> € : <%= floatFormat.format(budgetDiffP) %> %
" onselect="refreshPostes();">
"/>
: <%= moneyFormat.format(excBudget) %> €
" onselect="refreshContributions();"> "/>
: <%= moneyFormat.format(financement) %> € - : <%= moneyFormat.format(excBudget - financement) %> €
" visible="<%= context.getAutoDisplayManager().hasEntry(\"Campaign\", \"Campagne 1\") %>"> "> <% float est = 0; float reel = 0; float diffN = 0; double diffP = 0; try { est = Campaign.getCpgIndicEst1(); } catch(FieldNotInitializedException e) { } try { reel = Campaign.getCpgIndicReal1(); } catch(FieldNotInitializedException e) { } diffN = reel - est; if (est != 0) { diffP = ((double)diffN / (double)est) * 100; } String unit1 = ""; try { String deviseStr = (String)dico.getRefDisp(session, "CpgIndicUnit1", Campaign.getCpgIndicUnit1()); unit1 = (deviseStr == null ? "" : " " + deviseStr); } catch (Exception e) { unit1 = ""; } %> <% try { est = Campaign.getCpgIndicEst2(); } catch(FieldNotInitializedException e) { est = 0; } try { reel = Campaign.getCpgIndicReal2(); } catch(FieldNotInitializedException e) { reel = 0; } diffN = reel - est; if (est != 0) { diffP = ((double)diffN / (double)est) * 100; } else { diffP = 0; } try { String deviseStr = (String)dico.getRefDisp(session, "CpgIndicUnit2", Campaign.getCpgIndicUnit2()); unit1 = (deviseStr == null ? "" : " " + deviseStr); } catch (Exception e) { unit1 = ""; } %> <% try { est = Campaign.getCpgIndicEst3(); } catch(FieldNotInitializedException e) { est = 0; } try { reel = Campaign.getCpgIndicReal3(); } catch(FieldNotInitializedException e) { reel = 0; } diffN = reel - est; if (est != 0) { diffP = ((double)diffN / (double)est) * 100; } else { diffP = 0; } try { String deviseStr = (String)dico.getRefDisp(session, "CpgIndicUnit3", Campaign.getCpgIndicUnit3()); unit1 = (deviseStr == null ? "" : " " + deviseStr); } catch (Exception e) { unit1 = ""; } %> <% try { est = Campaign.getCpgIndicEst4(); } catch(FieldNotInitializedException e) { est = 0; } try { reel = Campaign.getCpgIndicReal4(); } catch(FieldNotInitializedException e) { reel = 0; } diffN = reel - est; if (est != 0) { diffP = ((double)diffN / (double)est) * 100; } else { diffP = 0; } unit1 = ""; try { String deviseStr = (String)dico.getRefDisp(session, "CpgIndicUnit4", Campaign.getCpgIndicUnit4()); unit1 = (deviseStr == null ? "" : " " + deviseStr); } catch (Exception e) { } %> <% try { est = Campaign.getCpgIndicEst5(); } catch(FieldNotInitializedException e) { est = 0; } try { reel = Campaign.getCpgIndicReal5(); } catch(FieldNotInitializedException e) { reel = 0; } diffN = reel - est; if (est != 0) { diffP = ((double)diffN / (double)est) * 100; } else { diffP = 0; } try { String deviseStr = (String)dico.getRefDisp(session, "CpgIndicUnit5", Campaign.getCpgIndicUnit5()); unit1 = (deviseStr == null ? "" : " " + deviseStr); } catch (Exception e) { unit1 = ""; } %>
 
<%= floatFormat.format(est).trim() %><%= unit1 %>  <%= floatFormat.format(reel).trim() %><%= unit1 %>  <%= floatFormat.format(diffN).trim() %><%= unit1 %> : <%= floatFormat.format(diffP).trim() %> % 
<%= floatFormat.format(est).trim() %><%= unit1 %>  <%= floatFormat.format(reel).trim() %><%= unit1 %>  <%= floatFormat.format(diffN).trim() %><%= unit1 %> : <%= floatFormat.format(diffP).trim() %> % 
<%= floatFormat.format(est).trim() %><%= unit1 %>  <%= floatFormat.format(reel).trim() %><%= unit1 %>  <%= floatFormat.format(diffN).trim() %><%= unit1 %> : <%= floatFormat.format(diffP).trim() %> % 
<%= floatFormat.format(est) %><%= unit1 %> <%= floatFormat.format(reel).trim() %><%= unit1 %> <%= floatFormat.format(diffN).trim() %><%= unit1 %> : <%= floatFormat.format(diffP).trim() %> %
<%= floatFormat.format(est).trim() %><%= unit1 %> <%= floatFormat.format(reel).trim() %><%= unit1 %> <%= floatFormat.format(diffN).trim() %><%= unit1 %> : <%= floatFormat.format(diffP).trim() %> %
"> <% String[] stgFields = { "StgID", "StgCpgID", "StgDateBeg", "StgContactEst", "StgTitle" }; String[][] stgQuery = { { "StgCpgID = " + Utils.formatToSQL(context,id ) } }; String[] stgOrder = { "StgPos","StgDateBeg ASC" }; Vector stgResult = StageBean.listSummary(context, stgFields, stgQuery, stgOrder); //float totalImputed = 0; // int totalTarget = 0; if (stgResult.size() == 0) { %> <% } else { %> <% boolean isBlue = true; for (int cnt = 0; cnt < stgResult.size(); ++cnt) { Hashtable row = (Hashtable) stgResult.elementAt(cnt); String stgID = (String) row.get("StgID"); float imputed = 0; int target = 0; String[] ctnFields = { "CtnID", "CtnNumUnits", "CtnCampID", "CtnStageID", "CtnFactLn:IneUnitPrice" }; String[][] ctnQuery = { { "CtnCampID = " + Utils.formatToSQL(context, id), "CtnStageID = " + Utils.formatToSQL(context, stgID) } }; Vector ctnResults = CategorizationBean.listSummary(context, ctnFields, ctnQuery); int numUnits; float unitPrice; for (int cnt2 = 0; cnt2 < ctnResults.size(); ++cnt2) { Hashtable row2 = (Hashtable) ctnResults.elementAt(cnt2); try { numUnits = Integer.parseInt(row2.get("CtnNumUnits").toString()); unitPrice = Float.parseFloat(row2.get("CtnFactLn:IneUnitPrice").toString()); } catch (Exception e) { numUnits = 0; unitPrice = 0; } imputed += numUnits * unitPrice; } try { target = ((Integer)row.get("StgContactEst")).intValue(); } catch (Exception e) { target = 0; } float part = ((float) target) / cpgTargetNo * 100; %> "> <% isBlue = !isBlue; totalImputed += imputed; totalTarget += target; imputed = 0; } %>
<%= row.get("StgTitle") %> <%= Utils.formatToWebDate(session, (Date)row.get("StgDateBeg"), true) %> <%= moneyFormat.format(imputed) %> <%=Utils.getMessage(session, "L648F", false, true, "€") %> <%= intFormat.format(target) %> <%= !Float.isNaN(part)? floatFormat.format(part):"0 %" %>

<% isBlue = !isBlue;%> <% isBlue = !isBlue;%> <% float budgPercent = 0; float targetPercent = 0; try { if (totalImputed != 0) budgPercent = (float)totalImputed / excBudget * 100; if (totalTarget != 0 ) targetPercent = (float)totalTarget / cpgTargetNo * 100; } catch (ArithmeticException e) { } %> <% } %>
 
<%= moneyFormat.format(totalImputed) %> <%=Utils.getMessage(session, "L648F", false, true, "€") %> <%= intFormat.format(totalTarget) %>
<%= moneyFormat.format(Math.max(excBudget - totalImputed, 0)) %> <%=Utils.getMessage(session, "L648F", false, true, "€") %> <%= intFormat.format(Math.max(cpgTargetNo - totalTarget, 0)) %>
<%= floatFormat.format(budgPercent) %> % <%= floatFormat.format(targetPercent) %> %
" visible="<%= context.getAutoDisplayManager().hasEntry(\"Campaign\", \"Campagne 2\") %>"> ">