svn commit: r486051 - /incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r486051 - /incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java

jacopoc
Author: jacopoc
Date: Mon Dec 11 23:27:42 2006
New Revision: 486051

URL: http://svn.apache.org/viewvc?view=rev&rev=486051
Log:
Fixed bug where payment applications associated to a billing account and to a return invoice were considered in the billing account balance as outbound payment.
Part of OFBIZ-93

Modified:
    incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java

Modified: incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?view=diff&rev=486051&r1=486050&r2=486051
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java (original)
+++ incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java Mon Dec 11 23:27:42 2006
@@ -206,9 +206,10 @@
             for (Iterator pAi = paymentAppls.iterator(); pAi.hasNext(); ) {
                 GenericValue paymentAppl = (GenericValue) pAi.next();
                 BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied");
-                if (paymentAppl.getString("invoiceId") != null) {
-                    // make sure the invoice has not been canceled
-                    if (!"INVOICE_CANCELED".equals(paymentAppl.getRelatedOne("Invoice").getString("statusId"))) {
+                GenericValue invoice = paymentAppl.getRelatedOne("Invoice");
+                if (invoice != null) {
+                    // make sure the invoice has not been canceled and it is not a "Customer return invoice"
+                    if (!"CUST_RTN_INVOICE".equals(invoice.getString("invoiceTypeId")) && !"INVOICE_CANCELED".equals(invoice.getString("statusId"))) {
                         balance = balance.add(amountApplied);    
                     }
                 } else {