IDEMPIERE-2305 Cash Payment button is ignoring amount entered

This commit is contained in:
Carlos Ruiz 2014-11-05 17:31:44 -05:00
parent fad1554e3f
commit e151947731
2 changed files with 3 additions and 19 deletions

View File

@ -67,17 +67,7 @@ public class WPaymentFormCash extends PaymentFormCash implements EventListener<E
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();
//Bojana&Daniel bAmountField.setValue(m_Amount);
//If Invoice is Vendor invoice then Cash has to be created by negative amount
int C_Invoice_ID = Env.getContextAsInt(Env.getCtx(), getWindowNo(), "C_Invoice_ID");
MInvoice invoice_tmp = new MInvoice (Env.getCtx(), C_Invoice_ID, null);
if (! invoice_tmp.isSOTrx())
{
bAmountField.setValue(m_Amount.negate());
}else {
bAmountField.setValue(m_Amount);
}
invoice_tmp = null;
} }
public void init() { public void init() {

View File

@ -250,24 +250,19 @@ public abstract class PaymentFormCash extends PaymentForm {
C_Invoice_ID = getInvoiceID (C_Order_ID); C_Invoice_ID = getInvoiceID (C_Order_ID);
// Amount sign negative, if ARC (Credit Memo) or API (AP Invoice) // Amount sign negative, if ARC (Credit Memo) or API (AP Invoice)
boolean negateAmt = false;
MInvoice invoice = null; MInvoice invoice = null;
if (C_Invoice_ID != 0) if (C_Invoice_ID != 0)
{ {
invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null); invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null);
negateAmt = invoice.isCreditMemo();
} }
MOrder order = null; MOrder order = null;
if (invoice == null && C_Order_ID != 0) if (invoice == null && C_Order_ID != 0)
order = new MOrder (Env.getCtx(), C_Order_ID, null); order = new MOrder (Env.getCtx(), C_Order_ID, null);
BigDecimal payAmount = m_Amount; BigDecimal payAmount = newAmount;
if (negateAmt)
payAmount = m_Amount.negate();
// Info // Info
if (log.isLoggable(Level.CONFIG)) log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt); if (log.isLoggable(Level.CONFIG)) log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID);
/*********************** /***********************
* CashBook * CashBook
@ -284,7 +279,6 @@ public abstract class PaymentFormCash extends PaymentForm {
} }
else else
{ {
payAmount = newAmount;
// Changed Amount // Changed Amount
if (m_cashLine != null if (m_cashLine != null
&& payAmount.compareTo(m_cashLine.getAmount()) != 0) && payAmount.compareTo(m_cashLine.getAmount()) != 0)