Merge 041670731cf5
This commit is contained in:
commit
07551b1ebe
|
@ -0,0 +1,16 @@
|
|||
-- Apr 9, 2013 8:52:09 PM COT
|
||||
-- IDEMPIERE-843 Negative values are not evaluated in Tab Editor
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200351
|
||||
;
|
||||
|
||||
-- Apr 9, 2013 8:52:37 PM COT
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:52:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200352
|
||||
;
|
||||
|
||||
-- Apr 9, 2013 8:53:07 PM COT
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-04-09 20:53:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200354
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304092105_IDEMPIERE-843.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
-- Apr 9, 2013 8:52:09 PM COT
|
||||
-- IDEMPIERE-843 Negative values are not evaluated in Tab Editor
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:52:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200351
|
||||
;
|
||||
|
||||
-- Apr 9, 2013 8:52:37 PM COT
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:52:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200352
|
||||
;
|
||||
|
||||
-- Apr 9, 2013 8:53:07 PM COT
|
||||
UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-04-09 20:53:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200354
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304092105_IDEMPIERE-843.sql') FROM dual
|
||||
;
|
||||
|
|
@ -186,7 +186,7 @@ public class CalloutInventory extends CalloutEngine
|
|||
} else {
|
||||
// gwu: 1719401: clear Booked Quantity to zero first in case the query returns no rows,
|
||||
// for example when the locator has never stored a particular product.
|
||||
return new BigDecimal(0);
|
||||
return Env.ZERO;
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@ -201,7 +201,7 @@ public class CalloutInventory extends CalloutEngine
|
|||
pstmt = null;
|
||||
}
|
||||
|
||||
return new BigDecimal(0);
|
||||
return Env.ZERO;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ImmediateBankTransfer extends SvrProcess
|
|||
private String p_Name = ""; // Name
|
||||
private String p_Description= ""; // Description
|
||||
private int p_C_CashBook_ID = 0; // CashBook to be used as bridge
|
||||
private BigDecimal p_Amount = new BigDecimal(0); // Amount to be transfered between the accounts
|
||||
private BigDecimal p_Amount = Env.ZERO; // Amount to be transfered between the accounts
|
||||
private int p_From_C_BankAccount_ID = 0; // Bank Account From
|
||||
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
||||
private Timestamp p_StatementDate = null; // Date Statement
|
||||
|
@ -134,7 +134,7 @@ public class ImmediateBankTransfer extends SvrProcess
|
|||
if (!isSameCurrency())
|
||||
throw new AdempiereUserError ("Banks and CashBook must have same currency");
|
||||
|
||||
if (p_Amount.compareTo(new BigDecimal(0)) == 0)
|
||||
if (p_Amount.signum() == 0)
|
||||
throw new AdempiereUserError ("Amount required");
|
||||
|
||||
// Login Date
|
||||
|
|
|
@ -348,7 +348,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
//
|
||||
MDunningRunLine line = new MDunningRunLine (entry);
|
||||
line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
|
||||
new BigDecimal(0), DaysDue, IsInDispute, TimesDunned,
|
||||
Env.ZERO, DaysDue, IsInDispute, TimesDunned,
|
||||
DaysAfterLast);
|
||||
line.setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID);
|
||||
if (!line.save())
|
||||
|
@ -497,7 +497,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
line.setFee (p_C_Currency_ID, level.getFeeAmt());
|
||||
if (!line.save())
|
||||
throw new IllegalStateException("Cannot save MDunningRunLine");
|
||||
element.setQty (element.getQty ().subtract (new BigDecimal(1)));
|
||||
element.setQty (element.getQty ().subtract (Env.ONE));
|
||||
}
|
||||
}
|
||||
} // addFees
|
||||
|
|
|
@ -40,9 +40,6 @@ public class RfQCreateSO extends SvrProcess
|
|||
private int p_C_RfQ_ID = 0;
|
||||
private int p_C_DocType_ID = 0;
|
||||
|
||||
/** 100 */
|
||||
private static BigDecimal ONEHUNDRED = new BigDecimal (100);
|
||||
|
||||
/**
|
||||
* Prepare
|
||||
*/
|
||||
|
@ -130,9 +127,9 @@ public class RfQCreateSO extends SvrProcess
|
|||
margin = rfq.getMargin();
|
||||
if (margin != null && margin.signum() != 0)
|
||||
{
|
||||
margin = margin.add(ONEHUNDRED);
|
||||
margin = margin.add(Env.ONEHUNDRED);
|
||||
price = price.multiply(margin)
|
||||
.divide(ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||
.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
}
|
||||
} // price
|
||||
|
|
|
@ -193,10 +193,10 @@ public class PromotionRule {
|
|||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
discount = pr.getAmount();
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_Percentage)) {
|
||||
discount = pr.getAmount().divide(BigDecimal.valueOf(100.00)).multiply(totalPrice);
|
||||
discount = pr.getAmount().divide(Env.ONEHUNDRED).multiply(totalPrice);
|
||||
}
|
||||
if (discount.signum() > 0) {
|
||||
addDiscountLine(order, null, discount, BigDecimal.valueOf(1.00), pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
addDiscountLine(order, null, discount, Env.ONE, pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
}
|
||||
} else {
|
||||
int M_PromotionDistribution_ID = pr.getM_PromotionDistribution_ID();
|
||||
|
@ -260,10 +260,10 @@ public class PromotionRule {
|
|||
if (ol.getC_OrderLine_ID() == C_OrderLine_ID) {
|
||||
if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_Percentage)) {
|
||||
BigDecimal priceActual = ol.getPriceActual();
|
||||
BigDecimal discount = priceActual.multiply(pr.getAmount().divide(BigDecimal.valueOf(100.00)));
|
||||
BigDecimal discount = priceActual.multiply(pr.getAmount().divide(Env.ONEHUNDRED));
|
||||
addDiscountLine(order, ol, discount, qty, pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_FlatDiscount)) {
|
||||
addDiscountLine(order, ol, pr.getAmount(), BigDecimal.valueOf(1.00), pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
addDiscountLine(order, ol, pr.getAmount(), Env.ONE, pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
} else if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
BigDecimal priceActual = ol.getPriceActual();
|
||||
totalPrice = totalPrice.add(priceActual.multiply(qty));
|
||||
|
@ -278,7 +278,7 @@ public class PromotionRule {
|
|||
}
|
||||
if (pr.getRewardType().equals(MPromotionReward.REWARDTYPE_AbsoluteAmount)) {
|
||||
if (pr.getAmount().compareTo(totalPrice) < 0) {
|
||||
addDiscountLine(order, null, totalPrice.subtract(pr.getAmount()), BigDecimal.valueOf(1.00), pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
addDiscountLine(order, null, totalPrice.subtract(pr.getAmount()), Env.ONE, pr.getC_Charge_ID(), pr.getM_Promotion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.compiere.util.AdempiereUserError;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
||||
|
@ -119,7 +120,7 @@ public class UUIDGenerator extends SvrProcess {
|
|||
mColumn.setEntityType("U");
|
||||
mColumn.setFieldLength(36);
|
||||
mColumn.setName(columnName);
|
||||
mColumn.setVersion(new BigDecimal("1.00"));
|
||||
mColumn.setVersion(Env.ONE);
|
||||
mColumn.saveEx();
|
||||
|
||||
syncColumn(mColumn);
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import static org.compiere.model.SystemIDs.WINDOW_WINDOW_TAB_FIELD;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.GridWindow;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MUOMConversion;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Login;
|
||||
|
||||
|
@ -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, Env.ONEHUNDRED, 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, Env.ONEHUNDRED, true));
|
||||
|
||||
} // Base
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -193,7 +193,7 @@ public class Doc_Production extends Doc
|
|||
as.get_ID(), base.getAccount_ID(), 0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
//
|
||||
// only post variance if it's not zero
|
||||
if (variance.compareTo(new BigDecimal("0.00")) != 0)
|
||||
if (variance.signum() != 0)
|
||||
{
|
||||
//post variance
|
||||
fl = fact.createLine(line,
|
||||
|
|
|
@ -105,7 +105,7 @@ public class Doc_Requisition extends Doc
|
|||
*/
|
||||
public BigDecimal getBalance ()
|
||||
{
|
||||
BigDecimal retValue = new BigDecimal (0.0);
|
||||
BigDecimal retValue = Env.ZERO;
|
||||
return retValue;
|
||||
} // getBalance
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.logging.Level;
|
|||
import org.compiere.model.Callout;
|
||||
import org.compiere.model.X_AD_ImpFormat_Row;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Import Format Row with parsing capability
|
||||
|
@ -486,7 +487,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(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||
return bd.toString();
|
||||
} // parseNumber
|
||||
|
||||
|
|
|
@ -250,10 +250,9 @@ public class CalloutEngine implements Callout
|
|||
|
||||
BigDecimal rate1 = (BigDecimal)value;
|
||||
BigDecimal rate2 = Env.ZERO;
|
||||
BigDecimal one = new BigDecimal(1.0);
|
||||
|
||||
if (rate1.doubleValue() != 0.0) // no divide by zero
|
||||
rate2 = one.divide(rate1, 12, BigDecimal.ROUND_HALF_UP);
|
||||
if (rate1.signum() != 0.0) // no divide by zero
|
||||
rate2 = Env.ONE.divide(rate1, 12, BigDecimal.ROUND_HALF_UP);
|
||||
//
|
||||
if (mField.getColumnName().equals("MultiplyRate"))
|
||||
mTab.setValue("DivideRate", rate2);
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
private static final long serialVersionUID = 8726957992840702609L;
|
||||
|
||||
/** Tolerance Gain and Loss */
|
||||
private static final BigDecimal TOLERANCE = new BigDecimal (0.02);
|
||||
private static final BigDecimal TOLERANCE = BigDecimal.valueOf(0.02);
|
||||
|
||||
/**
|
||||
* Get Allocations of Payment
|
||||
|
@ -1045,7 +1045,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
|
|||
// allocation as a percentage of the invoice
|
||||
double multiplier = allocAmt.doubleValue() / invoice.getGrandTotal().doubleValue();
|
||||
// Reduce Orig Invoice Accounted
|
||||
invAmtAccted = invAmtAccted.multiply(new BigDecimal(multiplier));
|
||||
invAmtAccted = invAmtAccted.multiply(BigDecimal.valueOf(multiplier));
|
||||
// Difference based on percentage of Orig Invoice
|
||||
openBalanceDiff = openBalanceDiff.add(invAmtAccted).subtract(allocAmtAccted); // gain is negative
|
||||
// ignore Tolerance
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -41,6 +41,7 @@ import java.util.Properties;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Deposit Batch Model
|
||||
|
@ -69,7 +70,7 @@ public class MDepositBatch extends X_C_DepositBatch
|
|||
setDocStatus (DOCSTATUS_Drafted);
|
||||
setProcessed (false);
|
||||
setProcessing (false);
|
||||
setDepositAmt(new BigDecimal(0));
|
||||
setDepositAmt(Env.ZERO);
|
||||
}
|
||||
} // MDepositBatch
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -201,7 +201,7 @@ public class MDiscountSchema extends X_M_DiscountSchema
|
|||
if (discount == null || discount.signum() == 0)
|
||||
return Price;
|
||||
//
|
||||
BigDecimal onehundred = new BigDecimal(100);
|
||||
BigDecimal onehundred = Env.ONEHUNDRED;
|
||||
BigDecimal multiplier = (onehundred).subtract(discount);
|
||||
multiplier = multiplier.divide(onehundred, 6, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal newPrice = Price.multiply(multiplier);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -96,10 +96,6 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
|||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MInvoicePaySchedule.class);
|
||||
|
||||
/** 100 */
|
||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
|
@ -156,10 +152,10 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
|||
else
|
||||
{
|
||||
due = due.multiply(paySchedule.getPercentage())
|
||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
setDueAmt (due);
|
||||
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
setDiscountAmt (discount);
|
||||
setIsValid(true);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -720,7 +720,7 @@ public class MOrderLine extends X_C_OrderLine
|
|||
if (Env.ZERO.compareTo(list) == 0)
|
||||
return;
|
||||
BigDecimal discount = list.subtract(getPriceActual())
|
||||
.multiply(new BigDecimal(100))
|
||||
.multiply(Env.ONEHUNDRED)
|
||||
.divide(list, getPrecision(), BigDecimal.ROUND_HALF_UP);
|
||||
setDiscount(discount);
|
||||
} // setDiscount
|
||||
|
|
|
@ -96,10 +96,6 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
|||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MOrderPaySchedule.class);
|
||||
|
||||
/** 100 */
|
||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
|
@ -156,10 +152,10 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
|||
else
|
||||
{
|
||||
due = due.multiply(paySchedule.getPercentage())
|
||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
setDueAmt (due);
|
||||
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||
setDiscountAmt (discount);
|
||||
setIsValid(true);
|
||||
}
|
||||
|
|
|
@ -78,9 +78,6 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
|||
super(ctx, rs, trxName);
|
||||
} // MPaymentTerm
|
||||
|
||||
/** 100 */
|
||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
||||
|
||||
/** Payment Schedule children */
|
||||
private MPaySchedule[] m_schedule;
|
||||
|
||||
|
@ -159,7 +156,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
|||
if (percent != null)
|
||||
total = total.add(percent);
|
||||
}
|
||||
boolean valid = total.compareTo(HUNDRED) == 0;
|
||||
boolean valid = total.compareTo(Env.ONEHUNDRED) == 0;
|
||||
if (isValid() != valid)
|
||||
setIsValid (valid);
|
||||
for (int i = 0; i < m_schedule.length; i++)
|
||||
|
@ -172,7 +169,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
|||
}
|
||||
if (valid)
|
||||
return validMsg;
|
||||
return "@Total@ = " + total + " - @Difference@ = " + HUNDRED.subtract(total);
|
||||
return "@Total@ = " + total + " - @Difference@ = " + Env.ONEHUNDRED.subtract(total);
|
||||
} // validate
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
||||
/**
|
||||
* Resource Assignment Model
|
||||
|
@ -48,7 +49,7 @@ public class MResourceAssignment extends X_S_ResourceAssignment
|
|||
if (S_ResourceAssignment_ID == 0)
|
||||
{
|
||||
setAssignDateFrom(new Timestamp(System.currentTimeMillis()));
|
||||
setQty(new BigDecimal(1.0));
|
||||
setQty(Env.ONE);
|
||||
setName(".");
|
||||
setIsConfirmed(false);
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
|||
|
||||
/** RfQ Line Qty */
|
||||
private MRfQLineQty m_rfqQty = null;
|
||||
/** 100 */
|
||||
private static BigDecimal ONEHUNDRED = new BigDecimal (100);
|
||||
|
||||
/**
|
||||
* Get RfQ Line Qty
|
||||
|
@ -114,7 +112,7 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
|||
BigDecimal discount = getDiscount();
|
||||
if (discount != null)
|
||||
{
|
||||
if (discount.abs().compareTo(ONEHUNDRED) > 0)
|
||||
if (discount.abs().compareTo(Env.ONEHUNDRED) > 0)
|
||||
{
|
||||
log.warning("Discount > 100 - " + discount);
|
||||
return false;
|
||||
|
@ -149,8 +147,8 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
|||
return price;
|
||||
// Calculate
|
||||
// double result = price.doubleValue() * (100.0 - discount.doubleValue()) / 100.0;
|
||||
BigDecimal factor = ONEHUNDRED.subtract(discount);
|
||||
return price.multiply(factor).divide(ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal factor = Env.ONEHUNDRED.subtract(discount);
|
||||
return price.multiply(factor).divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||
} // getNetAmt
|
||||
|
||||
|
||||
|
|
|
@ -48,8 +48,6 @@ public class MTax extends X_C_Tax
|
|||
/** Cache of Client */
|
||||
private static CCache<Integer,MTax[]> s_cacheAll = new CCache<Integer,MTax[]>(Table_Name, Table_Name+"_Of_Client", 5);
|
||||
|
||||
/** 100 */
|
||||
private static BigDecimal ONEHUNDRED = new BigDecimal(100);
|
||||
/** Child Taxes */
|
||||
private MTax[] m_childTaxes = null;
|
||||
/** Postal Codes */
|
||||
|
@ -258,7 +256,7 @@ public class MTax extends X_C_Tax
|
|||
if (isZeroTax())
|
||||
return Env.ZERO;
|
||||
|
||||
BigDecimal multiplier = getRate().divide(ONEHUNDRED, 12, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiplier = getRate().divide(Env.ONEHUNDRED, 12, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
BigDecimal tax = null;
|
||||
if (!taxIncluded) // $100 * 6 / 100 == $6 == $100 * 0.06
|
||||
|
|
|
@ -102,12 +102,12 @@ import org.w3c.dom.Element;
|
|||
public abstract class PO
|
||||
implements Serializable, Comparator<Object>, Evaluatee, Cloneable
|
||||
{
|
||||
public static final String LOCAL_TRX_PREFIX = "POSave";
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6604764467216189092L;
|
||||
private static final long serialVersionUID = 8742545079591136114L;
|
||||
|
||||
public static final String LOCAL_TRX_PREFIX = "POSave";
|
||||
|
||||
private static final String USE_TIMEOUT_FOR_UPDATE = "org.adempiere.po.useTimeoutForUpdate";
|
||||
|
||||
|
@ -196,6 +196,7 @@ public abstract class PO
|
|||
int size = p_info.getColumnCount();
|
||||
m_oldValues = new Object[size];
|
||||
m_newValues = new Object[size];
|
||||
m_setErrors = new ValueNamePair[size];
|
||||
|
||||
if (rs != null)
|
||||
load(rs); // will not have virtual columns
|
||||
|
@ -235,6 +236,8 @@ public abstract class PO
|
|||
private Object[] m_oldValues = null;
|
||||
/** New Values */
|
||||
private Object[] m_newValues = null;
|
||||
/** Errors when setting */
|
||||
private ValueNamePair[] m_setErrors = null;
|
||||
|
||||
/** Record_IDs */
|
||||
private Object[] m_IDs = new Object[] {I_ZERO};
|
||||
|
@ -763,12 +766,14 @@ public abstract class PO
|
|||
String ColumnName = p_info.getColumnName(index);
|
||||
String colInfo = " - " + ColumnName;
|
||||
//
|
||||
m_setErrors[index] = null;
|
||||
if (checkWritable)
|
||||
{
|
||||
if (p_info.isVirtualColumn(index))
|
||||
{
|
||||
log.log(Level.WARNING, "Virtual Column" + colInfo);
|
||||
log.saveError("VirtualColumn", "Virtual Column" + colInfo);
|
||||
m_setErrors[index] = new ValueNamePair("VirtualColumn", "Virtual Column" + colInfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -780,6 +785,7 @@ public abstract class PO
|
|||
colInfo += " - NewValue=" + value + " - OldValue=" + get_Value(index);
|
||||
log.log(Level.WARNING, "Column not updateable" + colInfo);
|
||||
log.saveError("ColumnReadonly", "Column not updateable" + colInfo);
|
||||
m_setErrors[index] = new ValueNamePair("ColumnReadonly", "Column not updateable" + colInfo);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -789,7 +795,8 @@ public abstract class PO
|
|||
if (checkWritable && p_info.isColumnMandatory(index))
|
||||
{
|
||||
log.saveError("FillMandatory", ColumnName + " is mandatory.");
|
||||
throw new IllegalArgumentException (ColumnName + " is mandatory.");
|
||||
m_setErrors[index] = new ValueNamePair("FillMandatory", ColumnName + " is mandatory.");
|
||||
return false;
|
||||
}
|
||||
m_newValues[index] = Null.NULL; // correct
|
||||
if (log.isLoggable(Level.FINER)) log.finer(ColumnName + " = null");
|
||||
|
@ -823,22 +830,22 @@ public abstract class PO
|
|||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
log.log(Level.SEVERE, ColumnName
|
||||
+ " - Class invalid: " + value.getClass().toString()
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
||||
log.saveError("WrongDataType", ColumnName
|
||||
String errmsg = ColumnName
|
||||
+ " - Class invalid: " + value.getClass().toString()
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value;
|
||||
log.log(Level.SEVERE, errmsg);
|
||||
log.saveError("WrongDataType", errmsg);
|
||||
m_setErrors[index] = new ValueNamePair("WrongDataType", errmsg);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.log(Level.SEVERE, ColumnName
|
||||
+ " - Class invalid: " + value.getClass().toString()
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
||||
log.saveError("WrongDataType", ColumnName
|
||||
String errmsg = ColumnName
|
||||
+ " - Class invalid: " + value.getClass().toString()
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value);
|
||||
+ ", Should be " + p_info.getColumnClass(index).toString() + ": " + value;
|
||||
log.log(Level.SEVERE, errmsg);
|
||||
log.saveError("WrongDataType", errmsg);
|
||||
m_setErrors[index] = new ValueNamePair("WrongDataType", errmsg);
|
||||
return false;
|
||||
}
|
||||
// Validate (Min/Max)
|
||||
|
@ -849,8 +856,10 @@ public abstract class PO
|
|||
int separatorIndex = error.indexOf(";");
|
||||
if (separatorIndex > 0) {
|
||||
log.saveError(error.substring(0,separatorIndex), error.substring(separatorIndex+1));
|
||||
m_setErrors[index] = new ValueNamePair(error.substring(0,separatorIndex), error.substring(separatorIndex+1));
|
||||
} else {
|
||||
log.saveError(error, ColumnName);
|
||||
m_setErrors[index] = new ValueNamePair(error, ColumnName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -876,10 +885,11 @@ public abstract class PO
|
|||
StringBuilder validValues = new StringBuilder();
|
||||
for (ValueNamePair vp : MRefList.getList(getCtx(), p_info.getColumn(index).AD_Reference_Value_ID, false))
|
||||
validValues.append(" - ").append(vp.getValue());
|
||||
log.saveError("Validate", ColumnName + " Invalid value - "
|
||||
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString());
|
||||
throw new IllegalArgumentException(ColumnName + " Invalid value - "
|
||||
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString());
|
||||
String errmsg = ColumnName + " Invalid value - "
|
||||
+ value + " - Reference_ID=" + p_info.getColumn(index).AD_Reference_Value_ID + validValues.toString();
|
||||
log.saveError("Validate", errmsg);
|
||||
m_setErrors[index] = new ValueNamePair("Validate", errmsg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (log.isLoggable(Level.FINEST)) log.finest(ColumnName + " = " + m_newValues[index] + " (OldValue="+m_oldValues[index]+")");
|
||||
|
@ -909,7 +919,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);
|
||||
}
|
||||
}
|
||||
|
@ -1952,6 +1962,14 @@ public abstract class PO
|
|||
if (log.isLoggable(Level.FINE)) log.fine("Nothing changed - " + p_info.getTableName());
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_setErrors.length; i++) {
|
||||
ValueNamePair setError = m_setErrors[i];
|
||||
if (setError != null) {
|
||||
log.saveError(setError.getValue(), Msg.getElement(getCtx(), p_info.getColumnName(i)) + " - " + setError.getName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Organization Check
|
||||
if (getAD_Org_ID() == 0
|
||||
|
@ -2156,8 +2174,9 @@ public abstract class PO
|
|||
if (!save()) {
|
||||
String msg = null;
|
||||
ValueNamePair err = CLogger.retrieveError();
|
||||
String val = Msg.translate(getCtx(), err.getValue());
|
||||
if (err != null)
|
||||
msg = err.getName();
|
||||
msg = (val != null ? val + ": " : "") + err.getName();
|
||||
if (msg == null || msg.length() == 0)
|
||||
msg = "SaveError";
|
||||
throw new AdempiereException(msg);
|
||||
|
|
|
@ -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 = Env.ONE;
|
||||
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 = Env.ONE;
|
||||
return retValue;
|
||||
} // getVLineStroke
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -75,9 +75,6 @@ public class RModelData
|
|||
private ArrayList<Integer> m_groupRows = new ArrayList<Integer>();
|
||||
private ArrayList<Boolean> m_groupRowsIndicator = null;
|
||||
|
||||
/** Constant 1 */
|
||||
private static final BigDecimal ONE = new BigDecimal(1.0);
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(RModelData.class);
|
||||
|
||||
|
@ -322,7 +319,7 @@ public class RModelData
|
|||
if (funcFuns[fc].equals(RModel.FUNCTION_SUM))
|
||||
funcVals[fc][level] = funcVals[fc][level].add(bd);
|
||||
else if (funcFuns[fc].equals(RModel.FUNCTION_COUNT))
|
||||
funcVals[fc][level] = funcVals[fc][level].add(ONE);
|
||||
funcVals[fc][level] = funcVals[fc][level].add(Env.ONE);
|
||||
} // for all group levels
|
||||
} // for all functions
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BankTransfer extends SvrProcess
|
|||
private int p_C_ConversionType_ID = 0; // Payment Conversion Type
|
||||
private int p_C_Charge_ID = 0; // Charge to be used as bridge
|
||||
|
||||
private BigDecimal p_Amount = new BigDecimal(0); // Amount to be transfered between the accounts
|
||||
private BigDecimal p_Amount = Env.ZERO; // Amount to be transfered between the accounts
|
||||
private int p_From_C_BankAccount_ID = 0; // Bank Account From
|
||||
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
||||
private Timestamp p_StatementDate = null; // Date Statement
|
||||
|
@ -116,7 +116,7 @@ public class BankTransfer extends SvrProcess
|
|||
if (p_C_Charge_ID == 0)
|
||||
throw new AdempiereUserError ("Business Partner required");
|
||||
|
||||
if (p_Amount.compareTo(new BigDecimal(0)) == 0)
|
||||
if (p_Amount.signum() == 0)
|
||||
throw new AdempiereUserError ("Amount required");
|
||||
|
||||
// Login Date
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package test.functional;
|
||||
|
||||
import org.compiere.model.MProductPrice;
|
||||
|
||||
import test.AdempiereTestCase;
|
||||
|
||||
public class MProductTest extends AdempiereTestCase {
|
||||
|
@ -86,7 +87,7 @@ public class MProductTest extends AdempiereTestCase {
|
|||
}
|
||||
|
||||
public void testSetBaseInfo() {
|
||||
MProductPricing prodprice = new MProductPricing(122,100, new BigDecimal (100),true);
|
||||
MProductPricing prodprice = new MProductPricing(122,100, Env.ONEHUNDRED,true);
|
||||
int uom = 0;
|
||||
uom = prodprice.getC_UOM_ID();
|
||||
assertTrue("UOM must be correct", uom == 100);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_CURRENCY_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_PERIOD_AD_ORG_ID;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
|
@ -22,7 +26,6 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -46,7 +49,6 @@ import org.compiere.minigrid.MiniTable;
|
|||
import org.compiere.model.MAllocationHdr;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.plaf.CompiereColor;
|
||||
import org.compiere.swing.CPanel;
|
||||
import org.compiere.swing.CTextField;
|
||||
|
@ -394,7 +396,7 @@ public class VAllocation extends Allocation
|
|||
|
||||
|
||||
private void setAllocateButton() {
|
||||
if (totalDiff.compareTo(new BigDecimal(0.0)) == 0 ^ m_C_Charge_ID > 0 )
|
||||
if (totalDiff.signum() == 0 ^ m_C_Charge_ID > 0 )
|
||||
{
|
||||
allocateButton.setEnabled(true);
|
||||
// chargePick.setValue(m_C_Charge_ID);
|
||||
|
@ -404,7 +406,7 @@ public class VAllocation extends Allocation
|
|||
allocateButton.setEnabled(false);
|
||||
}
|
||||
|
||||
if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 )
|
||||
if ( totalDiff.signum() == 0 )
|
||||
{
|
||||
chargePick.setValue(null);
|
||||
m_C_Charge_ID = 0;
|
||||
|
|
|
@ -320,7 +320,7 @@ implements FormPanel, ActionListener, TableModelListener, VetoableChangeListener
|
|||
public void calculateSelection()
|
||||
{
|
||||
m_noSelected = 0;
|
||||
BigDecimal selectedAmt = new BigDecimal(0.0);
|
||||
BigDecimal selectedAmt = Env.ZERO;
|
||||
|
||||
int rows = miniTable.getRowCount();
|
||||
for (int i = 0; i < rows; i++)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -567,7 +567,7 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener, TreeS
|
|||
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
|
||||
KeyNamePair uom = new KeyNamePair(u.get_ID(), u.getUOMSymbol());
|
||||
line.add(uom); // 3 C_UOM_ID
|
||||
line.add((BigDecimal) ((bomline.getBOMQty()!=null) ? bomline.getBOMQty() : new BigDecimal(0))); // 4 QtyBOM
|
||||
line.add((BigDecimal) ((bomline.getBOMQty()!=null) ? bomline.getBOMQty() : Env.ZERO)); // 4 QtyBOM
|
||||
|
||||
DefaultMutableTreeNode child = new DefaultMutableTreeNode(line);
|
||||
parent.add(child);
|
||||
|
@ -595,7 +595,7 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener, TreeS
|
|||
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
|
||||
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||
line.add(uom); // 3 C_UOM_ID
|
||||
line.add((BigDecimal) ((bom.getBOMQty()!=null) ? bom.getBOMQty() : new BigDecimal(0))); // 4 QtyBOM
|
||||
line.add((BigDecimal) ((bom.getBOMQty()!=null) ? bom.getBOMQty() : Env.ZERO)); // 4 QtyBOM
|
||||
|
||||
if(m_selected_id == bom.getM_ProductBOM_ID() || getM_Product_ID() == bom.getM_ProductBOM_ID())
|
||||
dataBOM.add(line);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.awt.event.MouseListener;
|
|||
import java.awt.font.LineBreakMeasurer;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
|
@ -391,7 +390,7 @@ public class VSchedulePanel extends JComponent implements MouseListener
|
|||
ma.setS_Resource_ID(m_S_Resource_ID);
|
||||
ma.setAssignDateFrom(TimeUtil.getDayTime(TimeUtil.addDays(m_startDate, dayIndex),
|
||||
m_timePanel.getTimeSlot(timeIndex).getStartTime()));
|
||||
ma.setQty(new BigDecimal(1));
|
||||
ma.setQty(Env.ONE);
|
||||
VAssignmentDialog vad = new VAssignmentDialog (AEnv.getFrame(this), ma, false, m_createNew);
|
||||
m_infoSchedule.mAssignmentCallback(vad.getMResourceAssignment());
|
||||
return;
|
||||
|
|
|
@ -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 = Env.ZERO;
|
||||
//
|
||||
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 = Env.ZERO;
|
||||
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 = Env.ZERO;
|
||||
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 = Env.ZERO;
|
||||
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(Env.ONEHUNDRED, 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 = Env.ZERO;
|
||||
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(Env.ONEHUNDRED, m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ import javax.swing.text.PlainDocument;
|
|||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Number Document Model.
|
||||
|
@ -220,14 +221,14 @@ public final class MDocNumber extends PlainDocument
|
|||
else
|
||||
{
|
||||
String value = getText();
|
||||
BigDecimal percentValue = new BigDecimal(0.0);
|
||||
BigDecimal percentValue = Env.ZERO;
|
||||
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(Env.ONEHUNDRED, m_format.getMaximumFractionDigits(), BigDecimal.ROUND_HALF_UP);
|
||||
m_tc.setText(m_format.format(percentValue));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = Env.ZERO;
|
||||
try
|
||||
{
|
||||
if (value != null && value.length() > 0)
|
||||
|
|
|
@ -569,7 +569,7 @@ public class SubOrder extends PosSubPanel
|
|||
if (p_posPanel != null && p_posPanel.f_curLine != null)
|
||||
{
|
||||
MOrder order = p_posPanel.f_curLine.getOrder();
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
BigDecimal total = Env.ZERO;
|
||||
if (order != null)
|
||||
total = order.getGrandTotal();
|
||||
paid = given.doubleValue() >= total.doubleValue();
|
||||
|
|
|
@ -20,7 +20,6 @@ import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
|
|||
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_CURRENCY_ID;
|
||||
import static org.compiere.model.SystemIDs.COLUMN_C_PERIOD_AD_ORG_ID;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -485,7 +484,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.signum() == 0 ^ m_C_Charge_ID > 0 )
|
||||
{
|
||||
allocateButton.setEnabled(true);
|
||||
// chargePick.setValue(m_C_Charge_ID);
|
||||
|
@ -495,7 +494,7 @@ public class WAllocation extends Allocation
|
|||
allocateButton.setEnabled(false);
|
||||
}
|
||||
|
||||
if ( totalDiff.compareTo(new BigDecimal(0.0)) == 0 )
|
||||
if ( totalDiff.signum() == 0 )
|
||||
{
|
||||
chargePick.setValue(null);
|
||||
m_C_Charge_ID = 0;
|
||||
|
|
|
@ -207,7 +207,7 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
|
|||
|
||||
Label lblProduct = new Label(Msg.translate(Env.getCtx(), "M_Product_ID"));
|
||||
Label lblQty = new Label(Msg.translate(Env.getCtx(), "Qty"));
|
||||
productQty.setValue(new BigDecimal(1));
|
||||
productQty.setValue(Env.ONE);
|
||||
productField.addEventListener(Events.ON_SELECT, this);
|
||||
productQty.addEventListener(Events.ON_CHANGE, this);
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ implements IFormController, EventListener<Event>, WTableModelListener, ValueChan
|
|||
public void calculateSelection()
|
||||
{
|
||||
m_noSelected = 0;
|
||||
BigDecimal selectedAmt = new BigDecimal(0.0);
|
||||
BigDecimal selectedAmt = Env.ZERO;
|
||||
|
||||
int rows = miniTable.getRowCount();
|
||||
for (int i = 0; i < rows; i++)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -810,7 +810,9 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
|||
} else if (MField.COLUMNNAME_XPosition.equals(propertyName)) {
|
||||
field.setXPosition(intvalue);
|
||||
} else if (MField.COLUMNNAME_ColumnSpan.equals(propertyName)) {
|
||||
field.setColumnSpan(intvalue);
|
||||
int prevcolspan = field.getColumnSpan();
|
||||
if (!field.set_ValueOfColumnReturningBoolean(MField.COLUMNNAME_ColumnSpan, intvalue))
|
||||
field.setColumnSpan(prevcolspan);
|
||||
} else if (MField.COLUMNNAME_NumLines.equals(propertyName)) {
|
||||
field.setNumLines(intvalue);
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
|
|||
MUOM u = new MUOM(product.getCtx(), product.getC_UOM_ID(), product.get_TrxName());
|
||||
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||
line.add(uom); // 3 C_UOM_ID
|
||||
line.add((BigDecimal) (new BigDecimal(1)).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
line.add((BigDecimal) (Env.ONE).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
|
||||
// dummy root node, as first node is not displayed in tree
|
||||
mySimpleTreeNode parent = new mySimpleTreeNode("Root",new ArrayList<TreeNode<Object>>());
|
||||
|
@ -441,7 +441,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
|
|||
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
|
||||
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||
line.add(uom); // 3 C_UOM_ID
|
||||
line.add((BigDecimal) ((bomline.getBOMQty()!=null) ? bomline.getBOMQty() : new BigDecimal(0)).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
line.add((BigDecimal) ((bomline.getBOMQty()!=null) ? bomline.getBOMQty() : Env.ZERO).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
|
||||
mySimpleTreeNode child = new mySimpleTreeNode(line,new ArrayList<TreeNode<Object>>());
|
||||
if (!reload)
|
||||
|
@ -470,7 +470,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
|
|||
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
|
||||
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||
line.add(uom); // 3 C_UOM_ID
|
||||
line.add((BigDecimal) ((bom.getBOMQty()!=null) ? bom.getBOMQty() : new BigDecimal(0)).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
line.add((BigDecimal) ((bom.getBOMQty()!=null) ? bom.getBOMQty() : Env.ZERO).setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros()); // 4 QtyBOM
|
||||
|
||||
if(m_selected_id == bom.getM_ProductBOM_ID() || getM_Product_ID() == bom.getM_ProductBOM_ID())
|
||||
dataBOM.add(line);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -244,6 +244,8 @@ ContextMenuListener, IZoomableEditor
|
|||
retVal = selItem.getValue();
|
||||
if ((retVal instanceof Integer) && (Integer)retVal == -1)
|
||||
retVal = null;
|
||||
else if ((retVal instanceof String) && "".equals(retVal))
|
||||
retVal = null;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
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)
|
||||
|
|
|
@ -524,7 +524,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
|
|||
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<Event>
|
|||
|
||||
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) {
|
||||
|
|
|
@ -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 = Env.ZERO;
|
||||
public BigDecimal totalPay = Env.ZERO;
|
||||
public BigDecimal totalDiff = Env.ZERO;
|
||||
|
||||
public Timestamp allocDate = null;
|
||||
|
||||
|
@ -548,7 +548,7 @@ public class Allocation
|
|||
log.config("");
|
||||
|
||||
// Payment
|
||||
totalPay = new BigDecimal(0.0);
|
||||
totalPay = Env.ZERO;
|
||||
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 = Env.ZERO;
|
||||
int rows = invoice.getRowCount();
|
||||
m_noInvoices = 0;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 = Env.ZERO;
|
||||
/** 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 = Env.ZERO;
|
||||
|
||||
int rows = miniTable.getRowCount();
|
||||
for (int i = 0; i < rows; i++)
|
||||
|
|
|
@ -341,7 +341,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
|||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
BigDecimal total = Env.ZERO;
|
||||
int rows = miniTable.getRowCount();
|
||||
int count = 0;
|
||||
for(int i = 0; i < rows; i++)
|
||||
|
|
|
@ -166,7 +166,7 @@ public abstract class CreateFromBatch extends CreateFrom
|
|||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
BigDecimal total = Env.ZERO;
|
||||
int rows = miniTable.getRowCount();
|
||||
int count = 0;
|
||||
for(int i = 0; i < rows; i++)
|
||||
|
|
Loading…
Reference in New Issue