<% /****************************************************************************** * 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" import="com.edeal.frontline.*"%><%@page import="java.util.*" %><%@ page import="java.util.Vector" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@ page import="java.text.DecimalFormat" %><%@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(); String id = null; try { id = InvoiceEntry.getID(); } catch (FieldNotInitializedException fnie) { } InvoiceBean Invoice; SupplierBean Supplier; try { String IneInvId = InvoiceEntry.getIneInvId(); Invoice = new InvoiceBean(IneInvId, context); String IneSupplId = Invoice.getInvSupplID(); Supplier = new SupplierBean(IneSupplId, context); request.setAttribute("Invoice", Invoice); request.setAttribute("Supplier", Supplier); } catch (Exception e) { Invoice = null; Supplier = null; } // Find out how many units are left with this invoice entry int categoriesToGo = 0; try { String[] ctnKeys2 = { "Sum" }; String query = "SELECT SUM(CtnNumUnits) from Categorization where CtnFactLn = " + Utils.formatToSQL(context, id); Vector resp = BasicBean.listSQL(context, ctnKeys2, query); Hashtable hash = (Hashtable) resp.firstElement(); categoriesToGo = ((Number)hash.get("Sum")).intValue(); } catch (Exception e) { } 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 numberUnits = InvoiceEntry.getIneNumUnits(); float prixUnit = InvoiceEntry.getIneUnitPrice(); float amount = numberUnits * prixUnit; float montantTtl = 0; String[] ctnKeys = { "CtnID", "CtnCampID", "CtnStageID", "CtnNumUnits", "CtnCrDt" }; String[][] ctnQuery = { { "CtnFactLn = " + Utils.formatToSQL(context, InvoiceEntry.getIneID()) } }; String[] ctnOrderBy = { "CtnCrDt ASC" }; Vector ctnResult = CategorizationBean.listSummary(context, ctnKeys, ctnQuery, ctnOrderBy); // Calculate the amount categorized for this InvoiceEntry for (int cnt = 0; cnt < ctnResult.size(); ++cnt) { Hashtable row = (Hashtable) ctnResult.elementAt(cnt); Integer quant = (Integer) row.get("CtnNumUnits"); float montant = quant.intValue() * prixUnit; montantTtl += montant; } %> " ou="<%= \"/read_invoiceEntry.fl\" + ( id != null ? \"?id=\" + id : \"\") %>" >
<%= moneyFormat.format(amount) %> €
<%= intFormat.format(numberUnits) %>
"/>">
<%= moneyFormat.format(montantTtl) %> €
<%= moneyFormat.format(prixUnit) %> €
<%= moneyFormat.format(amount - montantTtl) %> €
">
" onselect="refreshCtn();">