From ce4d1b2ca39c2ad17b0c560a9dcf92dcd565a673 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 25 Mar 2011 21:56:31 -0500 Subject: [PATCH] BF [1933948] - CalloutPayment working just with Draft Status https://sourceforge.net/tracker/index.php?func=detail&aid=1933948&group_id=176962&atid=879332 --- .../org/compiere/model/CalloutPayment.java | 95 +++++++++---------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java index e0275d10fd..d731415b3c 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java @@ -35,6 +35,8 @@ import org.compiere.util.Env; *
  • BF [ 1803316 ] CalloutPayment: use C_Order.Bill_BPartner_ID * @author j2garcia - GlobalQSS *
  • BF [ 2021745 ] Cannot assign project to payment with charge + * @author Carlos Ruiz - GlobalQSS + *
  • BF [ 1933948 ] CalloutPayment working just with Draft Status */ public class CalloutPayment extends CalloutEngine { @@ -429,59 +431,54 @@ public class CalloutPayment extends CalloutEngine mTab.setValue ("WriteOffAmt", Env.ZERO); if (Env.ZERO.compareTo (OverUnderAmt) != 0) mTab.setValue ("OverUnderAmt", Env.ZERO); - } - // PayAmt - calculate write off - // Added Lines By Goodwill (02-03-2006) - // Reason: we must make the callout is called just when docstatus is - // draft - // Old Code : else if (colName.equals("PayAmt")) - // New Code : - else if (colName.equals ("PayAmt") - && mTab.get_ValueAsString ("DocStatus").equals ("DR") - && "Y" - .equals (Env.getContext (ctx, WindowNo, "IsOverUnderPayment"))) - { - OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( - DiscountAmt).subtract (WriteOffAmt); - mTab.setValue ("OverUnderAmt", OverUnderAmt); - } - else if (colName.equals ("PayAmt") - && mTab.get_ValueAsString ("DocStatus").equals ("DR")) - { - WriteOffAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( - DiscountAmt).subtract (OverUnderAmt); - mTab.setValue ("WriteOffAmt", WriteOffAmt); - } - else if (colName.equals ("IsOverUnderPayment") - && mTab.get_ValueAsString ("DocStatus").equals ("DR")) - { - boolean overUnderPaymentActive = "Y".equals (Env.getContext (ctx, - WindowNo, "IsOverUnderPayment")); - if (overUnderPaymentActive) + } else { + boolean processed = mTab.getValueAsBoolean(MPayment.COLUMNNAME_Processed); + if (colName.equals ("PayAmt") + && (!processed) + && "Y".equals (Env.getContext (ctx, WindowNo, "IsOverUnderPayment"))) { OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( - DiscountAmt); - mTab.setValue ("WriteOffAmt", Env.ZERO); + DiscountAmt).subtract (WriteOffAmt); mTab.setValue ("OverUnderAmt", OverUnderAmt); - }else{ - WriteOffAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( - DiscountAmt); - mTab.setValue ("WriteOffAmt", WriteOffAmt); - mTab.setValue ("OverUnderAmt", Env.ZERO); } - } - // Added Lines By Goodwill (02-03-2006) - // Reason: we must make the callout is called just when docstatus is - // draft - // Old Code : else // calculate PayAmt - // New Code : - else if (mTab.get_ValueAsString ("DocStatus").equals ("DR")) // calculate - // PayAmt - // End By Goodwill - { - PayAmt = InvoiceOpenAmt.subtract (DiscountAmt).subtract ( - WriteOffAmt).subtract (OverUnderAmt); - mTab.setValue ("PayAmt", PayAmt); + else if (colName.equals ("PayAmt") + && (!processed)) + { + WriteOffAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( + DiscountAmt).subtract (OverUnderAmt); + mTab.setValue ("WriteOffAmt", WriteOffAmt); + } + else if (colName.equals ("IsOverUnderPayment") + && (!processed)) + { + boolean overUnderPaymentActive = "Y".equals (Env.getContext (ctx, + WindowNo, "IsOverUnderPayment")); + if (overUnderPaymentActive) + { + OverUnderAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( + DiscountAmt); + mTab.setValue ("WriteOffAmt", Env.ZERO); + mTab.setValue ("OverUnderAmt", OverUnderAmt); + }else{ + WriteOffAmt = InvoiceOpenAmt.subtract (PayAmt).subtract ( + DiscountAmt); + mTab.setValue ("WriteOffAmt", WriteOffAmt); + mTab.setValue ("OverUnderAmt", Env.ZERO); + } + } + // Added Lines By Goodwill (02-03-2006) + // Reason: we must make the callout is called just when docstatus is + // draft + // Old Code : else // calculate PayAmt + // New Code : + else if ((!processed)) // calculate + // PayAmt + // End By Goodwill + { + PayAmt = InvoiceOpenAmt.subtract (DiscountAmt).subtract ( + WriteOffAmt).subtract (OverUnderAmt); + mTab.setValue ("PayAmt", PayAmt); + } } return ""; } // amounts