This commit is contained in:
Carlos Ruiz 2013-12-30 21:36:56 -05:00
commit 77275d5a50
1 changed files with 2 additions and 2 deletions

View File

@ -408,7 +408,7 @@ public class Allocation
// selection of payment row // selection of payment row
if (((Boolean)payment.getValueAt(row, 0)).booleanValue()) 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 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 && totalDiff.signum() == -applied.signum() ) // and the available amount has the opposite sign
applied = totalDiff.negate(); // reduce the amount applied to what's available applied = totalDiff.negate(); // reduce the amount applied to what's available
@ -421,7 +421,7 @@ public class Allocation
if (col == i_payment) if (col == i_payment)
{ {
if ( applied.signum() == -open.signum() ) if ( open.signum() > 0 && applied.signum() == -open.signum() )
applied = applied.negate(); applied = applied.negate();
if (! MSysConfig.getBooleanValue("ALLOW_OVER_APPLIED_PAYMENT", false, Env.getAD_Client_ID(Env.getCtx()))) if (! MSysConfig.getBooleanValue("ALLOW_OVER_APPLIED_PAYMENT", false, Env.getAD_Client_ID(Env.getCtx())))
if ( open.abs().compareTo( applied.abs() ) < 0 ) if ( open.abs().compareTo( applied.abs() ) < 0 )