From 28f6dd1fa8f7af8907e17ef25cde116c9bbf2e1c Mon Sep 17 00:00:00 2001 From: phib Date: Wed, 7 Oct 2009 02:08:32 +0000 Subject: [PATCH] 1701671 Reversing payment on vend invoice should flag invoice unpaid https://sourceforge.net/tracker/index.php?func=detail&aid=1701671&group_id=176962&atid=879332 --- .../org/compiere/process/PaySelectionCreateFrom.java | 10 ++++++---- client/src/org/compiere/apps/form/PaySelect.java | 10 ++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/base/src/org/compiere/process/PaySelectionCreateFrom.java b/base/src/org/compiere/process/PaySelectionCreateFrom.java index 7a1a5b1a62..239d2221cc 100644 --- a/base/src/org/compiere/process/PaySelectionCreateFrom.java +++ b/base/src/org/compiere/process/PaySelectionCreateFrom.java @@ -115,10 +115,12 @@ public class PaySelectionCreateFrom extends SvrProcess + "FROM C_Invoice i " + "WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')" + " AND AD_Client_ID=?" // ##6 - // Existing Payments - Will reselect Invoice if prepared but not paid - + " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl " - + "WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'" - + " AND psl.C_PaySelectionCheck_ID IS NOT NULL)"; + // Existing Payments - Will reselect Invoice if prepared but not paid + + " AND 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')) )"; // Disputed if (!p_IncludeInDispute) sql += " AND i.IsInDispute='N'"; diff --git a/client/src/org/compiere/apps/form/PaySelect.java b/client/src/org/compiere/apps/form/PaySelect.java index ee07a7f0c5..5fa783ebdb 100644 --- a/client/src/org/compiere/apps/form/PaySelect.java +++ b/client/src/org/compiere/apps/form/PaySelect.java @@ -227,12 +227,10 @@ public class PaySelect "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" - + " 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')))" + + " 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 i.DocStatus IN ('CO','CL')" + " AND i.AD_Client_ID=?", // additional where & order in loadTableInfo() true, "i");