IDEMPIERE-3865 Payment term discount on payment doesnt consider the payment amount

This commit is contained in:
Carlos Ruiz 2019-01-19 12:35:05 +01:00
parent 70b5e48440
commit 175166bc12
1 changed files with 7 additions and 3 deletions

View File

@ -433,7 +433,7 @@ public class CalloutPayment extends CalloutEngine
currency.getStdPrecision (), RoundingMode.HALF_UP);
mTab.setValue ("OverUnderAmt", OverUnderAmt);
}
// No Invoice - Set Discount, Witeoff, Under/Over to 0
// No Invoice - Set Discount, Writeoff, Under/Over to 0
else if (C_Invoice_ID == 0)
{
if (Env.ZERO.compareTo (DiscountAmt) != 0)
@ -448,8 +448,12 @@ public class CalloutPayment extends CalloutEngine
&& (!processed)
&& "Y".equals (Env.getContext (ctx, WindowNo, "IsOverUnderPayment")))
{
OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract (
DiscountAmt).subtract (WriteOffAmt);
OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract(DiscountAmt).subtract (WriteOffAmt);
if (OverUnderAmt.signum() > 0) { // no discount because is not paid in full
DiscountAmt = Env.ZERO;
mTab.setValue ("DiscountAmt", DiscountAmt);
OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract(DiscountAmt).subtract (WriteOffAmt);
}
mTab.setValue ("OverUnderAmt", OverUnderAmt);
}
else if (colName.equals ("PayAmt")