Package java.math

Examples of java.math.BigDecimal.movePointLeft()


        if (null != mapInOut.get("amount")) {
            String amount = (String) mapInOut.get("amount");
            BigDecimal amt = ZERO;
            try {
                amt = new BigDecimal(amount);
                amt = amt.movePointLeft(2);
            } catch (NumberFormatException e) {
                Debug.logError(e, module);
                return;
            }
View Full Code Here


    public BigDecimal getAmount(String amount) {
        if (amount == null) {
            return BigDecimal.ZERO;
        }
        BigDecimal amountBd = new BigDecimal(amount);
        return amountBd.movePointLeft(2);
    }

    public String getCurrency(String currency) {
        return "840"; // todo make this multi-currency
    }
View Full Code Here

                    Debug.logError("Invalid number for amount : " + amtStr, module);
                    pos.getOutput().print("Invalid Amount!");
                    input.clearInput();
                    throw new GeneralException();
                }
                amount = amount.movePointLeft(2); // convert to decimal
                Debug.log("Set amount / 100 : " + amount, module);
            } else {
                Debug.log("Amount is empty; assumption is full amount : " + trans.getTotalDue(), module);
                amount = trans.getTotalDue();
                if (amount.compareTo(BigDecimal.ZERO) <= 0) {
View Full Code Here

                try {
                    amount = new BigDecimal(value);
                } catch (NumberFormatException e) {
                }

                amount = amount.movePointLeft(2).negate();
                trans.addDiscount(null, amount, percent);
                trans.calcTax();
            }
        }
        pos.refresh();
View Full Code Here

                try {
                    amount = new BigDecimal(value);
                } catch (NumberFormatException e) {
                }

                amount = amount.movePointLeft(2).negate();
                trans.addDiscount(sku, amount, percent);
                trans.calcTax();
            }
        }
        pos.refresh();
View Full Code Here

    } else { /* Large positive number: 0x22, E, M */
      dst.put(POS_LARGE);
    }

    // normalize abs(val) to determine E
    while (abs.compareTo(E32) >= 0 && e <= 350) { abs = abs.movePointLeft(32); e +=16; }
    while (abs.compareTo(E8) >= 0 && e <= 350) { abs = abs.movePointLeft(8); e+= 4; }
    while (abs.compareTo(BigDecimal.ONE) >= 0 && e <= 350) { abs = abs.movePointLeft(2); e++; }

    // encode appropriate header byte and/or E value.
    if (e > 10) { /* large number, write out {~,}E */
 
View Full Code Here

      dst.put(POS_LARGE);
    }

    // normalize abs(val) to determine E
    while (abs.compareTo(E32) >= 0 && e <= 350) { abs = abs.movePointLeft(32); e +=16; }
    while (abs.compareTo(E8) >= 0 && e <= 350) { abs = abs.movePointLeft(8); e+= 4; }
    while (abs.compareTo(BigDecimal.ONE) >= 0 && e <= 350) { abs = abs.movePointLeft(2); e++; }

    // encode appropriate header byte and/or E value.
    if (e > 10) { /* large number, write out {~,}E */
      putVaruint64(dst, e, isNeg);
View Full Code Here

    }

    // normalize abs(val) to determine E
    while (abs.compareTo(E32) >= 0 && e <= 350) { abs = abs.movePointLeft(32); e +=16; }
    while (abs.compareTo(E8) >= 0 && e <= 350) { abs = abs.movePointLeft(8); e+= 4; }
    while (abs.compareTo(BigDecimal.ONE) >= 0 && e <= 350) { abs = abs.movePointLeft(2); e++; }

    // encode appropriate header byte and/or E value.
    if (e > 10) { /* large number, write out {~,}E */
      putVaruint64(dst, e, isNeg);
    } else {
View Full Code Here

                parsed = true;
            } catch (NumberFormatException e) {
            }

            if (parsed) {
                price = price.movePointLeft(2);
                trans.modifyPrice(sku, price);

                // re-calc tax
                trans.calcTax();
            }
View Full Code Here

                BigDecimal amt = ZERO;
                String amountStr = input.value();
                if (UtilValidate.isNotEmpty(amountStr)) {
                    try {
                        amt = new BigDecimal(amountStr);
                        amt = amt.movePointLeft(2);
                    } catch (NumberFormatException e)
                    {
                        Debug.logError(e, module);
                    }
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.