From cd583057616758df8678410c31784f5d01141935 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 18 Dec 2013 16:36:04 +0800 Subject: [PATCH] 1003628 Incorrect Landed Cost Allocation calculation. Fixed rounding issue. --- .../src/org/compiere/model/MInvoiceLine.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index 93dff64ddf..9809c9e095 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -1089,9 +1089,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - BigDecimal result = getLineNetAmt().multiply(base); - result = result.divide(total, BigDecimal.ROUND_HALF_UP); - lca.setAmt(result.doubleValue(), getPrecision()); + double result = getLineNetAmt().multiply(base).doubleValue(); + result /= total.doubleValue(); + lca.setAmt(result, getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1212,9 +1212,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - BigDecimal result = getLineNetAmt().multiply(base); - result = result.divide(total, BigDecimal.ROUND_HALF_UP); - lca.setAmt(result.doubleValue(), getPrecision()); + double result = getLineNetAmt().multiply(base).doubleValue(); + result /= total.doubleValue(); + lca.setAmt(result, getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);