diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index ff97b34e6d..0f6c48b1a8 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -638,7 +638,7 @@ public class CalloutInvoice extends CalloutEngine // Repeat Discount calc if (PriceList.intValue() != 0) { - Discount = new BigDecimal ((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); + Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); if (Discount.scale () > 2) Discount = Discount.setScale (2, BigDecimal.ROUND_HALF_UP); // mTab.setValue ("Discount", Discount); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 39f7c9a029..241b8c4858 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -1111,7 +1111,7 @@ public class CalloutOrder extends CalloutEngine if (mField.getColumnName().equals("Discount")) { if ( PriceList.doubleValue() != 0 ) - PriceActual = new BigDecimal ((100.0 - Discount.doubleValue()) / 100.0 * PriceList.doubleValue()); + PriceActual = BigDecimal.valueOf((100.0 - Discount.doubleValue()) / 100.0 * PriceList.doubleValue()); if (PriceActual.scale() > StdPrecision) PriceActual = PriceActual.setScale(StdPrecision, BigDecimal.ROUND_HALF_UP); PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, @@ -1127,7 +1127,7 @@ public class CalloutOrder extends CalloutEngine if (PriceList.intValue() == 0) Discount = Env.ZERO; else - Discount = new BigDecimal ((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0); + Discount = BigDecimal.valueOf((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0); if (Discount.scale() > 2) Discount = Discount.setScale(2, BigDecimal.ROUND_HALF_UP); mTab.setValue("Discount", Discount); @@ -1155,7 +1155,7 @@ public class CalloutOrder extends CalloutEngine // Repeat Discount calc if (PriceList.intValue() != 0) { - Discount = new BigDecimal ((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); + Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); if (Discount.scale () > 2) Discount = Discount.setScale (2, BigDecimal.ROUND_HALF_UP); mTab.setValue ("Discount", Discount); diff --git a/org.adempiere.base/src/org/adempiere/process/SalesOrderRateInquiryProcess.java b/org.adempiere.base/src/org/adempiere/process/SalesOrderRateInquiryProcess.java index 96a976f252..e732b3964e 100644 --- a/org.adempiere.base/src/org/adempiere/process/SalesOrderRateInquiryProcess.java +++ b/org.adempiere.base/src/org/adempiere/process/SalesOrderRateInquiryProcess.java @@ -222,12 +222,12 @@ public class SalesOrderRateInquiryProcess extends SvrProcess } MShipperPackaging sp = new MShipperPackaging(ctx, M_ShipperPackaging_ID, trxName); - BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? new BigDecimal(2.20462) : BigDecimal.ONE); + BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE); if (WeightPerPackage == null || WeightPerPackage.compareTo(BigDecimal.ZERO) == 0) { - BigDecimal defaultWeightPerPackage = new BigDecimal(MSysConfig.getDoubleValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, 30)); - WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? new BigDecimal(2.20462) : BigDecimal.ONE); + BigDecimal defaultWeightPerPackage = BigDecimal.valueOf(MSysConfig.getDoubleValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, 30)); + WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE); } BigDecimal CODAmount = m_order.getGrandTotal(); diff --git a/org.adempiere.base/src/org/compiere/Base.java b/org.adempiere.base/src/org/compiere/Base.java index e0c8f41798..0b85858b11 100644 --- a/org.adempiere.base/src/org/compiere/Base.java +++ b/org.adempiere.base/src/org/compiere/Base.java @@ -97,9 +97,9 @@ class Base listThreads(); // System.out.println("API Test"); - System.out.println("64.72=" + MConversionRate.convert(ctx, new BigDecimal(100.0), 116, 100,0,0)); + System.out.println("64.72=" + MConversionRate.convert(ctx, BigDecimal.valueOf(100.0), 116, 100,0,0)); System.out.println("0.647169=" + MConversionRate.getRate(116, 100, null, 0,0,0)); - System.out.println("12.5=" + MUOMConversion.convert(101, 102, new BigDecimal(100.0), true)); + System.out.println("12.5=" + MUOMConversion.convert(101, 102, BigDecimal.valueOf(100.0), true)); } // Base diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java index f475d95b8d..278921afa8 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java @@ -594,7 +594,7 @@ public class Doc_AllocationHdr extends Doc Doc_Invoice docInvoice = (Doc_Invoice)Doc.get(as, MInvoice.Table_ID, invoice.getC_Invoice_ID(), getTrxName()); docInvoice.loadDocumentDetails(); - allocationAccounted = docInvoice.createFactCash(as, fact, new BigDecimal(percent)); + allocationAccounted = docInvoice.createFactCash(as, fact, BigDecimal.valueOf(percent)); if (log.isLoggable(Level.CONFIG)) log.config("Allocation Accounted=" + allocationAccounted); // Cash Based Commitment Release @@ -604,7 +604,7 @@ public class Doc_AllocationHdr extends Doc for (int i = 0; i < lines.length; i++) { Fact factC = Doc_Order.getCommitmentRelease(as, this, - lines[i].getQtyInvoiced(), lines[i].getC_InvoiceLine_ID(), new BigDecimal(percent)); + lines[i].getQtyInvoiced(), lines[i].getC_InvoiceLine_ID(), BigDecimal.valueOf(percent)); if (factC == null) return null; m_facts.add(factC); @@ -780,7 +780,7 @@ public class Doc_AllocationHdr extends Doc // percent of total payment double multiplier = allocationSource.doubleValue() / invoiceSource.doubleValue(); // Reduce Orig Invoice Accounted - invoiceAccounted = invoiceAccounted.multiply(new BigDecimal(multiplier)); + invoiceAccounted = invoiceAccounted.multiply(BigDecimal.valueOf(multiplier)); // Difference based on percentage of Orig Invoice acctDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative // ignore Tolerance diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Requisition.java b/org.adempiere.base/src/org/compiere/acct/Doc_Requisition.java index 1337f51995..51bfe3d185 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Requisition.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Requisition.java @@ -105,7 +105,7 @@ public class Doc_Requisition extends Doc */ public BigDecimal getBalance () { - BigDecimal retValue = new BigDecimal (0.0); + BigDecimal retValue = BigDecimal.valueOf(0.0); return retValue; } // getBalance diff --git a/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java b/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java index 9317e2870f..eabbed49b6 100644 --- a/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java +++ b/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java @@ -486,7 +486,7 @@ public final class ImpFormatRow return "0"; BigDecimal bd = new BigDecimal(sb.toString()); if (m_divideBy100) // assumed two decimal scale - bd = bd.divide(new BigDecimal(100.0), 2, BigDecimal.ROUND_HALF_UP); + bd = bd.divide(BigDecimal.valueOf(100.0), 2, BigDecimal.ROUND_HALF_UP); return bd.toString(); } // parseNumber diff --git a/org.adempiere.base/src/org/compiere/model/CalloutEngine.java b/org.adempiere.base/src/org/compiere/model/CalloutEngine.java index 4feb07b283..766b26127a 100644 --- a/org.adempiere.base/src/org/compiere/model/CalloutEngine.java +++ b/org.adempiere.base/src/org/compiere/model/CalloutEngine.java @@ -250,7 +250,7 @@ public class CalloutEngine implements Callout BigDecimal rate1 = (BigDecimal)value; BigDecimal rate2 = Env.ZERO; - BigDecimal one = new BigDecimal(1.0); + BigDecimal one = BigDecimal.valueOf(1.0); if (rate1.doubleValue() != 0.0) // no divide by zero rate2 = one.divide(rate1, 12, BigDecimal.ROUND_HALF_UP); diff --git a/org.adempiere.base/src/org/compiere/model/MConversionRate.java b/org.adempiere.base/src/org/compiere/model/MConversionRate.java index 6b4d0d1120..fda74dc6b9 100644 --- a/org.adempiere.base/src/org/compiere/model/MConversionRate.java +++ b/org.adempiere.base/src/org/compiere/model/MConversionRate.java @@ -334,7 +334,7 @@ public class MConversionRate extends X_C_Conversion_Rate { super.setMultiplyRate(MultiplyRate); double dd = 1 / MultiplyRate.doubleValue(); - super.setDivideRate(new BigDecimal(dd)); + super.setDivideRate(BigDecimal.valueOf(dd)); } } // setMultiplyRate @@ -356,7 +356,7 @@ public class MConversionRate extends X_C_Conversion_Rate { super.setDivideRate(DivideRate); double dd = 1 / DivideRate.doubleValue(); - super.setMultiplyRate(new BigDecimal(dd)); + super.setMultiplyRate(BigDecimal.valueOf(dd)); } } // setDivideRate diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index 72ff4c727b..86c4ac84a4 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -1482,7 +1482,7 @@ public class MCost extends X_M_Cost //amount must follow the sign of qty if (amt.signum() != 0 && amt.signum() != qty.signum()) { - amt = amt.multiply(new BigDecimal(-1.00d)); + amt = amt.multiply(BigDecimal.valueOf(-1.00d)); } if (getCurrentQty().add(qty).signum() < 0) diff --git a/org.adempiere.base/src/org/compiere/model/MDepreciation.java b/org.adempiere.base/src/org/compiere/model/MDepreciation.java index 5e99ed0200..d471de738d 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepreciation.java +++ b/org.adempiere.base/src/org/compiere/model/MDepreciation.java @@ -337,7 +337,7 @@ public class MDepreciation extends X_A_Depreciation BigDecimal coef_sl = BigDecimal.ONE.divide(new BigDecimal(A_Life_Year), getPrecision() + 2, RoundingMode.DOWN); /** Degressive damping coefficient for one year = one-year linear depreciation * coeficient K */ //BigDecimal coef_ad1 = coef_sl.multiply(coef_K); //commented by @win - BigDecimal coef_ad1 = coef_sl.multiply(new BigDecimal(2.0)); //added by @win + BigDecimal coef_ad1 = coef_sl.multiply(BigDecimal.valueOf(2.0)); //added by @win /** AD2 */ //~ BigDecimal DUR = BD_100.multiply( diff --git a/org.adempiere.base/src/org/compiere/model/MGoal.java b/org.adempiere.base/src/org/compiere/model/MGoal.java index 061a02bb4a..e12f40a120 100644 --- a/org.adempiere.base/src/org/compiere/model/MGoal.java +++ b/org.adempiere.base/src/org/compiere/model/MGoal.java @@ -195,57 +195,57 @@ public class MGoal extends X_PA_Goal if (MeasureScope.equals(MEASURESCOPE_Year)) { if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter)) - Multiplier = new BigDecimal(1.0/4.0); + Multiplier = BigDecimal.valueOf(1.0/4.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Month)) - Multiplier = new BigDecimal(1.0/12.0); + Multiplier = BigDecimal.valueOf(1.0/12.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Week)) - Multiplier = new BigDecimal(1.0/52.0); + Multiplier = BigDecimal.valueOf(1.0/52.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Day)) - Multiplier = new BigDecimal(1.0/364.0); + Multiplier = BigDecimal.valueOf(1.0/364.0); } else if (MeasureScope.equals(MEASURESCOPE_Quarter)) { if (MeasureDisplay.equals(MEASUREDISPLAY_Year)) - Multiplier = new BigDecimal(4.0); + Multiplier = BigDecimal.valueOf(4.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Month)) - Multiplier = new BigDecimal(1.0/3.0); + Multiplier = BigDecimal.valueOf(1.0/3.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Week)) - Multiplier = new BigDecimal(1.0/13.0); + Multiplier = BigDecimal.valueOf(1.0/13.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Day)) - Multiplier = new BigDecimal(1.0/91.0); + Multiplier = BigDecimal.valueOf(1.0/91.0); } else if (MeasureScope.equals(MEASURESCOPE_Month)) { if (MeasureDisplay.equals(MEASUREDISPLAY_Year)) - Multiplier = new BigDecimal(12.0); + Multiplier = BigDecimal.valueOf(12.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter)) - Multiplier = new BigDecimal(3.0); + Multiplier = BigDecimal.valueOf(3.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Week)) - Multiplier = new BigDecimal(1.0/4.0); + Multiplier = BigDecimal.valueOf(1.0/4.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Day)) - Multiplier = new BigDecimal(1.0/30.0); + Multiplier = BigDecimal.valueOf(1.0/30.0); } else if (MeasureScope.equals(MEASURESCOPE_Week)) { if (MeasureDisplay.equals(MEASUREDISPLAY_Year)) - Multiplier = new BigDecimal(52.0); + Multiplier = BigDecimal.valueOf(52.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter)) - Multiplier = new BigDecimal(13.0); + Multiplier = BigDecimal.valueOf(13.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Month)) - Multiplier = new BigDecimal(4.0); + Multiplier = BigDecimal.valueOf(4.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Day)) - Multiplier = new BigDecimal(1.0/7.0); + Multiplier = BigDecimal.valueOf(1.0/7.0); } else if (MeasureScope.equals(MEASURESCOPE_Day)) { if (MeasureDisplay.equals(MEASUREDISPLAY_Year)) - Multiplier = new BigDecimal(364.0); + Multiplier = BigDecimal.valueOf(364.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Quarter)) - Multiplier = new BigDecimal(91.0); + Multiplier = BigDecimal.valueOf(91.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Month)) - Multiplier = new BigDecimal(30.0); + Multiplier = BigDecimal.valueOf(30.0); else if (MeasureDisplay.equals(MEASUREDISPLAY_Week)) - Multiplier = new BigDecimal(7.0); + Multiplier = BigDecimal.valueOf(7.0); } return Multiplier; } // getMultiplier diff --git a/org.adempiere.base/src/org/compiere/model/MJournalLine.java b/org.adempiere.base/src/org/compiere/model/MJournalLine.java index 84b7ff4b11..10352f3f92 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalLine.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalLine.java @@ -210,9 +210,9 @@ public class MJournalLine extends X_GL_JournalLine } if (rateDR != 0) - setCurrencyRate(new BigDecimal(rateDR)); + setCurrencyRate(BigDecimal.valueOf(rateDR)); if (rateCR != 0) - setCurrencyRate(new BigDecimal(rateCR)); + setCurrencyRate(BigDecimal.valueOf(rateCR)); } // setAmtAcct diff --git a/org.adempiere.base/src/org/compiere/model/MLandedCostAllocation.java b/org.adempiere.base/src/org/compiere/model/MLandedCostAllocation.java index ff4495cfa2..c882bc9f0e 100644 --- a/org.adempiere.base/src/org/compiere/model/MLandedCostAllocation.java +++ b/org.adempiere.base/src/org/compiere/model/MLandedCostAllocation.java @@ -131,7 +131,7 @@ public class MLandedCostAllocation extends X_C_LandedCostAllocation */ public void setAmt (double Amt, int precision) { - BigDecimal bd = new BigDecimal(Amt); + BigDecimal bd = BigDecimal.valueOf(Amt); if (bd.scale() > precision) bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP); super.setAmt(bd); diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index 76e8345aeb..0f740c8fac 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -799,7 +799,7 @@ public class MProductPricing { BigDecimal Discount = Env.ZERO; if (m_PriceList.intValue() != 0) - Discount = new BigDecimal ((m_PriceList.doubleValue() - m_PriceStd.doubleValue()) + Discount = BigDecimal.valueOf((m_PriceList.doubleValue() - m_PriceStd.doubleValue()) / m_PriceList.doubleValue() * 100.0); if (Discount.scale() > 2) Discount = Discount.setScale(2, BigDecimal.ROUND_HALF_UP); diff --git a/org.adempiere.base/src/org/compiere/model/MResourceAssignment.java b/org.adempiere.base/src/org/compiere/model/MResourceAssignment.java index 799b3d7f9f..0212f2f519 100644 --- a/org.adempiere.base/src/org/compiere/model/MResourceAssignment.java +++ b/org.adempiere.base/src/org/compiere/model/MResourceAssignment.java @@ -48,7 +48,7 @@ public class MResourceAssignment extends X_S_ResourceAssignment if (S_ResourceAssignment_ID == 0) { setAssignDateFrom(new Timestamp(System.currentTimeMillis())); - setQty(new BigDecimal(1.0)); + setQty(BigDecimal.valueOf(1.0)); setName("."); setIsConfirmed(false); } diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 2b8042402f..1117783c2d 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -909,7 +909,7 @@ public abstract class PO long mili = ts.getTime(); int nano = ts.getNanos(); double doublets = Double.parseDouble(Long.toString(mili) + "." + Integer.toString(nano)); - BigDecimal bdtimestamp = new BigDecimal(doublets); + BigDecimal bdtimestamp = BigDecimal.valueOf(doublets); set_Value("ProcessedOn", bdtimestamp); } } diff --git a/org.adempiere.base/src/org/compiere/print/MPrintTableFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintTableFormat.java index dd3a0f345b..1e9f758c9a 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintTableFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintTableFormat.java @@ -238,7 +238,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat { BigDecimal retValue = super.getHdrStroke(); if (retValue == null || Env.ZERO.compareTo(retValue) <= 0) - retValue = new BigDecimal (2.0); + retValue = BigDecimal.valueOf(2.0); return retValue; } // getHdrStroke @@ -486,7 +486,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat { BigDecimal retValue = super.getLineStroke(); if (retValue == null || Env.ZERO.compareTo(retValue) <= 0) - retValue = new BigDecimal (1.0); + retValue = BigDecimal.valueOf(1.0); return retValue; } // getLineStroke @@ -498,7 +498,7 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat { BigDecimal retValue = super.getLineStroke(); if (retValue == null || Env.ZERO.compareTo(retValue) <= 0) - retValue = new BigDecimal (1.0); + retValue = BigDecimal.valueOf(1.0); return retValue; } // getVLineStroke diff --git a/org.adempiere.base/src/org/compiere/print/PrintDataElement.java b/org.adempiere.base/src/org/compiere/print/PrintDataElement.java index 3b2d4a202e..62b0a081af 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintDataElement.java +++ b/org.adempiere.base/src/org/compiere/print/PrintDataElement.java @@ -126,7 +126,7 @@ public class PrintDataElement implements Serializable if (m_value instanceof BigDecimal) return (BigDecimal)m_value; if (m_value instanceof Number) - return new BigDecimal(((Number)m_value).doubleValue()); + return BigDecimal.valueOf(((Number)m_value).doubleValue()); // Boolean - return 1 for true 0 for false if (m_value instanceof Boolean) diff --git a/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java b/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java index 0e29710a55..0a331ebdae 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java +++ b/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java @@ -148,7 +148,7 @@ public class PrintDataFunction return variance; } // Standard Deviation - BigDecimal deviation = new BigDecimal(Math.sqrt(variance.doubleValue())); + BigDecimal deviation = BigDecimal.valueOf(Math.sqrt(variance.doubleValue())); if (deviation.scale() > 4) deviation = deviation.setScale(4, BigDecimal.ROUND_HALF_UP); return deviation; diff --git a/org.adempiere.base/src/org/compiere/report/core/RModelData.java b/org.adempiere.base/src/org/compiere/report/core/RModelData.java index 6f5291e61b..921eec1b09 100644 --- a/org.adempiere.base/src/org/compiere/report/core/RModelData.java +++ b/org.adempiere.base/src/org/compiere/report/core/RModelData.java @@ -76,7 +76,7 @@ public class RModelData private ArrayList m_groupRowsIndicator = null; /** Constant 1 */ - private static final BigDecimal ONE = new BigDecimal(1.0); + private static final BigDecimal ONE = BigDecimal.valueOf(1.0); /** Logger */ private static CLogger log = CLogger.getCLogger(RModelData.class); diff --git a/org.adempiere.base/src/org/compiere/util/AmtInWords_HR.java b/org.adempiere.base/src/org/compiere/util/AmtInWords_HR.java index 7e464f45a1..76b5513bf9 100644 --- a/org.adempiere.base/src/org/compiere/util/AmtInWords_HR.java +++ b/org.adempiere.base/src/org/compiere/util/AmtInWords_HR.java @@ -475,7 +475,7 @@ boolean jedinceBezBroja) { amount = amount.replaceAll (",", ""); Double iznos = Double.parseDouble(amount); - sb.append (slovimaUValuti (new BigDecimal(Double.valueOf(iznos)))); + sb.append (slovimaUValuti (BigDecimal.valueOf(Double.valueOf(iznos)))); return sb.toString (); } // getAmtInWords diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index b6a0609934..a52687b1b1 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -1777,11 +1777,11 @@ public final class Env */ /** Big Decimal 0 */ - static final public BigDecimal ZERO = new BigDecimal(0.0); + static final public BigDecimal ZERO = BigDecimal.valueOf(0.0); /** Big Decimal 1 */ - static final public BigDecimal ONE = new BigDecimal(1.0); + static final public BigDecimal ONE = BigDecimal.valueOf(1.0); /** Big Decimal 100 */ - static final public BigDecimal ONEHUNDRED = new BigDecimal(100.0); + static final public BigDecimal ONEHUNDRED = BigDecimal.valueOf(100.0); /** New Line */ public static final String NL = System.getProperty("line.separator"); diff --git a/org.adempiere.base/src/org/compiere/util/WebUtil.java b/org.adempiere.base/src/org/compiere/util/WebUtil.java index 76cf6d5317..12f1a756d0 100644 --- a/org.adempiere.base/src/org/compiere/util/WebUtil.java +++ b/org.adempiere.base/src/org/compiere/util/WebUtil.java @@ -375,7 +375,7 @@ public final class WebUtil if (oo instanceof BigDecimal) return (BigDecimal)oo; else if (oo instanceof Number) - return new BigDecimal (((Number)oo).doubleValue()); + return BigDecimal.valueOf(((Number)oo).doubleValue()); return new BigDecimal (oo.toString()); } catch (Exception e) diff --git a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java index 20626e0c48..f764ce2beb 100644 --- a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java +++ b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java @@ -534,7 +534,7 @@ public class GLJournalGenerate extends SvrProcess sourceAmt = sourceAmt.multiply(amtMultiplier, MathContext.UNLIMITED); if (roundFactor < 0) { - BigDecimal divisor = new BigDecimal(Math.pow(10, -roundFactor)); + BigDecimal divisor = BigDecimal.valueOf(Math.pow(10, -roundFactor)); sourceAmt = sourceAmt.divide(divisor, MathContext.UNLIMITED); sourceAmt = sourceAmt.setScale(0, BigDecimal.ROUND_HALF_UP); sourceAmt = sourceAmt.multiply(divisor, MathContext.UNLIMITED); diff --git a/org.adempiere.base/src/org/idempiere/fa/model/CalloutA_Depreciation_Workfile.java b/org.adempiere.base/src/org/idempiere/fa/model/CalloutA_Depreciation_Workfile.java index 8a14e107ff..307ed988a0 100644 --- a/org.adempiere.base/src/org/idempiere/fa/model/CalloutA_Depreciation_Workfile.java +++ b/org.adempiere.base/src/org/idempiere/fa/model/CalloutA_Depreciation_Workfile.java @@ -28,26 +28,26 @@ public class CalloutA_Depreciation_Workfile extends CalloutEngine BigDecimal uselife = null; if (MDepreciationWorkfile.COLUMNNAME_UseLifeYears.equals(mField.getColumnName())) { - uselife = new BigDecimal(value.toString()).multiply(new BigDecimal(12.0)); + uselife = new BigDecimal(value.toString()).multiply(BigDecimal.valueOf(12.0)); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, value); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths, uselife); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, uselife); } else if (MDepreciationWorkfile.COLUMNNAME_UseLifeMonths.equals(mField.getColumnName())) { - uselife = new BigDecimal(value.toString()).divide(new BigDecimal(12.0)); + uselife = new BigDecimal(value.toString()).divide(BigDecimal.valueOf(12.0)); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears, uselife); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, uselife); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, value); } else if (MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F.equals(mField.getColumnName())) { - uselife = new BigDecimal(value.toString()).multiply(new BigDecimal(12.0)); + uselife = new BigDecimal(value.toString()).multiply(BigDecimal.valueOf(12.0)); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F, uselife); } else if (MDepreciationWorkfile.COLUMNNAME_UseLifeMonths_F.equals(mField.getColumnName())) { - uselife = new BigDecimal(value.toString()).divide(new BigDecimal(12.0)); + uselife = new BigDecimal(value.toString()).divide(BigDecimal.valueOf(12.0)); mTab.setValue(MDepreciationWorkfile.COLUMNNAME_UseLifeYears_F, uselife); } diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 8b64707421..a63241cb0f 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -710,12 +710,12 @@ public final class AMenu extends CFrame memoryBar.setMaximum((int)total); memoryBar.setValue((int)used); String msg = MessageFormat.format("{0,number,integer} MB - {1,number,integer}%", - new Object[] {new BigDecimal(total / 1024), new BigDecimal(percent)}); + new Object[] {BigDecimal.valueOf(total / 1024), BigDecimal.valueOf(percent)}); memoryBar.setString(msg); // // msg = MessageFormat.format("Total Memory {0,number,integer} kB - Free {1,number,integer} kB", msg = Msg.getMsg(m_ctx, "MemoryInfo", - new Object[] {new BigDecimal(total), new BigDecimal(free)}); + new Object[] {BigDecimal.valueOf(total), BigDecimal.valueOf(free)}); memoryBar.setToolTipText(msg); // progressBar.repaint(); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java index 207317cc60..04fec3666e 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java @@ -394,7 +394,7 @@ public class VAllocation extends Allocation private void setAllocateButton() { - if (totalDiff.compareTo(new BigDecimal(0.0)) == 0 ^ m_C_Charge_ID > 0 ) + if (totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ^ m_C_Charge_ID > 0 ) { allocateButton.setEnabled(true); // chargePick.setValue(m_C_Charge_ID); @@ -404,7 +404,7 @@ public class VAllocation extends Allocation allocateButton.setEnabled(false); } - if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 ) + if ( totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ) { chargePick.setValue(null); m_C_Charge_ID = 0; diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VFactReconcile.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VFactReconcile.java index 84f230a3b9..8c1b2728a2 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VFactReconcile.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VFactReconcile.java @@ -320,7 +320,7 @@ implements FormPanel, ActionListener, TableModelListener, VetoableChangeListener public void calculateSelection() { m_noSelected = 0; - BigDecimal selectedAmt = new BigDecimal(0.0); + BigDecimal selectedAmt = BigDecimal.valueOf(0.0); int rows = miniTable.getRowCount(); for (int i = 0; i < rows; i++) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VMatch.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VMatch.java index 72d8cfd12e..916d950a19 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VMatch.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VMatch.java @@ -442,7 +442,7 @@ public class VMatch extends Match } // Display To be Matched Qty - m_xMatched = new BigDecimal (qty); + m_xMatched = BigDecimal.valueOf(qty); xMatched.setValue(m_xMatched); xMatchedTo.setValue(Env.ZERO); difference.setValue(m_xMatched); @@ -494,7 +494,7 @@ public class VMatch extends Match } } // update quantities - m_xMatchedTo = new BigDecimal(qty); + m_xMatchedTo = BigDecimal.valueOf(qty); xMatchedTo.setValue(m_xMatchedTo); difference.setValue(m_xMatched.subtract(m_xMatchedTo)); bProcess.setEnabled(noRows != 0); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/InvoiceHistory.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/InvoiceHistory.java index 4e0783c17d..e4410396fd 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/search/InvoiceHistory.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/InvoiceHistory.java @@ -282,7 +282,7 @@ public class InvoiceHistory extends CDialog double priceList = rs.getDouble(3); double priceActual = rs.getDouble(2); if (priceList != 0) { - discountBD = new BigDecimal((priceList - priceActual)/priceList * 100); + discountBD = BigDecimal.valueOf((priceList - priceActual)/priceList * 100); // Rounding: int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9)); if (discountBD.scale() > precision) diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/Calculator.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/Calculator.java index 8b8efece30..806e26ea71 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/Calculator.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/Calculator.java @@ -96,7 +96,7 @@ public final class Calculator extends CDialog // m_number = number; if (m_number == null) - m_number = new BigDecimal(0.0); + m_number = BigDecimal.valueOf(0.0); // try { @@ -433,7 +433,7 @@ public final class Calculator extends CDialog // nothing or zero if (m_display == null || m_display.equals("") || m_display.equals("0")) { - m_number = new BigDecimal(0.0); + m_number = BigDecimal.valueOf(0.0); return m_number; } @@ -448,7 +448,7 @@ public final class Calculator extends CDialog token += st.nextToken(); else { - m_number = new BigDecimal(0.0); + m_number = BigDecimal.valueOf(0.0); return m_number; } } @@ -462,7 +462,7 @@ public final class Calculator extends CDialog catch (ParseException pe1) { log.log(Level.SEVERE, "Calculator.evaluate - token: " + token, pe1); - m_number = new BigDecimal(0.0); + m_number = BigDecimal.valueOf(0.0); return m_number; } BigDecimal firstNo = new BigDecimal(firstNumber.toString()); @@ -485,7 +485,7 @@ public final class Calculator extends CDialog char op = token.charAt(0); if (op == '%') { - firstNo = firstNo.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); + firstNo = firstNo.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); m_number = firstNo; } @@ -502,7 +502,7 @@ public final class Calculator extends CDialog catch (ParseException pe2) { log.log(Level.SEVERE, "Calculator.evaluate - token: " + token, pe2); - m_number = new BigDecimal(0.0); + m_number = BigDecimal.valueOf(0.0); return m_number; } BigDecimal secondNo = new BigDecimal(secondNumber.toString()); @@ -523,7 +523,7 @@ public final class Calculator extends CDialog // Percent operation if (op2 == '%') - secondNo = secondNo.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); + secondNo = secondNo.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); switch (op) { diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/MDocNumber.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/MDocNumber.java index 05a244ad7f..b267d31541 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/MDocNumber.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/MDocNumber.java @@ -220,14 +220,14 @@ public final class MDocNumber extends PlainDocument else { String value = getText(); - BigDecimal percentValue = new BigDecimal(0.0); + BigDecimal percentValue = BigDecimal.valueOf(0.0); try { if (value != null && value.length() > 0) { Number number = m_format.parse(value); percentValue = new BigDecimal (number.toString()); - percentValue = percentValue.divide(new BigDecimal(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); + percentValue = percentValue.divide(BigDecimal.valueOf(100.0), m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP); m_tc.setText(m_format.format(percentValue)); } } diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VColor.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VColor.java index 579fbdfc3a..21611aced6 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VColor.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VColor.java @@ -340,7 +340,7 @@ public class VColor extends CButton setColor (cc.getTextureTaintColor(), true); // URL url = cc.getTextureURL(); // m_mTab.setValue("AD_Image_ID"); - m_mTab.setValue("ImageAlpha", new BigDecimal(cc.getTextureCompositeAlpha())); + m_mTab.setValue("ImageAlpha", BigDecimal.valueOf(cc.getTextureCompositeAlpha())); } m_cc = cc; } // actionPerformed diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VNumber.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VNumber.java index c7669b2a22..4991112692 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VNumber.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VNumber.java @@ -667,12 +667,12 @@ public final class VNumber extends JComponent if (bd.doubleValue() < m_minValue) { error = oo + " < " + m_minValue; - oo = new BigDecimal(m_minValue); + oo = BigDecimal.valueOf(m_minValue); } else if (bd.doubleValue() > m_maxValue) { error = oo + " > " + m_maxValue; - oo = new BigDecimal(m_maxValue); + oo = BigDecimal.valueOf(m_maxValue); } } if (error != null) @@ -717,7 +717,7 @@ public final class VNumber extends JComponent DecimalFormat format, int displayType, String title, char operator) { if (log.isLoggable(Level.CONFIG)) log.config("Value=" + value); - BigDecimal startValue = new BigDecimal(0.0); + BigDecimal startValue = BigDecimal.valueOf(0.0); try { if (value != null && value.length() > 0) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index e7175aada9..fc8372e0a1 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -485,7 +485,7 @@ public class WAllocation extends Allocation } // vetoableChange private void setAllocateButton() { - if (totalDiff.compareTo(new BigDecimal(0.0)) == 0 ^ m_C_Charge_ID > 0 ) + if (totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ^ m_C_Charge_ID > 0 ) { allocateButton.setEnabled(true); // chargePick.setValue(m_C_Charge_ID); @@ -495,7 +495,7 @@ public class WAllocation extends Allocation allocateButton.setEnabled(false); } - if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 ) + if ( totalDiff.compareTo(BigDecimal.valueOf(0.0)) == 0 ) { chargePick.setValue(null); m_C_Charge_ID = 0; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java index 1f1a953948..ff98e25105 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java @@ -334,7 +334,7 @@ implements IFormController, EventListener, WTableModelListener, ValueChan public void calculateSelection() { m_noSelected = 0; - BigDecimal selectedAmt = new BigDecimal(0.0); + BigDecimal selectedAmt = BigDecimal.valueOf(0.0); int rows = miniTable.getRowCount(); for (int i = 0; i < rows; i++) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java index 0e93bf7740..267379fe1e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java @@ -472,7 +472,7 @@ public class WMatch extends Match xMatchedToTable = (WListbox) cmd_searchTo(xMatchedTable, xMatchedToTable, displayString, matchToType, sameBPartner.isSelected(), sameProduct.isSelected(), sameQty.isSelected(), matchMode.getSelectedIndex() == MODE_MATCHED); } // Display To be Matched Qty - m_xMatched = new BigDecimal (qty); + m_xMatched = BigDecimal.valueOf(qty); xMatched.setValue(m_xMatched); xMatchedTo.setValue(Env.ZERO); difference.setValue(m_xMatched); @@ -528,7 +528,7 @@ public class WMatch extends Match } } // update qualtities - m_xMatchedTo = new BigDecimal(qty); + m_xMatchedTo = BigDecimal.valueOf(qty); xMatchedTo.setValue(m_xMatchedTo); difference.setValue(m_xMatched.subtract(m_xMatchedTo)); bProcess.setEnabled(noRows != 0); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/graph/WGraph.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/graph/WGraph.java index cf2861bae6..d245567ac4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/graph/WGraph.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/graph/WGraph.java @@ -530,7 +530,7 @@ public class WGraph extends Div implements IdSpace { td = new Td(); td.setSclass("pa-tdvalue"); tr.appendChild(td); - BigDecimal value = new BigDecimal(bgc.getValue()); + BigDecimal value = BigDecimal.valueOf(bgc.getValue()); if (bgc.getMQuery(builder.getMGoal()) != null) { A a = new A(); a.setSclass("pa-hrefNode"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java index f981eb4403..d3f57e0549 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java @@ -123,7 +123,7 @@ public class NumberBox extends Div else if (value instanceof BigDecimal) decimalBox.setValue((BigDecimal) value); else if (value instanceof Number) - decimalBox.setValue(new BigDecimal(((Number)value).doubleValue())); + decimalBox.setValue(BigDecimal.valueOf(((Number)value).doubleValue())); else decimalBox.setValue(new BigDecimal(value.toString())); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java index 7061741371..cd213fe197 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java @@ -209,7 +209,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener else if (value instanceof BigDecimal) oldValue = (BigDecimal) value; else if (value instanceof Number) - oldValue = new BigDecimal(((Number)value).doubleValue()); + oldValue = BigDecimal.valueOf(((Number)value).doubleValue()); else oldValue = new BigDecimal(value.toString()); getComponent().setValue(oldValue); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java index dd011a7ec8..8981171dd6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java @@ -316,7 +316,7 @@ public class InvoiceHistory extends Window implements EventListener double priceList = rs.getDouble(3); double priceActual = rs.getDouble(2); if (priceList != 0) { - discountBD = new BigDecimal((priceList - priceActual)/priceList * 100); + discountBD = BigDecimal.valueOf((priceList - priceActual)/priceList * 100); // Rounding: int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9)); if (discountBD.scale() > precision) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java index f23a4dd916..d3cfd90ac3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/InfoSchedule.java @@ -524,7 +524,7 @@ public class InfoSchedule extends Window implements EventListener ma.setS_Resource_ID(S_Resource_ID); ma.setAssignDateFrom(start); - ma.setQty(new BigDecimal(hours)); + ma.setQty(BigDecimal.valueOf(hours)); if (m_parent == null || m_callback == null) { final boolean createNew = true; if (vad != null && vad.getPage() != null) @@ -569,7 +569,7 @@ public class InfoSchedule extends Window implements EventListener MResourceAssignment ma = slot.getMAssignment(); ma.setAssignDateFrom(start); - ma.setQty(new BigDecimal(hours)); + ma.setQty(BigDecimal.valueOf(hours)); if (m_parent == null || m_callback == null) { if (event.getBeginDate() != null && event.getEndDate() != null) { 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 534d752844..160f637acb 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java @@ -53,9 +53,9 @@ public class Allocation public int m_C_BPartner_ID = 0; private int m_noInvoices = 0; private int m_noPayments = 0; - public BigDecimal totalInv = new BigDecimal(0.0); - public BigDecimal totalPay = new BigDecimal(0.0); - public BigDecimal totalDiff = new BigDecimal(0.0); + public BigDecimal totalInv = BigDecimal.valueOf(0.0); + public BigDecimal totalPay = BigDecimal.valueOf(0.0); + public BigDecimal totalDiff = BigDecimal.valueOf(0.0); public Timestamp allocDate = null; @@ -548,7 +548,7 @@ public class Allocation log.config(""); // Payment - totalPay = new BigDecimal(0.0); + totalPay = BigDecimal.valueOf(0.0); int rows = payment.getRowCount(); m_noPayments = 0; for (int i = 0; i < rows; i++) @@ -571,7 +571,7 @@ public class Allocation public String calculateInvoice(IMiniTable invoice, boolean isMultiCurrency) { // Invoices - totalInv = new BigDecimal(0.0); + totalInv = BigDecimal.valueOf(0.0); int rows = invoice.getRowCount(); m_noInvoices = 0; diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Match.java b/org.adempiere.ui/src/org/compiere/apps/form/Match.java index 4ff7de16e3..3d0de136ba 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Match.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Match.java @@ -206,7 +206,7 @@ public class Match // Create it String innerTrxName = Trx.createTrxName("Match"); Trx innerTrx = Trx.get(innerTrxName, true); - if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, new BigDecimal(qty), innerTrxName)) + if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, BigDecimal.valueOf(qty), innerTrxName)) innerTrx.commit(); else innerTrx.rollback(); diff --git a/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java b/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java index b9327f53a6..7c6305452d 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java @@ -61,7 +61,7 @@ public class PaySelect /** Format */ public DecimalFormat m_format = DisplayType.getNumberFormat(DisplayType.Amount); /** Bank Balance */ - private BigDecimal m_bankBalance = new BigDecimal(0.0); + private BigDecimal m_bankBalance = BigDecimal.valueOf(0.0); /** SQL for Query */ private String m_sql; /** Number of selected rows */ @@ -379,7 +379,7 @@ public class PaySelect public String calculateSelection(IMiniTable miniTable) { m_noSelected = 0; - BigDecimal invoiceAmt = new BigDecimal(0.0); + BigDecimal invoiceAmt = BigDecimal.valueOf(0.0); int rows = miniTable.getRowCount(); for (int i = 0; i < rows; i++)