From 5d55c6e6ef743e926766d00eb2de9f306a8ebc12 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 17 Feb 2019 10:06:53 +0100 Subject: [PATCH] IDEMPIERE-3869 discount / write off tax corrections in allocation post require inverted Debit/Credit logic in certain scenarios; tax rate added to Fact_Acct tax correction postings --- .../src/org/compiere/acct/Doc_AllocationHdr.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java index f159087158..dfc0a20f73 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java @@ -1047,12 +1047,14 @@ class Doc_AllocationTax for (int i = 0; i < m_facts.size(); i++) { MFactAcct factAcct = (MFactAcct)m_facts.get(i); - if (factAcct.getAmtSourceDr().compareTo(total) > 0) + if ( (factAcct.getAmtSourceDr().signum() > 0 && factAcct.getAmtSourceDr().compareTo(total) > 0) + || (factAcct.getAmtSourceDr().signum() < 0 && factAcct.getAmtSourceDr().compareTo(total) < 0)) { total = factAcct.getAmtSourceDr(); m_totalIndex = i; } - if (factAcct.getAmtSourceCr().compareTo(total) > 0) + if ( (factAcct.getAmtSourceCr().signum() > 0 && factAcct.getAmtSourceCr().compareTo(total) > 0) + || (factAcct.getAmtSourceCr().signum() < 0 && factAcct.getAmtSourceCr().compareTo(total) < 0)) { total = factAcct.getAmtSourceCr(); m_totalIndex = i;