details:   https://code.openbravo.com/erp/devel/pi/rev/8fe325ebf590
changeset: 34227:8fe325ebf590
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Fri Jun 22 01:59:44 2018 +0530
summary:   Fixes Issue 0038769: "Suspense balancing" account used when
invoice's total is zero and negative prepayment exists

Difference amount in between gross amount and prepayment amount
should have proper sign. In case of negative prepayment & 0 gross
amount, it was wrongly set negative value instead of positive value.

diffstat:

 src/org/openbravo/erpCommon/ad_forms/DocInvoice.java |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 9a1c5f99b2d1 -r 8fe325ebf590 
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java      Fri Jun 22 
01:56:11 2018 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java      Fri Jun 22 
01:59:44 2018 +0530
@@ -377,7 +377,7 @@
           && (m_debt_payments == null || m_debt_payments.length == 0)) {
         BigDecimal grossamt = new BigDecimal(Amounts[AMTTYPE_Gross]);
         BigDecimal prepayment = new BigDecimal(prepaymentamt);
-        BigDecimal difference = grossamt.abs().subtract(prepayment.abs());
+        BigDecimal difference = grossamt.subtract(prepayment);
         if (!prepaymentamt.equals("0")) {
           if (grossamt.abs().compareTo(prepayment.abs()) != 0) {
             if (IsReturn.equals("Y") || isReversedInvoice) {
@@ -746,7 +746,7 @@
           && (m_debt_payments == null || m_debt_payments.length == 0)) {
         BigDecimal grossamt = new BigDecimal(Amounts[AMTTYPE_Gross]);
         BigDecimal prepayment = new BigDecimal(prepaymentamt);
-        BigDecimal difference = grossamt.abs().subtract(prepayment.abs());
+        BigDecimal difference = grossamt.subtract(prepayment);
         if (!prepaymentamt.equals("0")) {
           if (grossamt.abs().compareTo(prepayment.abs()) != 0) {
             if (IsReturn.equals("Y") || isReversedInvoice) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to