From 1878089641edc53826ea0b564f6415d8343edc12 Mon Sep 17 00:00:00 2001 From: armenrz Date: Sun, 21 Sep 2008 09:13:01 +0000 Subject: [PATCH] BF #2041226 BP Open Balance should count only Completed Invoice --- base/src/org/compiere/model/MBPartner.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base/src/org/compiere/model/MBPartner.java b/base/src/org/compiere/model/MBPartner.java index 9e2e5b4fdf..d0a23c2da7 100644 --- a/base/src/org/compiere/model/MBPartner.java +++ b/base/src/org/compiere/model/MBPartner.java @@ -739,7 +739,7 @@ public class MBPartner extends X_C_BPartner { BigDecimal SO_CreditUsed = null; BigDecimal TotalOpenBalance = null; - //AZ Goodwill -> BF: only count completed/closed docs. + //AZ Goodwill -> BF2041226 : only count completed/closed docs. String sql = "SELECT " // SO Credit Used + "COALESCE((SELECT SUM(currencyBase(invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID),i.C_Currency_ID,i.DateInvoiced, i.AD_Client_ID,i.AD_Org_ID)) FROM C_Invoice_v i " @@ -796,9 +796,10 @@ public class MBPartner extends X_C_BPartner public void setActualLifeTimeValue() { BigDecimal ActualLifeTimeValue = null; + //AZ Goodwill -> BF2041226 : only count completed/closed docs. String sql = "SELECT " + "COALESCE ((SELECT SUM(currencyBase(i.GrandTotal,i.C_Currency_ID,i.DateInvoiced, i.AD_Client_ID,i.AD_Org_ID)) FROM C_Invoice_v i " - + "WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND i.IsSOTrx='Y'),0) " + + "WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND i.IsSOTrx='Y' AND i.DocStatus IN ('CO','CL')),0) " + "FROM C_BPartner bp " + "WHERE C_BPartner_ID=?"; PreparedStatement pstmt = null;