Edit C:\Windows\install\galaxie_p02_26-09\sales\productOpportunity\prodOppsTable_ajax.jsp
<%@page import="com.edeal.frontline.DataDictionary"%> <%@page import="com.edeal.frontline.FieldNotInitializedException"%> <%@page import="com.edeal.frontline.FrontlineException"%> <%@page import="com.edeal.frontline.AccessDeniedException"%> <%@page import="com.edeal.frontline.OpportunityBean"%> <% /****************************************************************************** * 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" contentType="text/plain;charset=UTF-8"%><%@ page import="com.edeal.frontline.FlContext" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@ page import="java.util.Vector" %><%@ page import="java.util.Hashtable" %><%@ page import="java.text.DecimalFormat" %><%@ page import="com.edeal.frontline.FlLocale" %><%@ page import="com.edeal.frontline.Utils" %><% 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(); boolean listOnly; try { listOnly = Boolean.valueOf(flRequest.getParameter("listOnly")).booleanValue(); } catch (Exception e) { listOnly = true; } DecimalFormat unitPriceFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.##"); DecimalFormat moneyFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.##"); DecimalFormat intFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0;- #,##0"); DecimalFormat doubleFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.##;- #,##0.##"); double totalGross = 0; double totalPrice = 0; double Remise = 0; double totalDiscountM = 0; double totalTVA = 0; double totalTPF = 0; double totalHT = 0; double netApayer = 0; boolean presenceArt = false; Vector prods = (Vector)flRequest.getAttribute("products"); String oppID = (String)flRequest.getAttribute("pOppID"); OpportunityBean opp = new OpportunityBean(oppID, context); double acompte = 0; try{ acompte = (Double)opp.getCustomProperty("OppAcompte_"); }catch(FieldNotInitializedException fe){ } StringBuffer tableBuf = new StringBuffer(); // Construct our table tableBuf.append("<div id=\"grid-data\" class=\"data\">"); tableBuf.append("<table cellpadding=\"0\" cellspacing=\"0\">"); if (prods.size() == 0) { tableBuf.append("<tr valign=\\\"top\\\"><td colspan=\\\"5\\\" style=\\\"width: 100%;\\\"><span class=\\\"dataLabel\\\">"); tableBuf.append(Utils.getMessage(session, "L0001", true, "Aucune entrée disponible")); tableBuf.append("</span></td></tr>"); } else { String height = null; try{ height = flRequest.getContext().getContextParameter("Devis.Thumbnail.Height"); } catch (FrontlineException fex) { height = "50"; } String width = null; try{ width = flRequest.getContext().getContextParameter("Devis.Thumbnail.Width"); } catch (FrontlineException fex) { width = "80"; } tableBuf.append("<thead><tr valign=\"top\">"); if (!listOnly) { tableBuf.append("<th style=\\\"width: 1%;\\\"> </th>"); } tableBuf.append("<th>"); tableBuf.append(Utils.getMessage(session, "F600A", true, "Image")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "F2000", true, "Code")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "F203F", true, "Désignation")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "F3023", true, "P. U. HT")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "LF18A", true, "Quantité facturée")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "F3025", true, "Remise sur P.U")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF132", true, "P. U. HT Après Remise")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF134", true, "Montant HT")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF130", true, "TVA à appliquer")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF140", true, "Montant TVA")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF1F0", true, "TPF à appliquer")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF1F1", true, "Montant TPF")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "F3026", true, "Prix net")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "", true, "Code TVA")); tableBuf.append("</th></tr>"); // Product rows boolean doColor = false; for (int cnt = 0; cnt < prods.size(); ++cnt) { Hashtable row = (Hashtable)prods.elementAt(cnt); presenceArt = true; // récup image du produit String imgPrdID = null; imgPrdID = (String)row.get("ProPrdID:PrdPicID"); Double ProPrice = (Double) row.get("ProPrice"); if (ProPrice != null ) { totalPrice += ProPrice.doubleValue(); } Integer ProQuantity = (Integer) row.get("ProQuantity"); Double ProUnitPrice = (Double)row.get("ProUnitPrice"); Double ProMontantHTrem_ = (Double)row.get("ProMontantHTrem_"); Double ProMontantTva_ = (Double)row.get("ProMontantTva_"); Double ProMontantTpf_ = (Double)row.get("ProMontantTpf_"); Double ProUnitHTrem_ = (Double)row.get("ProUnitHTrem_"); try { totalGross += ProQuantity.intValue() * ProUnitPrice.doubleValue(); } catch (NullPointerException e) { } String ProRemise_ =(String)row.get("ProRemise_:Val"); String ProPrdTva_ =(String)row.get("ProPrdTva_:Val"); String codeTVA = dico.getRefCode("ProPrdTva_", (String)row.get("ProPrdTva_")); String ProPrdTaxeParafiscale_ =(String)row.get("ProPrdTaxeParafiscale_:Val"); // on additionne les montants de remise de chaque produit if (ProRemise_ != null && ProUnitHTrem_ != null) { Remise = ( ProUnitPrice.doubleValue() - ProUnitHTrem_.doubleValue() ) * ProQuantity ; totalDiscountM += Remise; } // on additionne les montants TVA de chaque produit if (ProMontantTva_ != null ) { totalTVA += ProMontantTva_.doubleValue(); } // on additionne les montants TVA de chaque produit if (ProMontantTpf_ != null ) { totalTPF += ProMontantTpf_.doubleValue(); } // on additionne les montants HT de chaque produit if (ProMontantHTrem_ != null ) { totalHT += ProMontantHTrem_.doubleValue(); } netApayer = totalPrice-acompte; String PrdCode = (String)row.get("ProPrdID:PrdCode"); String PrdDesignation = (String)row.get("ProDesignation"); tableBuf.append("<tr valign=\\\"top\\\" class=\\\""+ (doColor ? "tabSimpleFdBlanc" : "tabSimpleFdBleu") +"\\\">"); if (!listOnly) { tableBuf.append("<td><a href=\\\"javascript:doEdit(\\\'" + row.get("ProID") + "\\\')\\\"><img src=\\\"" + context.getContextName() + "/icons/ico/zoom.gif\\\" class=\\\"icon\\\" style=\\\"padding-left: 0px;\\\"></a> "); tableBuf.append("<a href=\\\"javascript:doDelete(\\\'" + row.get("ProID") + "\\\')\\\"><img src=\\\"" + context.getContextName() + "/icons/ico/supprimer.gif\\\" class=\\\"icon\\\"></a></td>"); } if (imgPrdID != null) { tableBuf.append("<td nowrap style=\\\"width: 10%;text-align:left;\\\">"); tableBuf.append("<img alt=\"\" src=\"" + (String) flRequest.getContextPath() + "/download?id=" + imgPrdID + "\" height=\"" + height + "\" width=\"" + width + "\"/>"); tableBuf.append("</td>"); } else { tableBuf.append("<td nowrap style=\\\"width: 10%;text-align:left;\\\">"); tableBuf.append("</td>"); } tableBuf.append("<td nowrap>"); if (listOnly) { tableBuf.append("<a href=\\\"" + context.getContextName() + "/read_product.fl?id=" + row.get("ProPrdID") + "\\\">"); } tableBuf.append(PrdCode == null ? " " : Utils.formatToJavascript(PrdCode)); if (listOnly) { tableBuf.append("</a>"); } tableBuf.append("</td><td nowrap style=\\\"width: 20%;text-align:left;\\\">"); tableBuf.append(PrdDesignation == null ? " " : Utils.formatToJavascript(PrdDesignation)); tableBuf.append("</td><td nowrap style=\\\"width: 7%;text-align: right;\\\">"); tableBuf.append(ProUnitPrice == null ? " " : unitPriceFormat.format(ProUnitPrice.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 7%;text-align: right;\\\">"); tableBuf.append(ProQuantity == null ? " " : intFormat.format(ProQuantity.intValue())); tableBuf.append("</td><td nowrap style=\\\"width: 10%;text-align:left;\\\">"); tableBuf.append(ProRemise_ == null ? " " : Utils.formatToJavascript(ProRemise_)); tableBuf.append("</td><td nowrap style=\\\"width: 7%;text-align: right;\\\">"); tableBuf.append( ProUnitHTrem_== null ? " " : unitPriceFormat.format(ProUnitHTrem_.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 8%;text-align: right;\\\">"); tableBuf.append( ProMontantHTrem_ == null ? " " : unitPriceFormat.format(ProMontantHTrem_.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 8%;text-align:left;\\\">"); tableBuf.append(ProPrdTva_ == null ? " " : Utils.formatToJavascript(ProPrdTva_)); tableBuf.append("</td><td nowrap style=\\\"width: 6%;text-align: right;\\\">"); tableBuf.append(ProMontantTva_ == null ? " " : unitPriceFormat.format(ProMontantTva_.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 10%;text-align:left;\\\">"); tableBuf.append(ProPrdTaxeParafiscale_ == null ? " " : Utils.formatToJavascript(ProPrdTaxeParafiscale_)); tableBuf.append("</td><td nowrap style=\\\"width: 6%;text-align: right;\\\">"); tableBuf.append(ProMontantTpf_ == null ? " " : unitPriceFormat.format(ProMontantTpf_.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 10%;text-align: right;\\\">"); tableBuf.append(ProPrice == null ? " " : moneyFormat.format(ProPrice.doubleValue()) + " €"); tableBuf.append("</td><td nowrap style=\\\"width: 8%;text-align:left;\\\">"); tableBuf.append(ProPrdTva_ == null ? " " : Utils.formatToJavascript(codeTVA)); tableBuf.append("</td></tr>"); doColor = !doColor; } // Total - headers tableBuf.append("<tr class=\\\"ligne_separation\\\" valign=\\\"top\\\" style=\\\"border:0px;\\\"><td colspan=\\\"7\\\" style=\\\"border:0px;\\\"> </td></tr>"); tableBuf.append("<tr style=\\\"vertical-align: top\\\">"); if (!listOnly) { tableBuf.append("<th colspan=\\\"3\\\" style=\\\"text-align: right; border: 0px;\\\"> </th>"); } else { tableBuf.append("<th colspan=\\\"3\\\" style=\\\"text-align: right; border: 0px;\\\"> </th>"); } tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF13D", true, "Acompte")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "L3041", true, "Remise totale")); tableBuf.append("</th><th colspan=\\\"3\\\">"); tableBuf.append(Utils.getMessage(session, "LF18B", true, "Total HT")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "LF18C", true, "Total TVA")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "LF18E", true, "Total TPF")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "LF18D", true, "Total TTC")); tableBuf.append("</th><th>"); tableBuf.append(Utils.getMessage(session, "FF13E", true, "NET à Payer")); tableBuf.append("</th></tr>"); tableBuf.append("<tr style=\\\"vertical-align: top;border: 0px;\\\" class=\\\"tabSimpleFdBleu\\\" valign=\\\"top\\\">"); if (!listOnly) { tableBuf.append("<td colspan=\\\"3\\\" class=\\\"headerDataGrid\\\" style=\\\"text-align: right;background-color: #fff;border: 0px;\\\">"); } else { tableBuf.append("<td colspan=\\\"3\\\" class=\\\"headerDataGrid\\\" style=\\\"text-align: right;background-color: #fff;border: 0px;\\\">"); } tableBuf.append(Utils.getMessage(session, "F1058", true, "Total") + " : "); tableBuf.append("</td><td style=\\\"text-align: right;\\\">"); tableBuf.append(moneyFormat.format(acompte) + " €"); tableBuf.append("</td><td style=\\\"text-align: right;\\\">"); tableBuf.append(moneyFormat.format(totalDiscountM) + " €"); tableBuf.append("</td><td colspan=\\\"3\\\"style=\\\"text-align: right;;\\\">"); tableBuf.append(moneyFormat.format(totalHT) + " €"); tableBuf.append("</td><td style=\\\"text-align: right;;\\\">"); tableBuf.append(moneyFormat.format(totalTVA) + " €"); tableBuf.append("</td><td style=\\\"text-align: right;;\\\">"); tableBuf.append(moneyFormat.format(totalTPF) + " €"); tableBuf.append("</td><td style=\\\"text-align: right;\\\">"); tableBuf.append(moneyFormat.format(totalPrice) + " €"); tableBuf.append("</td><td style=\\\"text-align: right;;\\\">"); tableBuf.append(moneyFormat.format(netApayer) + " €"); tableBuf.append("</td></tr></thead>"); } tableBuf.append("</table>"); try{ opp.setCustomProperty("OppNetApayer_", netApayer); opp.setCustomProperty("OppTotalHT_", totalHT); opp.setCustomProperty("OppTotalTVA_", totalTVA); opp.setCustomProperty("OppTotalTTC_", totalPrice); opp.setCustomProperty("OppTotalTPF_", totalTPF); opp.save(); }catch(AccessDeniedException ae){ }catch(FrontlineException fe){ } %>var f = document.getElementById('ProdOppTable'); f.innerHTML = '<%= tableBuf.toString() %>'; <% if(presenceArt) {%> document.forms[0].presenceArticles.value ='true'; <%}%> try { document.forms[0].total.value = '<%= moneyFormat.format(totalPrice) %>'; document.forms[0].totalHT.value = '<%= moneyFormat.format(totalHT) %>'; document.forms[0].totalTVA.value = '<%= moneyFormat.format(totalTVA) %>'; document.forms[0].totalTPF.value = '<%= moneyFormat.format(totalTPF) %>'; } catch (error) { }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de