IDEMPIERE-455 Discover and fix FindBugs problems / DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE / Improve some calculations for BigDecimal
This commit is contained in:
parent
16094d84d5
commit
01a9897cc1
|
@ -186,7 +186,7 @@ public class CalloutInventory extends CalloutEngine
|
||||||
} else {
|
} else {
|
||||||
// gwu: 1719401: clear Booked Quantity to zero first in case the query returns no rows,
|
// 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.
|
// for example when the locator has never stored a particular product.
|
||||||
return new BigDecimal(0);
|
return Env.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
|
@ -201,7 +201,7 @@ public class CalloutInventory extends CalloutEngine
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BigDecimal(0);
|
return Env.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ImmediateBankTransfer extends SvrProcess
|
||||||
private String p_Name = ""; // Name
|
private String p_Name = ""; // Name
|
||||||
private String p_Description= ""; // Description
|
private String p_Description= ""; // Description
|
||||||
private int p_C_CashBook_ID = 0; // CashBook to be used as bridge
|
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_From_C_BankAccount_ID = 0; // Bank Account From
|
||||||
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
||||||
private Timestamp p_StatementDate = null; // Date Statement
|
private Timestamp p_StatementDate = null; // Date Statement
|
||||||
|
@ -134,7 +134,7 @@ public class ImmediateBankTransfer extends SvrProcess
|
||||||
if (!isSameCurrency())
|
if (!isSameCurrency())
|
||||||
throw new AdempiereUserError ("Banks and CashBook must have same currency");
|
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");
|
throw new AdempiereUserError ("Amount required");
|
||||||
|
|
||||||
// Login Date
|
// Login Date
|
||||||
|
|
|
@ -348,7 +348,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
//
|
//
|
||||||
MDunningRunLine line = new MDunningRunLine (entry);
|
MDunningRunLine line = new MDunningRunLine (entry);
|
||||||
line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
|
line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
|
||||||
new BigDecimal(0), DaysDue, IsInDispute, TimesDunned,
|
Env.ZERO, DaysDue, IsInDispute, TimesDunned,
|
||||||
DaysAfterLast);
|
DaysAfterLast);
|
||||||
line.setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID);
|
line.setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID);
|
||||||
if (!line.save())
|
if (!line.save())
|
||||||
|
@ -497,7 +497,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
line.setFee (p_C_Currency_ID, level.getFeeAmt());
|
line.setFee (p_C_Currency_ID, level.getFeeAmt());
|
||||||
if (!line.save())
|
if (!line.save())
|
||||||
throw new IllegalStateException("Cannot save MDunningRunLine");
|
throw new IllegalStateException("Cannot save MDunningRunLine");
|
||||||
element.setQty (element.getQty ().subtract (new BigDecimal(1)));
|
element.setQty (element.getQty ().subtract (Env.ONE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // addFees
|
} // addFees
|
||||||
|
|
|
@ -40,9 +40,6 @@ public class RfQCreateSO extends SvrProcess
|
||||||
private int p_C_RfQ_ID = 0;
|
private int p_C_RfQ_ID = 0;
|
||||||
private int p_C_DocType_ID = 0;
|
private int p_C_DocType_ID = 0;
|
||||||
|
|
||||||
/** 100 */
|
|
||||||
private static BigDecimal ONEHUNDRED = new BigDecimal (100);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare
|
* Prepare
|
||||||
*/
|
*/
|
||||||
|
@ -130,9 +127,9 @@ public class RfQCreateSO extends SvrProcess
|
||||||
margin = rfq.getMargin();
|
margin = rfq.getMargin();
|
||||||
if (margin != null && margin.signum() != 0)
|
if (margin != null && margin.signum() != 0)
|
||||||
{
|
{
|
||||||
margin = margin.add(ONEHUNDRED);
|
margin = margin.add(Env.ONEHUNDRED);
|
||||||
price = price.multiply(margin)
|
price = price.multiply(margin)
|
||||||
.divide(ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // price
|
} // price
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.compiere.util.AdempiereUserError;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
import org.compiere.util.ValueNamePair;
|
import org.compiere.util.ValueNamePair;
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ public class UUIDGenerator extends SvrProcess {
|
||||||
mColumn.setEntityType("U");
|
mColumn.setEntityType("U");
|
||||||
mColumn.setFieldLength(36);
|
mColumn.setFieldLength(36);
|
||||||
mColumn.setName(columnName);
|
mColumn.setName(columnName);
|
||||||
mColumn.setVersion(new BigDecimal("1.00"));
|
mColumn.setVersion(Env.ONE);
|
||||||
mColumn.saveEx();
|
mColumn.saveEx();
|
||||||
|
|
||||||
syncColumn(mColumn);
|
syncColumn(mColumn);
|
||||||
|
|
|
@ -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);
|
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
|
// only post variance if it's not zero
|
||||||
if (variance.compareTo(new BigDecimal("0.00")) != 0)
|
if (variance.signum() != 0)
|
||||||
{
|
{
|
||||||
//post variance
|
//post variance
|
||||||
fl = fact.createLine(line,
|
fl = fact.createLine(line,
|
||||||
|
|
|
@ -41,6 +41,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deposit Batch Model
|
* Deposit Batch Model
|
||||||
|
@ -69,7 +70,7 @@ public class MDepositBatch extends X_C_DepositBatch
|
||||||
setDocStatus (DOCSTATUS_Drafted);
|
setDocStatus (DOCSTATUS_Drafted);
|
||||||
setProcessed (false);
|
setProcessed (false);
|
||||||
setProcessing (false);
|
setProcessing (false);
|
||||||
setDepositAmt(new BigDecimal(0));
|
setDepositAmt(Env.ZERO);
|
||||||
}
|
}
|
||||||
} // MDepositBatch
|
} // MDepositBatch
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class MDiscountSchema extends X_M_DiscountSchema
|
||||||
if (discount == null || discount.signum() == 0)
|
if (discount == null || discount.signum() == 0)
|
||||||
return Price;
|
return Price;
|
||||||
//
|
//
|
||||||
BigDecimal onehundred = new BigDecimal(100);
|
BigDecimal onehundred = Env.ONEHUNDRED;
|
||||||
BigDecimal multiplier = (onehundred).subtract(discount);
|
BigDecimal multiplier = (onehundred).subtract(discount);
|
||||||
multiplier = multiplier.divide(onehundred, 6, BigDecimal.ROUND_HALF_UP);
|
multiplier = multiplier.divide(onehundred, 6, BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal newPrice = Price.multiply(multiplier);
|
BigDecimal newPrice = Price.multiply(multiplier);
|
||||||
|
|
|
@ -96,10 +96,6 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MInvoicePaySchedule.class);
|
private static CLogger s_log = CLogger.getCLogger (MInvoicePaySchedule.class);
|
||||||
|
|
||||||
/** 100 */
|
|
||||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -156,10 +152,10 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
due = due.multiply(paySchedule.getPercentage())
|
due = due.multiply(paySchedule.getPercentage())
|
||||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||||
setDueAmt (due);
|
setDueAmt (due);
|
||||||
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
||||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||||
setDiscountAmt (discount);
|
setDiscountAmt (discount);
|
||||||
setIsValid(true);
|
setIsValid(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,7 +720,7 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
if (Env.ZERO.compareTo(list) == 0)
|
if (Env.ZERO.compareTo(list) == 0)
|
||||||
return;
|
return;
|
||||||
BigDecimal discount = list.subtract(getPriceActual())
|
BigDecimal discount = list.subtract(getPriceActual())
|
||||||
.multiply(new BigDecimal(100))
|
.multiply(Env.ONEHUNDRED)
|
||||||
.divide(list, getPrecision(), BigDecimal.ROUND_HALF_UP);
|
.divide(list, getPrecision(), BigDecimal.ROUND_HALF_UP);
|
||||||
setDiscount(discount);
|
setDiscount(discount);
|
||||||
} // setDiscount
|
} // setDiscount
|
||||||
|
|
|
@ -96,10 +96,6 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
||||||
/** Static Logger */
|
/** Static Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MOrderPaySchedule.class);
|
private static CLogger s_log = CLogger.getCLogger (MOrderPaySchedule.class);
|
||||||
|
|
||||||
/** 100 */
|
|
||||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -156,10 +152,10 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
due = due.multiply(paySchedule.getPercentage())
|
due = due.multiply(paySchedule.getPercentage())
|
||||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||||
setDueAmt (due);
|
setDueAmt (due);
|
||||||
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
BigDecimal discount = due.multiply(paySchedule.getDiscount())
|
||||||
.divide(HUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
.divide(Env.ONEHUNDRED, scale, BigDecimal.ROUND_HALF_UP);
|
||||||
setDiscountAmt (discount);
|
setDiscountAmt (discount);
|
||||||
setIsValid(true);
|
setIsValid(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,6 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
||||||
super(ctx, rs, trxName);
|
super(ctx, rs, trxName);
|
||||||
} // MPaymentTerm
|
} // MPaymentTerm
|
||||||
|
|
||||||
/** 100 */
|
|
||||||
private final static BigDecimal HUNDRED = new BigDecimal(100);
|
|
||||||
|
|
||||||
/** Payment Schedule children */
|
/** Payment Schedule children */
|
||||||
private MPaySchedule[] m_schedule;
|
private MPaySchedule[] m_schedule;
|
||||||
|
|
||||||
|
@ -159,7 +156,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
||||||
if (percent != null)
|
if (percent != null)
|
||||||
total = total.add(percent);
|
total = total.add(percent);
|
||||||
}
|
}
|
||||||
boolean valid = total.compareTo(HUNDRED) == 0;
|
boolean valid = total.compareTo(Env.ONEHUNDRED) == 0;
|
||||||
if (isValid() != valid)
|
if (isValid() != valid)
|
||||||
setIsValid (valid);
|
setIsValid (valid);
|
||||||
for (int i = 0; i < m_schedule.length; i++)
|
for (int i = 0; i < m_schedule.length; i++)
|
||||||
|
@ -172,7 +169,7 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
||||||
}
|
}
|
||||||
if (valid)
|
if (valid)
|
||||||
return validMsg;
|
return validMsg;
|
||||||
return "@Total@ = " + total + " - @Difference@ = " + HUNDRED.subtract(total);
|
return "@Total@ = " + total + " - @Difference@ = " + Env.ONEHUNDRED.subtract(total);
|
||||||
} // validate
|
} // validate
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,6 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
||||||
|
|
||||||
/** RfQ Line Qty */
|
/** RfQ Line Qty */
|
||||||
private MRfQLineQty m_rfqQty = null;
|
private MRfQLineQty m_rfqQty = null;
|
||||||
/** 100 */
|
|
||||||
private static BigDecimal ONEHUNDRED = new BigDecimal (100);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get RfQ Line Qty
|
* Get RfQ Line Qty
|
||||||
|
@ -114,7 +112,7 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
||||||
BigDecimal discount = getDiscount();
|
BigDecimal discount = getDiscount();
|
||||||
if (discount != null)
|
if (discount != null)
|
||||||
{
|
{
|
||||||
if (discount.abs().compareTo(ONEHUNDRED) > 0)
|
if (discount.abs().compareTo(Env.ONEHUNDRED) > 0)
|
||||||
{
|
{
|
||||||
log.warning("Discount > 100 - " + discount);
|
log.warning("Discount > 100 - " + discount);
|
||||||
return false;
|
return false;
|
||||||
|
@ -149,8 +147,8 @@ public class MRfQResponseLineQty extends X_C_RfQResponseLineQty implements Compa
|
||||||
return price;
|
return price;
|
||||||
// Calculate
|
// Calculate
|
||||||
// double result = price.doubleValue() * (100.0 - discount.doubleValue()) / 100.0;
|
// double result = price.doubleValue() * (100.0 - discount.doubleValue()) / 100.0;
|
||||||
BigDecimal factor = ONEHUNDRED.subtract(discount);
|
BigDecimal factor = Env.ONEHUNDRED.subtract(discount);
|
||||||
return price.multiply(factor).divide(ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
return price.multiply(factor).divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
} // getNetAmt
|
} // getNetAmt
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,6 @@ public class MTax extends X_C_Tax
|
||||||
/** Cache of Client */
|
/** Cache of Client */
|
||||||
private static CCache<Integer,MTax[]> s_cacheAll = new CCache<Integer,MTax[]>(Table_Name, Table_Name+"_Of_Client", 5);
|
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 */
|
/** Child Taxes */
|
||||||
private MTax[] m_childTaxes = null;
|
private MTax[] m_childTaxes = null;
|
||||||
/** Postal Codes */
|
/** Postal Codes */
|
||||||
|
@ -258,7 +256,7 @@ public class MTax extends X_C_Tax
|
||||||
if (isZeroTax())
|
if (isZeroTax())
|
||||||
return Env.ZERO;
|
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;
|
BigDecimal tax = null;
|
||||||
if (!taxIncluded) // $100 * 6 / 100 == $6 == $100 * 0.06
|
if (!taxIncluded) // $100 * 6 / 100 == $6 == $100 * 0.06
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class BankTransfer extends SvrProcess
|
||||||
private int p_C_ConversionType_ID = 0; // Payment Conversion Type
|
private int p_C_ConversionType_ID = 0; // Payment Conversion Type
|
||||||
private int p_C_Charge_ID = 0; // Charge to be used as bridge
|
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_From_C_BankAccount_ID = 0; // Bank Account From
|
||||||
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
private int p_To_C_BankAccount_ID= 0; // Bank Account To
|
||||||
private Timestamp p_StatementDate = null; // Date Statement
|
private Timestamp p_StatementDate = null; // Date Statement
|
||||||
|
@ -116,7 +116,7 @@ public class BankTransfer extends SvrProcess
|
||||||
if (p_C_Charge_ID == 0)
|
if (p_C_Charge_ID == 0)
|
||||||
throw new AdempiereUserError ("Business Partner required");
|
throw new AdempiereUserError ("Business Partner required");
|
||||||
|
|
||||||
if (p_Amount.compareTo(new BigDecimal(0)) == 0)
|
if (p_Amount.signum() == 0)
|
||||||
throw new AdempiereUserError ("Amount required");
|
throw new AdempiereUserError ("Amount required");
|
||||||
|
|
||||||
// Login Date
|
// Login Date
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
package test.functional;
|
package test.functional;
|
||||||
|
|
||||||
import org.compiere.model.MProductPrice;
|
import org.compiere.model.MProductPrice;
|
||||||
|
|
||||||
import test.AdempiereTestCase;
|
import test.AdempiereTestCase;
|
||||||
|
|
||||||
public class MProductTest extends AdempiereTestCase {
|
public class MProductTest extends AdempiereTestCase {
|
||||||
|
@ -86,7 +87,7 @@ public class MProductTest extends AdempiereTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetBaseInfo() {
|
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;
|
int uom = 0;
|
||||||
uom = prodprice.getC_UOM_ID();
|
uom = prodprice.getC_UOM_ID();
|
||||||
assertTrue("UOM must be correct", uom == 100);
|
assertTrue("UOM must be correct", uom == 100);
|
||||||
|
|
|
@ -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());
|
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());
|
KeyNamePair uom = new KeyNamePair(u.get_ID(), u.getUOMSymbol());
|
||||||
line.add(uom); // 3 C_UOM_ID
|
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);
|
DefaultMutableTreeNode child = new DefaultMutableTreeNode(line);
|
||||||
parent.add(child);
|
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());
|
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());
|
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||||
line.add(uom); // 3 C_UOM_ID
|
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())
|
if(m_selected_id == bom.getM_ProductBOM_ID() || getM_Product_ID() == bom.getM_ProductBOM_ID())
|
||||||
dataBOM.add(line);
|
dataBOM.add(line);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.awt.event.MouseListener;
|
||||||
import java.awt.font.LineBreakMeasurer;
|
import java.awt.font.LineBreakMeasurer;
|
||||||
import java.awt.font.TextAttribute;
|
import java.awt.font.TextAttribute;
|
||||||
import java.awt.font.TextLayout;
|
import java.awt.font.TextLayout;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.AttributedCharacterIterator;
|
import java.text.AttributedCharacterIterator;
|
||||||
import java.text.AttributedString;
|
import java.text.AttributedString;
|
||||||
|
@ -391,7 +390,7 @@ public class VSchedulePanel extends JComponent implements MouseListener
|
||||||
ma.setS_Resource_ID(m_S_Resource_ID);
|
ma.setS_Resource_ID(m_S_Resource_ID);
|
||||||
ma.setAssignDateFrom(TimeUtil.getDayTime(TimeUtil.addDays(m_startDate, dayIndex),
|
ma.setAssignDateFrom(TimeUtil.getDayTime(TimeUtil.addDays(m_startDate, dayIndex),
|
||||||
m_timePanel.getTimeSlot(timeIndex).getStartTime()));
|
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);
|
VAssignmentDialog vad = new VAssignmentDialog (AEnv.getFrame(this), ma, false, m_createNew);
|
||||||
m_infoSchedule.mAssignmentCallback(vad.getMResourceAssignment());
|
m_infoSchedule.mAssignmentCallback(vad.getMResourceAssignment());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -717,7 +717,7 @@ public final class VNumber extends JComponent
|
||||||
DecimalFormat format, int displayType, String title, char operator)
|
DecimalFormat format, int displayType, String title, char operator)
|
||||||
{
|
{
|
||||||
if (log.isLoggable(Level.CONFIG)) log.config("Value=" + value);
|
if (log.isLoggable(Level.CONFIG)) log.config("Value=" + value);
|
||||||
BigDecimal startValue = BigDecimal.valueOf(0.0);
|
BigDecimal startValue = Env.ZERO;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (value != null && value.length() > 0)
|
if (value != null && value.length() > 0)
|
||||||
|
|
|
@ -569,7 +569,7 @@ public class SubOrder extends PosSubPanel
|
||||||
if (p_posPanel != null && p_posPanel.f_curLine != null)
|
if (p_posPanel != null && p_posPanel.f_curLine != null)
|
||||||
{
|
{
|
||||||
MOrder order = p_posPanel.f_curLine.getOrder();
|
MOrder order = p_posPanel.f_curLine.getOrder();
|
||||||
BigDecimal total = new BigDecimal(0);
|
BigDecimal total = Env.ZERO;
|
||||||
if (order != null)
|
if (order != null)
|
||||||
total = order.getGrandTotal();
|
total = order.getGrandTotal();
|
||||||
paid = given.doubleValue() >= total.doubleValue();
|
paid = given.doubleValue() >= total.doubleValue();
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
|
||||||
|
|
||||||
Label lblProduct = new Label(Msg.translate(Env.getCtx(), "M_Product_ID"));
|
Label lblProduct = new Label(Msg.translate(Env.getCtx(), "M_Product_ID"));
|
||||||
Label lblQty = new Label(Msg.translate(Env.getCtx(), "Qty"));
|
Label lblQty = new Label(Msg.translate(Env.getCtx(), "Qty"));
|
||||||
productQty.setValue(new BigDecimal(1));
|
productQty.setValue(Env.ONE);
|
||||||
productField.addEventListener(Events.ON_SELECT, this);
|
productField.addEventListener(Events.ON_SELECT, this);
|
||||||
productQty.addEventListener(Events.ON_CHANGE, this);
|
productQty.addEventListener(Events.ON_CHANGE, this);
|
||||||
|
|
||||||
|
|
|
@ -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());
|
MUOM u = new MUOM(product.getCtx(), product.getC_UOM_ID(), product.get_TrxName());
|
||||||
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||||
line.add(uom); // 3 C_UOM_ID
|
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
|
// dummy root node, as first node is not displayed in tree
|
||||||
mySimpleTreeNode parent = new mySimpleTreeNode("Root",new ArrayList<TreeNode<Object>>());
|
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());
|
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());
|
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||||
line.add(uom); // 3 C_UOM_ID
|
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>>());
|
mySimpleTreeNode child = new mySimpleTreeNode(line,new ArrayList<TreeNode<Object>>());
|
||||||
if (!reload)
|
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());
|
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());
|
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
|
||||||
line.add(uom); // 3 C_UOM_ID
|
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())
|
if(m_selected_id == bom.getM_ProductBOM_ID() || getM_Product_ID() == bom.getM_ProductBOM_ID())
|
||||||
dataBOM.add(line);
|
dataBOM.add(line);
|
||||||
|
|
|
@ -341,7 +341,7 @@ public abstract class StatementCreateFromBatch extends CreateFromForm
|
||||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||||
{
|
{
|
||||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||||
BigDecimal total = new BigDecimal(0);
|
BigDecimal total = Env.ZERO;
|
||||||
int rows = miniTable.getRowCount();
|
int rows = miniTable.getRowCount();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(int i = 0; i < rows; i++)
|
for(int i = 0; i < rows; i++)
|
||||||
|
|
|
@ -166,7 +166,7 @@ public abstract class CreateFromBatch extends CreateFrom
|
||||||
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
public void info(IMiniTable miniTable, IStatusBar statusBar)
|
||||||
{
|
{
|
||||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||||
BigDecimal total = new BigDecimal(0);
|
BigDecimal total = Env.ZERO;
|
||||||
int rows = miniTable.getRowCount();
|
int rows = miniTable.getRowCount();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(int i = 0; i < rows; i++)
|
for(int i = 0; i < rows; i++)
|
||||||
|
|
Loading…
Reference in New Issue