[OFBiz] SVN: r7417 - in trunk/applications/accounting: config data script/org/ofbiz/accounting/invoice webapp/accounting/WEB-INF/actions/invoice webapp/accounting/WEB-INF/actions/payment webapp/accounting/payment widget

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Wed Apr 26 02:35:05 CDT 2006


Author: hansbak
Date: 2006-04-26 02:34:19 -0500 (Wed, 26 Apr 2006)
New Revision: 7417

Modified:
   trunk/applications/accounting/config/AccountingUiLabels.properties
   trunk/applications/accounting/config/AccountingUiLabels_nl.properties
   trunk/applications/accounting/data/PaymentsInvoices.xml
   trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
   trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh
   trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh
   trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh
   trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh
   trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml
   trunk/applications/accounting/widget/InvoiceScreens.xml
   trunk/applications/accounting/widget/Menus.xml
   trunk/applications/accounting/widget/PaymentScreens.xml
Log:
comma's and dots in numbers should be better now when the locale is not english

Modified: trunk/applications/accounting/config/AccountingUiLabels.properties
===================================================================
--- trunk/applications/accounting/config/AccountingUiLabels.properties	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/config/AccountingUiLabels.properties	2006-04-26 07:34:19 UTC (rev 7417)
@@ -437,7 +437,7 @@
 AccountingNoAmount=Amount requested to apply is zero or not provided: no amount applied/n
 AccountingApplicationSuccess=Applying ${amountApplied?currency(${isoCode})} from payment [${paymentId}] to ${toMessage}
 AccountingApplicationToInvoice=to invoice [${invoiceId}]
-AccountingApplicationToInvoiceItem=to invoice [${invoiceId}] Item [${invoiceItemSeqId}]
+AccountingApplicationToInvoiceItem=to invoice [${paymentApplication.invoiceId}] Item [${paymentApplication.invoiceItemSeqId}]
 AccountingApplicationToPayment=to payment [${paymentId}]
 AccountingApplicationToBillingAccount=to billing account [${billingAccountId}]
 AccountingApplicationToTax=to Tax Authority area [${taxAuthGeoId}]

Modified: trunk/applications/accounting/config/AccountingUiLabels_nl.properties
===================================================================
--- trunk/applications/accounting/config/AccountingUiLabels_nl.properties	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/config/AccountingUiLabels_nl.properties	2006-04-26 07:34:19 UTC (rev 7417)
@@ -439,7 +439,7 @@
 AccountingNoAmount=De aangevraagde toewijzing is "0" of niet aangegeven: geen bedrag toegewezen\n
 AccountingApplicationSuccess=${amountApplied?currency(${isoCode})} van betaling [${paymentId}] is toegewezen ${toMessage}
 AccountingApplicationToInvoice=aan faktuur [${invoiceId}]
-AccountingApplicationToInvoiceItem=aan faktuur [${invoiceId}] met regelnummer [${invoiceItemSeqId}]
+AccountingApplicationToInvoiceItem=aan faktuur [${paymentApplication.invoiceId}] met regelnummer [${paymentApplication.invoiceItemSeqId}]
 AccountingApplicationToPayment=aan betaling [${paymentId}]
 AccountingApplicationToBillingAccount=aan factuurrekening [${billingAccountId}]
 AccountingApplicationToTax=aan belastingsinstantie [${taxAuthGeoId}]

Modified: trunk/applications/accounting/data/PaymentsInvoices.xml
===================================================================
--- trunk/applications/accounting/data/PaymentsInvoices.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/data/PaymentsInvoices.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -10,21 +10,21 @@
     <PartyGroup partyId="AcctBigSupplier" groupName="Big Supplier"/>
     <PartyRole partyId="AcctBigSupplier" roleTypeId="SUPPLIER"/>
 
-    <Payment paymentId="10000" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodTypeId="EFT_ACCOUNT" partyIdFrom="AcctBuyer" partyIdTo="TESTING" statusId="PMNT_NOT_PAID" effectiveDate="2006-04-25 12:56:54.292" amount="190.97" currencyUomId="USD" lastUpdatedStamp="2006-04-25 13:13:27.746" lastUpdatedTxStamp="2006-04-25 13:13:27.711" createdStamp="2006-04-25 12:56:54.292" createdTxStamp="2006-04-25 12:56:54.292"/>
-    <Payment paymentId="10010" paymentTypeId="CUSTOMER_REFUND" paymentMethodTypeId="EXT_BILLACT" partyIdFrom="TESTING" partyIdTo="AcctBuyer" statusId="PMNT_SENT" effectiveDate="2006-04-25 13:11:05.94" amount="20.0" currencyUomId="USD" lastUpdatedStamp="2006-04-25 13:12:57.445" lastUpdatedTxStamp="2006-04-25 13:12:57.33" createdStamp="2006-04-25 13:11:05.941" createdTxStamp="2006-04-25 13:11:05.941"/>
+    <Payment paymentId="demo10000" paymentTypeId="CUSTOMER_PAYMENT" paymentMethodTypeId="EFT_ACCOUNT" partyIdFrom="AcctBuyer" partyIdTo="TESTING" statusId="PMNT_NOT_PAID" effectiveDate="2006-04-25 12:56:54.292" amount="190.97" currencyUomId="USD" lastUpdatedStamp="2006-04-25 13:13:27.746" lastUpdatedTxStamp="2006-04-25 13:13:27.711" createdStamp="2006-04-25 12:56:54.292" createdTxStamp="2006-04-25 12:56:54.292"/>
+    <Payment paymentId="demo10010" paymentTypeId="CUSTOMER_REFUND" paymentMethodTypeId="EXT_BILLACT" partyIdFrom="TESTING" partyIdTo="AcctBuyer" statusId="PMNT_SENT" effectiveDate="2006-04-25 13:11:05.94" amount="20.0" currencyUomId="USD" lastUpdatedStamp="2006-04-25 13:12:57.445" lastUpdatedTxStamp="2006-04-25 13:12:57.33" createdStamp="2006-04-25 13:11:05.941" createdTxStamp="2006-04-25 13:11:05.941"/>
 
-    <Invoice invoiceId="10000" invoiceTypeId="SALES_INVOICE" partyIdFrom="TESTING" partyId="AcctBuyer" statusId="INVOICE_IN_PROCESS" invoiceDate="2006-04-25 12:46:27.122" description="This is the first invoice number t AcctBuyer" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:46:27.426" lastUpdatedTxStamp="2006-04-25 12:46:27.426" createdStamp="2006-04-25 12:46:27.426" createdTxStamp="2006-04-25 12:46:27.426"/>
-    <Invoice invoiceId="10001" invoiceTypeId="PURCHASE_INVOICE" partyIdFrom="AcctBigSupplier" partyId="TESTING" statusId="INVOICE_IN_PROCESS" invoiceDate="2006-04-25 12:50:50.655" description="Another invoice" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:50:50.665" lastUpdatedTxStamp="2006-04-25 12:50:50.538" createdStamp="2006-04-25 12:50:50.665" createdTxStamp="2006-04-25 12:50:50.538"/>
-    <Invoice invoiceId="10002" invoiceTypeId="SALES_INVOICE" partyIdFrom="TESTING" partyId="AcctBuyer" statusId="INVOICE_SENT" invoiceDate="2006-04-25 12:54:07.011" description="Another sales invoice" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:55:44.189" lastUpdatedTxStamp="2006-04-25 12:55:44.058" createdStamp="2006-04-25 12:54:07.018" createdTxStamp="2006-04-25 12:54:06.97"/>
-    <InvoiceItem invoiceId="10000" invoiceItemSeqId="00001" invoiceItemTypeId="INV_SPROD_ITEM" uomId="USD" taxableFlag="Y" amount="20.0" description="this was e service for a product" lastUpdatedStamp="2006-04-25 12:47:16.599" lastUpdatedTxStamp="2006-04-25 12:47:16.48" createdStamp="2006-04-25 12:47:16.599" createdTxStamp="2006-04-25 12:47:16.48"/>
-    <InvoiceItem invoiceId="10000" invoiceItemSeqId="00002" invoiceItemTypeId="INV_PROD_ITEM" uomId="USD" taxableFlag="Y" amount="269.99" description="Big Gizmo w/ Legs" lastUpdatedStamp="2006-04-25 12:48:07.529" lastUpdatedTxStamp="2006-04-25 12:48:07.443" createdStamp="2006-04-25 12:47:49.766" createdTxStamp="2006-04-25 12:47:49.401"/>
-    <InvoiceItem invoiceId="10000" invoiceItemSeqId="00003" invoiceItemTypeId="INV_SALES_TAX" uomId="USD" taxableFlag="Y" amount="33.55" description="sales tax" lastUpdatedStamp="2006-04-25 12:49:06.04" lastUpdatedTxStamp="2006-04-25 12:49:06.038" createdStamp="2006-04-25 12:49:06.04" createdTxStamp="2006-04-25 12:49:06.038"/>
-    <InvoiceItem invoiceId="10001" invoiceItemSeqId="00001" invoiceItemTypeId="PINV_WE_ITEM" uomId="USD" taxableFlag="Y" amount="33.99" description="Service received" lastUpdatedStamp="2006-04-25 12:51:29.251" lastUpdatedTxStamp="2006-04-25 12:51:29.197" createdStamp="2006-04-25 12:51:29.251" createdTxStamp="2006-04-25 12:51:29.197"/>
-    <InvoiceItem invoiceId="10001" invoiceItemSeqId="00002" invoiceItemTypeId="PINV_SURCHARGE_ADJ" uomId="USD" taxableFlag="Y" amount="2.44" description="Service received" lastUpdatedStamp="2006-04-25 12:52:19.907" lastUpdatedTxStamp="2006-04-25 12:52:19.826" createdStamp="2006-04-25 12:52:19.907" createdTxStamp="2006-04-25 12:52:19.826"/>
-    <InvoiceItem invoiceId="10002" invoiceItemSeqId="00001" invoiceItemTypeId="INV_DPROD_ITEM" uomId="USD" taxableFlag="Y" amount="1.0" description="Add more money to your card!" lastUpdatedStamp="2006-04-25 12:54:37.473" lastUpdatedTxStamp="2006-04-25 12:54:37.373" createdStamp="2006-04-25 12:54:37.473" createdTxStamp="2006-04-25 12:54:37.373"/>
-    <InvoiceItem invoiceId="10002" invoiceItemSeqId="00002" invoiceItemTypeId="INV_DPROD_ITEM" uomId="USD" taxableFlag="Y" amount="55.99" description="A digital gizmo: can be downloaded immediately after purchase." lastUpdatedStamp="2006-04-25 12:55:27.232" lastUpdatedTxStamp="2006-04-25 12:55:27.092" createdStamp="2006-04-25 12:55:27.232" createdTxStamp="2006-04-25 12:55:27.092"/>
-    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="10000" statusDate="2006-04-25 12:46:27.122" lastUpdatedStamp="2006-04-25 12:46:27.492" lastUpdatedTxStamp="2006-04-25 12:46:27.426" createdStamp="2006-04-25 12:46:27.492" createdTxStamp="2006-04-25 12:46:27.426"/>
-    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="10001" statusDate="2006-04-25 12:50:50.655" lastUpdatedStamp="2006-04-25 12:50:50.67" lastUpdatedTxStamp="2006-04-25 12:50:50.538" createdStamp="2006-04-25 12:50:50.67" createdTxStamp="2006-04-25 12:50:50.538"/>
-    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="10002" statusDate="2006-04-25 12:54:07.011" lastUpdatedStamp="2006-04-25 12:54:07.024" lastUpdatedTxStamp="2006-04-25 12:54:06.97" createdStamp="2006-04-25 12:54:07.024" createdTxStamp="2006-04-25 12:54:06.97"/>
-    <InvoiceStatus statusId="INVOICE_SENT" invoiceId="10002" statusDate="2006-04-25 12:55:44.228" lastUpdatedStamp="2006-04-25 12:55:44.228" lastUpdatedTxStamp="2006-04-25 12:55:44.058" createdStamp="2006-04-25 12:55:44.228" createdTxStamp="2006-04-25 12:55:44.058"/>
+    <Invoice invoiceId="demo10000" invoiceTypeId="SALES_INVOICE" partyIdFrom="TESTING" partyId="AcctBuyer" statusId="INVOICE_IN_PROCESS" invoiceDate="2006-04-25 12:46:27.122" description="This is the first invoice number t AcctBuyer" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:46:27.426" lastUpdatedTxStamp="2006-04-25 12:46:27.426" createdStamp="2006-04-25 12:46:27.426" createdTxStamp="2006-04-25 12:46:27.426"/>
+    <Invoice invoiceId="demo10001" invoiceTypeId="PURCHASE_INVOICE" partyIdFrom="AcctBigSupplier" partyId="TESTING" statusId="INVOICE_IN_PROCESS" invoiceDate="2006-04-25 12:50:50.655" description="Another invoice" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:50:50.665" lastUpdatedTxStamp="2006-04-25 12:50:50.538" createdStamp="2006-04-25 12:50:50.665" createdTxStamp="2006-04-25 12:50:50.538"/>
+    <Invoice invoiceId="demo10002" invoiceTypeId="SALES_INVOICE" partyIdFrom="TESTING" partyId="AcctBuyer" statusId="INVOICE_SENT" invoiceDate="2006-04-25 12:54:07.011" description="Another sales invoice" currencyUomId="USD" lastUpdatedStamp="2006-04-25 12:55:44.189" lastUpdatedTxStamp="2006-04-25 12:55:44.058" createdStamp="2006-04-25 12:54:07.018" createdTxStamp="2006-04-25 12:54:06.97"/>
+    <InvoiceItem invoiceId="demo10000" invoiceItemSeqId="00001" invoiceItemTypeId="INV_SPROD_ITEM" uomId="USD" taxableFlag="Y" amount="20.0" description="this was e service for a product" lastUpdatedStamp="2006-04-25 12:47:16.599" lastUpdatedTxStamp="2006-04-25 12:47:16.48" createdStamp="2006-04-25 12:47:16.599" createdTxStamp="2006-04-25 12:47:16.48"/>
+    <InvoiceItem invoiceId="demo10000" invoiceItemSeqId="00002" invoiceItemTypeId="INV_PROD_ITEM" uomId="USD" taxableFlag="Y" amount="269.99" description="Big Gizmo w/ Legs" lastUpdatedStamp="2006-04-25 12:48:07.529" lastUpdatedTxStamp="2006-04-25 12:48:07.443" createdStamp="2006-04-25 12:47:49.766" createdTxStamp="2006-04-25 12:47:49.401"/>
+    <InvoiceItem invoiceId="demo10000" invoiceItemSeqId="00003" invoiceItemTypeId="INV_SALES_TAX" uomId="USD" taxableFlag="Y" amount="33.55" description="sales tax" lastUpdatedStamp="2006-04-25 12:49:06.04" lastUpdatedTxStamp="2006-04-25 12:49:06.038" createdStamp="2006-04-25 12:49:06.04" createdTxStamp="2006-04-25 12:49:06.038"/>
+    <InvoiceItem invoiceId="demo10001" invoiceItemSeqId="00001" invoiceItemTypeId="PINV_WE_ITEM" uomId="USD" taxableFlag="Y" amount="33.99" description="Service received" lastUpdatedStamp="2006-04-25 12:51:29.251" lastUpdatedTxStamp="2006-04-25 12:51:29.197" createdStamp="2006-04-25 12:51:29.251" createdTxStamp="2006-04-25 12:51:29.197"/>
+    <InvoiceItem invoiceId="demo10001" invoiceItemSeqId="00002" invoiceItemTypeId="PINV_SURCHARGE_ADJ" uomId="USD" taxableFlag="Y" amount="2.44" description="Service received" lastUpdatedStamp="2006-04-25 12:52:19.907" lastUpdatedTxStamp="2006-04-25 12:52:19.826" createdStamp="2006-04-25 12:52:19.907" createdTxStamp="2006-04-25 12:52:19.826"/>
+    <InvoiceItem invoiceId="demo10002" invoiceItemSeqId="00001" invoiceItemTypeId="INV_DPROD_ITEM" uomId="USD" taxableFlag="Y" amount="1.0" description="Add more money to your card!" lastUpdatedStamp="2006-04-25 12:54:37.473" lastUpdatedTxStamp="2006-04-25 12:54:37.373" createdStamp="2006-04-25 12:54:37.473" createdTxStamp="2006-04-25 12:54:37.373"/>
+    <InvoiceItem invoiceId="demo10002" invoiceItemSeqId="00002" invoiceItemTypeId="INV_DPROD_ITEM" uomId="USD" taxableFlag="Y" amount="55.99" description="A digital gizmo: can be downloaded immediately after purchase." lastUpdatedStamp="2006-04-25 12:55:27.232" lastUpdatedTxStamp="2006-04-25 12:55:27.092" createdStamp="2006-04-25 12:55:27.232" createdTxStamp="2006-04-25 12:55:27.092"/>
+    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="demo10000" statusDate="2006-04-25 12:46:27.122" lastUpdatedStamp="2006-04-25 12:46:27.492" lastUpdatedTxStamp="2006-04-25 12:46:27.426" createdStamp="2006-04-25 12:46:27.492" createdTxStamp="2006-04-25 12:46:27.426"/>
+    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="demo10001" statusDate="2006-04-25 12:50:50.655" lastUpdatedStamp="2006-04-25 12:50:50.67" lastUpdatedTxStamp="2006-04-25 12:50:50.538" createdStamp="2006-04-25 12:50:50.67" createdTxStamp="2006-04-25 12:50:50.538"/>
+    <InvoiceStatus statusId="INVOICE_IN_PROCESS" invoiceId="demo10002" statusDate="2006-04-25 12:54:07.011" lastUpdatedStamp="2006-04-25 12:54:07.024" lastUpdatedTxStamp="2006-04-25 12:54:06.97" createdStamp="2006-04-25 12:54:07.024" createdTxStamp="2006-04-25 12:54:06.97"/>
+    <InvoiceStatus statusId="INVOICE_SENT" invoiceId="demo10002" statusDate="2006-04-25 12:55:44.228" lastUpdatedStamp="2006-04-25 12:55:44.228" lastUpdatedTxStamp="2006-04-25 12:55:44.058" createdStamp="2006-04-25 12:55:44.228" createdTxStamp="2006-04-25 12:55:44.058"/>
 </entity-engine-xml>

Modified: trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
===================================================================
--- trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -379,7 +379,7 @@
         <!-- invoice item -->
         <if-not-empty field-name="paymentApplication.invoiceItemSeqId">
             <field-to-result field-name="paymentApplication.invoiceItemSeqId" result-name="invoiceItemSeqId"/>
-            <string-append field-name="successMessage" string=" and itemID [${paymentApplication.invoiceItemSeqId}] "/>
+            <property-to-field resource="AccountingUiLabels" property="AccountingApplicationToInvoiceItem" field-name="toMessage"/>
         </if-not-empty>
         <!-- toPayment -->
         <if-not-empty field-name="paymentApplication.toPaymentId">

Modified: trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh
===================================================================
--- trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh	2006-04-26 07:34:19 UTC (rev 7417)
@@ -29,28 +29,26 @@
 import org.ofbiz.accounting.payment.*;
 import java.text.DateFormat;
 import java.text.*;
- 
+import java.text.NumberFormat;
+
+int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
+int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+NULL = new BigDecimal("0.00");
+
 delegator = request.getAttribute("delegator");
 invoiceId = request.getParameter("invoiceId");
 locale = context.get("locale");
 if (invoiceId == null)  invoiceId = context.get("invoiceId");
-if (invoiceId == null)  invoiceId = "null_in_createApplList.bsh";
 invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
 tabButtonItem = context.get("tabButtonItem");
 
-// find existing items
 ArrayList invoiceItems = new ArrayList();  // to pass back to the screeen with payment applications added
-double invoiceAmount = 0.00;
-double notAppliedAmount = 0.00;
-double appliedAmount = 0.00; // is the amoun the invoice is covered by a payment
 if (invoice != null) {    
-
     // retrieve related applications with null itemnumber
-    invoiceAppl = null;                        // to retrieve items from database
-    invoiceAppls = delegator.findByAnd("PaymentApplication", 
-        UtilMisc.toMap("invoiceId", invoiceId,"invoiceItemSeqId",null));
+    invoiceAppl = null;  
+    invoiceAppls = delegator.findByAnd("PaymentApplication",UtilMisc.toMap("invoiceId", invoiceId,"invoiceItemSeqId",null));
     Iterator q = invoiceAppls.iterator();
-    while (q.hasNext())    {
+    while (q.hasNext()) {
         invoiceAppl = q.next();
         Map itemmap = new HashMap();
         itemmap.put("invoiceId",invoiceId);
@@ -61,54 +59,49 @@
         itemmap.put("paymentId",invoiceAppl.getString("paymentId"));
         itemmap.put("billingAccountId",invoiceAppl.getString("billingAccountId"));
         itemmap.put("taxAuthGeoId",invoiceAppl.getString("taxAuthGeoId"));
-        itemmap.put("amountToApply",invoiceAppl.getDouble("amountApplied").doubleValue());
-        itemmap.put("amountApplied",invoiceAppl.getDouble("amountApplied").doubleValue());
+        itemmap.put("amountToApply",invoiceAppl.get("amountApplied"));
+        itemmap.put("amountApplied",invoiceAppl.get("amountApplied"));
         invoiceItems.add(itemmap);
-        appliedAmount += invoiceAppl.getDouble("amountApplied").doubleValue();
     }
 
-
-    invoiceItemsDb = null;                        // to retrieve items from database
-    invoiceItemsDb = invoice.getRelated("InvoiceItem");
-
-    // create totals
-    Iterator i = invoiceItemsDb.iterator();
+	
+	// retrieve related applications with an existing itemnumber
+    Iterator i = invoice.getRelated("InvoiceItem").iterator();
     while (i.hasNext()) {
         item = i.next();
-          double itemTotal = 0.00;
-          if (item.get("amount") != null) {
-              if (item.get("quantity") == null || item.getDouble("quantity").doubleValue() == 0.00) {
-                  itemTotal = item.getDouble("amount").doubleValue();
+        BigDecimal itemTotal = null;
+        if (item.get("amount") != null) {
+              if (item.get("quantity") == null || item.getBigDecimal("quantity").compareTo(NULL) == 0) {
+                  itemTotal = item.getBigDecimal("amount");
               }
               else {
-                  itemTotal = item.getDouble("amount").doubleValue() * item.getDouble("quantity").doubleValue();
+                  itemTotal = item.getBigDecimal("amount").multiply(item.getBigDecimal("quantity"));
               }
-          }
-          invoiceAmount += itemTotal;
+        }
            
-          // get relation payment applications for every item(can be more than 1 per item number)
-          paymentApplications = item.getRelated("PaymentApplication");
-          double applied = 0.00;
-          if (paymentApplications != null && paymentApplications.size() > 0)    {
+        // get relation payment applications for every item(can be more than 1 per item number)
+        paymentApplications = item.getRelated("PaymentApplication");
+        if (paymentApplications != null && paymentApplications.size() > 0)    {
               Iterator p = paymentApplications.iterator();
               while (p.hasNext())  {
                   paymentApplication = p.next();
                   Map itemmap = new HashMap();
                   itemmap.putAll(item);
-                  itemmap.put("total",itemTotal);
+                  itemmap.put("total",NumberFormat.getInstance(locale).format(itemTotal));
                   itemmap.put("paymentApplicationId",paymentApplication.getString("paymentApplicationId"));
                   itemmap.put("paymentId",paymentApplication.getString("paymentId"));
-                  itemmap.put("amountApplied",paymentApplication.getDouble("amountApplied"));
+                  itemmap.put("toPaymentId",paymentApplication.getString("toPaymentId"));
+                  itemmap.put("amountApplied",paymentApplication.getBigDecimal("amountApplied"));
+                  itemmap.put("amountToApply",paymentApplication.getBigDecimal("amountApplied"));
                   itemmap.put("billingAccountId",paymentApplication.getString("billingAccountId"));
                   itemmap.put("taxAuthGeoId",paymentApplication.getString("taxAuthGeoId"));
                   invoiceItems.add(itemmap);
-                  applied += paymentApplication.getDouble("amountApplied").doubleValue(); // to check if fully applied
               }
-              appliedAmount += applied;
-          }
+        }
+
 /*
-          // create an extra line for input when not completely applied but not in the overview 
-          if (tabButtonItem.equals("invoiceOverview") != true && 
+        // create an extra line for input when not completely applied but not in the overview 
+        if (tabButtonItem.equals("invoiceOverview") != true && 
                       (paymentApplications == null || paymentApplications.size() == 0 
                       || (applied < itemTotal && appliedAmount < invoiceAmount)))    {
                   Map itemmap = new HashMap();
@@ -120,15 +113,11 @@
                   itemmap.put("billingAccountId","");
                   itemmap.put("taxAuthGeoId","");
                   invoiceItems.add(itemmap);
-          }
-*/          notAppliedAmount += itemTotal - applied; // subtract itemrelated applications
+        }
+*/
     }
-    notAppliedAmount = invoiceAmount - appliedAmount; // subtract invoice related applications.
+	context.put("invoice",invoice);
+	context.put("invoiceId",invoiceId);
 }
 
-context.put("invoiceApplications",invoiceItems);
-context.put("invoice",invoice);
-context.put("invoiceId",invoiceId);
-context.put("invoiceAmount",NumberFormat.getInstance().format(invoiceAmount));
-context.put("appliedAmount",NumberFormat.getInstance().format(appliedAmount));
-context.put("notAppliedAmount",NumberFormat.getInstance().format(notAppliedAmount));
+if(invoiceItems.size() > 0) context.put("invoiceApplications",invoiceItems);

Modified: trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh
===================================================================
--- trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh	2006-04-26 07:34:19 UTC (rev 7417)
@@ -35,13 +35,12 @@
 import org.ofbiz.entity.model.*;
 import java.text.NumberFormat;
 
-
-
 invoiceId = parameters.get("invoiceId");
 invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
 
 int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+Locale locale = context.get("locale");
 
 ArrayList paymentsMapList = new ArrayList();  // to pass back to the screeen list of unapplied payments
 
@@ -54,8 +53,10 @@
 expr = new EntityExpr("partyIdFrom", EntityOperator.EQUALS, invoice.getString("partyId"));
 exprList.add(expr); 
 
-// only payments with received and sent
+// only payments with received and sent and not paid
 exprListStatus = new ArrayList();
+expr = new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_NOT_PAID");
+exprListStatus.add(expr); 
 expr = new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED");
 exprListStatus.add(expr); 
 expr = new EntityExpr("statusId", EntityOperator.EQUALS, "PMNT_SENT");
@@ -80,16 +81,15 @@
            Map paymentMap = new HashMap();
            paymentMap.put("paymentId", payment.getString("paymentId"));
            paymentMap.put("effectiveDate", payment.getString("effectiveDate").substring(0,10)); // list as YYYY-MM-DD
-           paymentMap.put("amount",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(payment.getBigDecimal("amount")));
+           paymentMap.put("amount", payment.getBigDecimal("amount"));
            paymentMap.put("currencyUomId", payment.getString("currencyUomId"));
            paymentMap.put("amountApplied", PaymentWorker.getPaymentAppliedBd(payment));
            BigDecimal paymentToApply = PaymentWorker.getPaymentNotAppliedBd(payment);
-           locale = parameters.get("autoUserLogin").get("lastLocale"); 
            if (paymentToApply.compareTo(invoiceToApply) < 0 ) {
-                paymentMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(paymentToApply));
+                paymentMap.put("amountToApply",paymentToApply);
            }
            else {
-                paymentMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(invoiceToApply));
+                paymentMap.put("amountToApply",invoiceToApply);
            }
            paymentsMapList.add(paymentMap);
         }

Modified: trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh
===================================================================
--- trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh	2006-04-26 07:34:19 UTC (rev 7417)
@@ -63,10 +63,10 @@
             invoiceMap.put("amountApplied", invoiceApplied);
             locale = parameters.get("autoUserLogin").get("lastLocale"); 
             if (paymentToApply.compareTo(invoiceToApply) < 0 ) {
-                invoiceMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(paymentToApply));
+                invoiceMap.put("amountToApply",paymentToApply);
             }
             else {
-                invoiceMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(invoiceToApply));
+                invoiceMap.put("amountToApply",invoiceToApply);
             }
             invoicesList.add(invoiceMap);
         } 

Modified: trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh
===================================================================
--- trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh	2006-04-26 07:34:19 UTC (rev 7417)
@@ -39,9 +39,8 @@
 
 int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+Locale locale = parameters.get("locale");
 
-// get the party to look for
-
 ArrayList paymentsMapList = new ArrayList();  // to pass back to the screeen list of unapplied payments
 
 // retrieve payments for the related parties which have not been (fully) applied yet
@@ -82,15 +81,14 @@
            paymentMap.put("toPaymentId", payment.getString("paymentId"));
            paymentMap.put("currencyUomId", payment.getString("currencyUomId"));
            paymentMap.put("effectiveDate", payment.getString("effectiveDate").substring(0,10)); // list as YYYY-MM-DD
-           paymentMap.put("amount", payment.getBigDecimal("amount").setScale(decimals,rounding));
+           paymentMap.put("amount", payment.getString("amount"));
            paymentMap.put("amountApplied", PaymentWorker.getPaymentAppliedBd(payment));
            BigDecimal paymentToApply = PaymentWorker.getPaymentNotAppliedBd(payment);
-           locale = parameters.get("autoUserLogin").get("lastLocale"); 
            if (paymentToApply.compareTo(basePaymentToApply) < 0 ) {
-                paymentMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(paymentToApply));
+                paymentMap.put("amountToApply",paymentToApply);
            }
            else {
-                paymentMap.put("amountToApply",NumberFormat.getNumberInstance(UtilMisc.ensureLocale(locale)).format(basePaymentToApply));
+                paymentMap.put("amountToApply",basePaymentToApply);
            }
            paymentsMapList.add(paymentMap);
         }

Modified: trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml
===================================================================
--- trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -139,7 +139,7 @@
     
     <form name="editPaymentApplicationsInv" default-title-style="tableheadtext" default-entity-name="PaymentApplication"
         default-tooltip-style="tabletext" default-widget-style="tabletext" list-name="paymentApplicationsInv"
-        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="true">
+        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="false">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
         <field name="invoiceId"><lookup target-form-name="LookupInvoice"></lookup></field>
@@ -160,7 +160,7 @@
     </form>
     <form name="editPaymentApplicationsPay" default-title-style="tableheadtext" default-entity-name="PaymentApplication"
         default-tooltip-style="tabletext" default-widget-style="tabletext" list-name="paymentApplicationsPay"
-        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="true">
+        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="false">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
         <field name="toPaymentId"><lookup target-form-name="LookupPayment"></lookup></field>
@@ -173,7 +173,7 @@
     </form>
     <form name="editPaymentApplicationsBil" default-title-style="tableheadtext" default-entity-name="PaymentApplication"
         default-tooltip-style="tabletext" default-widget-style="tabletext" list-name="paymentApplicationsBil"
-        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="true">
+        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="false">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
         <field name="billingAccountId"><lookup target-form-name="LookupBillingAccount"/></field>
@@ -186,7 +186,7 @@
     </form>
     <form name="editPaymentApplicationsTax" default-title-style="tableheadtext" default-entity-name="PaymentApplication"
         default-tooltip-style="tabletext" default-widget-style="tabletext" list-name="paymentApplicationsTax"
-        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="true">
+        target="updatePaymentApplication" title="List payment Applications" type="list" separate-columns="false">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
         <field name="taxAuthGeoId">

Modified: trunk/applications/accounting/widget/InvoiceScreens.xml
===================================================================
--- trunk/applications/accounting/widget/InvoiceScreens.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/widget/InvoiceScreens.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -84,6 +84,10 @@
                 <entity-and entity-name="InvoiceItem" list-name="invoiceItems">
                     <field-map field-name="invoiceId" value="${parameters.invoiceId}"/>
                 </entity-and>
+                <set field="invoiceAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(invoice)}"/>
+                <set field="notAppliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}"/>
+                <set field="appliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceAppliedBd(invoice)}"/>
+                
             </actions>
             <widgets>
                 <decorator-screen name="CommonInvoiceDecorator" location="${parameters.mainDecoratorLocation}">
@@ -162,6 +166,9 @@
                 <set field="invoiceId" from-field="parameters.invoiceId"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh"/>
+                <set field="invoiceAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(invoice)}"/>
+                <set field="notAppliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}"/>
+                <set field="appliedAmount" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceAppliedBd(invoice)}"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonInvoiceDecorator" location="${parameters.mainDecoratorLocation}">
@@ -175,6 +182,14 @@
                                 <include-form name="EditInvoiceApplications" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/>
                                 <section>
                                     <condition>
+                                        <if-empty field-name="invoiceApplications"/>
+                                    </condition>
+                                    <widgets>
+                                        <container><label style="head3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
+                                    </widgets>
+                                </section>
+                                <section>
+                                    <condition>
                                         <not><if-empty field-name="payments"/></not>
                                     </condition>
                                     <widgets>
@@ -188,6 +203,14 @@
                             <fail-widgets>
                                 <label style="head1" text="${uiLabelMap.AccountingPaymentsApplied}: ${appliedAmount?currency(${invoice.currencyUomId})}, open: ${notAppliedAmount?currency(${invoice.currencyUomId})}"/>
                                 <include-form name="EditInvoiceApplications" location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/>
+                                <section>
+                                    <condition>
+                                        <if-empty field-name="invoiceApplications"/>
+                                    </condition>
+                                    <widgets>
+                                        <container><label style="head3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
+                                    </widgets>
+                                </section>
                             </fail-widgets>
                         </section>
                     </decorator-section>

Modified: trunk/applications/accounting/widget/Menus.xml
===================================================================
--- trunk/applications/accounting/widget/Menus.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/widget/Menus.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -85,6 +85,7 @@
                         <if-compare field-name="invoice.statusId" operator="equals" value="INVOICE_IN_PROCESS"/>
                         <if-compare field-name="invoice.statusId" operator="equals" value="INVOICE_SENT"/>
                         <if-compare field-name="invoice.statusId" operator="equals" value="INVOICE_RECEIVED"/>
+                        <if-compare field-name="invoice.statusId" operator="equals" value="INVOICE_APPROVED"/>
                     </or>                
                 </and>
             </condition>

Modified: trunk/applications/accounting/widget/PaymentScreens.xml
===================================================================
--- trunk/applications/accounting/widget/PaymentScreens.xml	2006-04-26 00:43:16 UTC (rev 7416)
+++ trunk/applications/accounting/widget/PaymentScreens.xml	2006-04-26 07:34:19 UTC (rev 7417)
@@ -130,11 +130,13 @@
                                 <if-empty field-name="paymentApplications"/>
                             </condition>
                             <widgets>
-                                <label style="head1" text="${uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}, ${uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal}:${payment.amount?currency(${payment.currencyUomId})} ${uiLabelMap.AccountingAmountNotApplied}: ${notAppliedAmount?currency(${payment.currencyUomId})}"/>
+                                <label style="head1" text="${uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"/>
+                                <container><label style="head1" text="${uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal}:${payment.amount?currency(${payment.currencyUomId})} ${uiLabelMap.AccountingAmountNotApplied}: ${notAppliedAmount?currency(${payment.currencyUomId})}"/></container>
                                 <container><label style="head3" text="${uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></container>
                             </widgets>
                             <fail-widgets>
-                                <label style="head1" text="${uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}, ${uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal}:${payment.amount?currency(${payment.currencyUomId})} ${uiLabelMap.AccountingAmountNotApplied}: ${notAppliedAmount?currency(${payment.currencyUomId})}"/>
+                                <label style="head1" text="${uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"/>
+                                <container><label style="head1" text="${uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal}:${payment.amount?currency(${payment.currencyUomId})} ${uiLabelMap.AccountingAmountNotApplied}: ${notAppliedAmount?currency(${payment.currencyUomId})}"/></container>
                                 <section>
                                     <condition>
                                         <not><if-empty field-name="paymentApplicationsInv"/></not>



More information about the Svn mailing list