IDEMPIERE-5231 Create Payments from Bank Statement is not taking into account Discounts (#1248)
* IDEMPIERE-5231 Create Payments from Bank Statement is not taking into account Discounts #resolve * - Remove misleading closing message
This commit is contained in:
parent
a3e75538d2
commit
24836a7c6c
|
@ -220,7 +220,10 @@ public class BankStatementPayment extends SvrProcess
|
|||
payment.setPayAmt(PayAmt);
|
||||
else // payment is likely to be negative
|
||||
payment.setPayAmt(PayAmt.negate());
|
||||
payment.setOverUnderAmt(invoice.getOpenAmt().subtract(payment.getPayAmt()));
|
||||
BigDecimal discountAmt = invoice.getDiscountAmt(payment.getDateTrx());
|
||||
payment.setDiscountAmt(discountAmt);
|
||||
BigDecimal overUnderAmt = invoice.getOpenAmt().subtract(payment.getPayAmt()).subtract(discountAmt);
|
||||
payment.setOverUnderAmt(overUnderAmt);
|
||||
}
|
||||
else // set Pay Amout from Invoice
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ public class MInvoice extends X_C_Invoice implements DocAction, IDocsPostProcess
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -261338363319970683L;
|
||||
private static final long serialVersionUID = -303676612533389278L;
|
||||
|
||||
/**
|
||||
* Get Payments Of BPartner
|
||||
|
@ -1404,6 +1404,18 @@ public class MInvoice extends X_C_Invoice implements DocAction, IDocsPostProcess
|
|||
return retValue;
|
||||
} // getOpenAmt
|
||||
|
||||
/*
|
||||
* Get discount amt depending on payment date
|
||||
* @return discount Amt
|
||||
*/
|
||||
public BigDecimal getDiscountAmt(Timestamp paymentDate)
|
||||
{
|
||||
BigDecimal retValue = DB.getSQLValueBDEx(get_TrxName(),
|
||||
"SELECT invoiceDiscount(?,?,?) FROM DUAL",
|
||||
getC_Invoice_ID(), paymentDate, 0);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Document Status
|
||||
* @return Document Status Clear Text
|
||||
|
|
Loading…
Reference in New Issue