Package java.math

Examples of java.math.BigDecimal.multiply()


                    if (originalOrderItemQuantity.signum() != 0) {
                        if (adj.get("amount") != null) {
                            // pro-rate the amount
                            // set decimals = 100 means we don't round this intermediate value, which is very important
                            amount = adj.getBigDecimal("amount").divide(originalOrderItemQuantity, 100, ROUNDING);
                            amount = amount.multiply(billingQuantity);
                            // Tax needs to be rounded differently from other order adjustments
                            if (adj.getString("orderAdjustmentTypeId").equals("SALES_TAX")) {
                                amount = amount.setScale(TAX_DECIMALS, TAX_ROUNDING);
                            } else {
                                amount = amount.setScale(invoiceTypeDecimals, ROUNDING);
View Full Code Here


                    }

                    // prorate the adjustment amount by the returned amount; do not round ratio
                    BigDecimal ratio = quantity.divide(returnItem.getBigDecimal("returnQuantity"), 100, ROUNDING);
                    BigDecimal amount = adjustment.getBigDecimal("amount");
                    amount = amount.multiply(ratio).setScale(DECIMALS, ROUNDING);
                    if (Debug.verboseOn()) {
                        Debug.logVerbose("Creating Invoice Item with amount " + adjustment.getBigDecimal("amount") + " prorated to " + amount
                                + " for return adjustment [" + adjustment.getString("returnAdjustmentId") + "]", module);
                    }
View Full Code Here

            for (GenericValue paymentApplication : paymentApplications) {
                invoiceApplied = invoiceApplied.add(paymentApplication.getBigDecimal("amountApplied")).setScale(decimals,rounding);
            }
        }
        if (UtilValidate.isNotEmpty(invoiceApplied) && !actualCurrency) {
            invoiceApplied = invoiceApplied.multiply(getInvoiceCurrencyConversionRate(delegator, invoiceId)).setScale(decimals,rounding);
        }
        return invoiceApplied;
    }
    /**
     * Method to return the total amount of an invoice which is applied to a payment
View Full Code Here

            if (paymentApplication.get("paymentId") != null) {
                GenericValue payment = paymentApplication.getRelatedOne("Payment");
                if (paymentApplication.get("invoiceId") != null && payment.get("actualCurrencyAmount") != null && payment.get("actualCurrencyUomId") != null) {
                    GenericValue invoice = paymentApplication.getRelatedOne("Invoice");
                    if (payment.getString("actualCurrencyUomId").equals(invoice.getString("currencyUomId"))) {
                           appliedAmount = appliedAmount.multiply(payment.getBigDecimal("amount")).divide(payment.getBigDecimal("actualCurrencyAmount"),new MathContext(100));
                    }
                }
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, "Problem getting Payment", module);
View Full Code Here

                    BigDecimal amountApplied = paymentApplication.getBigDecimal("amountApplied");
                    // check currency invoice and if different convert amount applied for display
                    if (actual.equals(Boolean.FALSE) && paymentApplication.get("invoiceId") != null && payment.get("actualCurrencyAmount") != null && payment.get("actualCurrencyUomId") != null) {
                        GenericValue invoice = paymentApplication.getRelatedOne("Invoice");
                        if (payment.getString("actualCurrencyUomId").equals(invoice.getString("currencyUomId"))) {
                               amountApplied = amountApplied.multiply(payment.getBigDecimal("amount")).divide(payment.getBigDecimal("actualCurrencyAmount"),new MathContext(100));
                        }
                    }
                    paymentApplied = paymentApplied.add(amountApplied).setScale(decimals,rounding);
                }
            }
View Full Code Here

    private static Font setFontSize(String fontSize, BigDecimal multiply) {
        Font graphicsFont = null;
        BigDecimal baseSize = null;
        if (fontSize.equals("TEXT_SMALL")) {
            baseSize = new BigDecimal(24.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_MIDDLE")) {
            baseSize = new BigDecimal(36.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_LARGE")) {
            baseSize = new BigDecimal(48.00);
View Full Code Here

        if (fontSize.equals("TEXT_SMALL")) {
            baseSize = new BigDecimal(24.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_MIDDLE")) {
            baseSize = new BigDecimal(36.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_LARGE")) {
            baseSize = new BigDecimal(48.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_VERYLARGE")) {
            baseSize = new BigDecimal(60.00);
View Full Code Here

        } else if (fontSize.equals("TEXT_MIDDLE")) {
            baseSize = new BigDecimal(36.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_LARGE")) {
            baseSize = new BigDecimal(48.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_VERYLARGE")) {
            baseSize = new BigDecimal(60.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        }
        return graphicsFont;
View Full Code Here

        } else if (fontSize.equals("TEXT_LARGE")) {
            baseSize = new BigDecimal(48.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        } else if (fontSize.equals("TEXT_VERYLARGE")) {
            baseSize = new BigDecimal(60.00);
            graphicsFont = new Font( "Arial", Font.BOLD, baseSize.multiply(multiply).intValue());
        }
        return graphicsFont;
    }
}
View Full Code Here

            for(GenericValue item : returnItems) {
                BigDecimal quantity = item.getBigDecimal("returnQuantity");
                BigDecimal price = item.getBigDecimal("returnPrice");
                if (quantity == null) quantity = ZERO;
                if (price == null) price = ZERO;
                creditTotal = creditTotal.add(price.multiply(quantity).setScale(decimals, rounding));
            }

            // add the adjustments to the total
            creditTotal = creditTotal.add(adjustments.setScale(decimals, rounding));
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.