IDEMPIERE-3960 Partial payments or installment payment not working in payment selection (#138)

This commit is contained in:
Carlos Ruiz 2020-07-14 16:09:02 +02:00 committed by GitHub
parent 2d70a1a169
commit 9da97ab06d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -243,13 +243,13 @@ public class PaySelect
+ " INNER JOIN C_PaymentTerm p ON (i.C_PaymentTerm_ID=p.C_PaymentTerm_ID)",
// WHERE
"i.IsSOTrx=? AND IsPaid='N'"
+ " AND invoiceOpen(i.C_Invoice_ID, i.C_InvoicePaySchedule_ID) != 0" //Check that AmountDue <> 0
+ " AND invoiceOpenToDate(i.C_Invoice_ID, i.C_InvoicePaySchedule_ID, SysDate) != 0" //Check that AmountDue <> 0
// Different Payment Selection
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
+ " AND (i.C_InvoicePaySchedule_ID > 0 OR NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
+ " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)"
+ " LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)"
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'"
+ " AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )"
+ " AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) ))"
+ " AND i.DocStatus IN ('CO','CL')"
+ " AND i.AD_Client_ID=?", // additional where & order in loadTableInfo()
true, "i");