From 22bb2ab99941f23348c79bf8d06a0f3bbba5b4cf Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 30 Dec 2013 17:47:52 +0800 Subject: [PATCH] 1003599 Payment Allocation: Allow user to enter applied amount that's more than the payment's open amount. Fixed applied amount calculation for payment with negative balance. --- org.adempiere.ui/src/org/compiere/apps/form/Allocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java index 7ef931b896..85473e3905 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java @@ -408,7 +408,7 @@ public class Allocation // selection of payment row if (((Boolean)payment.getValueAt(row, 0)).booleanValue()) { - applied = open; // Open Amount + applied = open.signum() > 0 ? open : BigDecimal.ZERO; // Open Amount if (totalDiff.abs().compareTo(applied.abs()) < 0 // where less is available to allocate than open && totalDiff.signum() == -applied.signum() ) // and the available amount has the opposite sign applied = totalDiff.negate(); // reduce the amount applied to what's available @@ -421,7 +421,7 @@ public class Allocation if (col == i_payment) { - if ( applied.signum() == -open.signum() ) + if ( open.signum() > 0 && applied.signum() == -open.signum() ) applied = applied.negate(); if (! MSysConfig.getBooleanValue("ALLOW_OVER_APPLIED_PAYMENT", false, Env.getAD_Client_ID(Env.getCtx()))) if ( open.abs().compareTo( applied.abs() ) < 0 )