Example usage for java.math BigDecimal add

List of usage examples for java.math BigDecimal add

Introduction

In this page you can find the example usage for java.math BigDecimal add.

Prototype

public BigDecimal add(BigDecimal augend) 

Source Link

Document

Returns a BigDecimal whose value is (this + augend) , and whose scale is max(this.scale(), augend.scale()) .

Usage

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getLegalInvTotalFNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                amount = amount.add(legalInvs[i].getInvoiceAdminFee());
            }//w ww . j a  va  2s .c om
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getLegalInvTotalSNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                amount = amount.add(legalInvs[i].getInvSecondNoticeAdminFee());
            }// w  ww.  ja va  2s  .c o m
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getFirstInvTotalTollDue() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(firstInvs)) {
        for (int i = 0; i < firstInvs.length; i++) {
            if ("N".equals(firstInvs[i].getPaidIndicator())) {
                amount = amount.add(firstInvs[i].getAmount()).subtract(firstInvs[i].getInvoiceAdminFee())
                        .subtract(firstInvs[i].getAdjustedTxnFees())
                        .subtract(firstInvs[i].getInvSecondNoticeAdminFee());
            }/*from w  w w  . j  a v  a 2s  . c o  m*/
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getSecondInvTotalUnPaidAmount() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(secondInvs)) {
        for (int i = 0; i < secondInvs.length; i++) {
            if ("N".equals(secondInvs[i].getPaidIndicator())) {
                amount = amount.add(secondInvs[i].getAmount());
            }//w ww  .ja v a  2  s  .co  m
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getSecondInvTotalTXNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(secondInvs)) {
        for (int i = 0; i < secondInvs.length; i++) {
            if ("N".equals(secondInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getAdjustedTxnFees()));
            }//from w w w  .  j  av  a 2s .  c o  m
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getSecondInvTotalFNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(secondInvs)) {
        for (int i = 0; i < secondInvs.length; i++) {
            if ("N".equals(secondInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getInvoiceAdminFee()));
            }// w  w  w .  j a v a  2 s  . c om
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getSecondInvTotalSNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(secondInvs)) {
        for (int i = 0; i < secondInvs.length; i++) {
            if ("N".equals(secondInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(secondInvs[i].getInvSecondNoticeAdminFee()));
            }/*from w  w w  .  j  a v a2 s.c o  m*/
        }
    }
    return amount;
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getLegalInvTotalTollDue() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(legalInvs)) {
        for (int i = 0; i < legalInvs.length; i++) {
            if ("N".equals(legalInvs[i].getPaidIndicator())) {
                amount = amount.add(legalInvs[i].getAmount()).subtract(legalInvs[i].getInvoiceAdminFee())
                        .subtract(legalInvs[i].getAdjustedTxnFees())
                        .subtract(legalInvs[i].getInvSecondNoticeAdminFee());
                ;// w  ww . j  a  v  a 2  s  .  com
            }
        }
    }
    return amount;
}

From source file:net.shopxx.service.impl.ShippingMethodServiceImpl.java

@Transactional(readOnly = true)
public BigDecimal calculateFreight(ShippingMethod shippingMethod, Area area, Integer weight) {
    Assert.notNull(shippingMethod);/*w w  w  .java2  s. c om*/

    Setting setting = SystemUtils.getSetting();
    BigDecimal firstPrice = shippingMethod.getDefaultFirstPrice();
    BigDecimal continuePrice = shippingMethod.getDefaultContinuePrice();
    if (area != null && CollectionUtils.isNotEmpty(shippingMethod.getFreightConfigs())) {
        List<Area> areas = new ArrayList<Area>();
        areas.addAll(area.getParents());
        areas.add(area);
        for (int i = areas.size() - 1; i >= 0; i--) {
            FreightConfig freightConfig = shippingMethod.getFreightConfig(areas.get(i));
            if (freightConfig != null) {
                firstPrice = freightConfig.getFirstPrice();
                continuePrice = freightConfig.getContinuePrice();
                break;
            }
        }
    }
    if (weight == null || weight <= shippingMethod.getFirstWeight()
            || continuePrice.compareTo(BigDecimal.ZERO) == 0) {
        return setting.setScale(firstPrice);
    } else {
        double contiuneWeightCount = Math
                .ceil((weight - shippingMethod.getFirstWeight()) / (double) shippingMethod.getContinueWeight());
        return setting.setScale(
                firstPrice.add(continuePrice.multiply(new BigDecimal(String.valueOf(contiuneWeightCount)))));
    }
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getSecondInvTotalTollDue() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(secondInvs)) {
        for (int i = 0; i < secondInvs.length; i++) {
            if ("N".equals(secondInvs[i].getPaidIndicator())) {
                amount = amount.add(secondInvs[i].getAmount()).subtract(secondInvs[i].getInvoiceAdminFee())
                        .subtract(secondInvs[i].getAdjustedTxnFees())
                        .subtract(secondInvs[i].getInvSecondNoticeAdminFee());
            }//from w w w  .j  av  a2  s  .  com
        }
    }
    return amount;
}