Fix [1701671] - Reversing payment on vend invoice should flag invoice unpaid

Thanks to A. Habib (der_ali) for suggesting the solution
This commit is contained in:
Carlos Ruiz 2009-04-29 03:15:43 +00:00
parent e8e3f341e5
commit cb6002e656
1 changed files with 6 additions and 1 deletions

View File

@ -390,7 +390,12 @@ public class VPaySelect extends CPanel
"i.IsSOTrx=? AND IsPaid='N'"
// Different Payment Selection
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.C_PaySelectionCheck_ID IS NOT NULL)"
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.C_PaySelectionCheck_ID IS NOT NULL"
+ " AND psl.C_PaySelectionCheck_ID NOT IN "
+ " (SELECT psc.C_PaySelectionCheck_ID FROM C_PaySelectionCheck psc, C_Payment p"
+ " WHERE psc.C_PaySelectionCheck_ID = psl.C_PaySelectionCheck_ID"
+ " AND psc.C_Payment_ID = p.C_Payment_ID"
+ " AND p.DocStatus IN ('RE','VO')))"
+ " AND i.DocStatus IN ('CO','CL')"
+ " AND i.AD_Client_ID=?", // additional where & order in loadTableInfo()
true, "i");