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 getNttaTollTotalUnPaidInvAmount() {
    BigDecimal amount = new BigDecimal(0.0);
    if (!ArrayUtils.isEmpty(nttaTollInvs)) {
        for (int i = 0; i < nttaTollInvs.length; i++) {
            if ("N".equals(nttaTollInvs[i].getPaidIndicator())) {
                amount = amount.add(nttaTollInvs[i].getAmount());

            }//from   www  . j a v  a  2  s  .  co  m
        }
    }
    return amount;
}

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

public BigDecimal getCollectionInvTotalUnPaidAmount() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(collectionInvs)) {
        for (int i = 0; i < collectionInvs.length; i++) {
            if ("N".equals(collectionInvs[i].getPaidIndicator())) {
                amount = amount.add(collectionInvs[i].getAmount());
            }//from w ww  . j  ava  2  s. co m
        }
    }
    return amount;
}

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

public BigDecimal getCollectionInvTotalTXNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(collectionInvs)) {
        for (int i = 0; i < collectionInvs.length; i++) {
            if ("N".equals(collectionInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getAdjustedTxnFees()));
            }/*from   ww  w .ja v a2  s. c  om*/
        }
    }
    return amount;
}

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

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

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

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

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

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

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

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

From source file:com.autentia.intra.bean.account.AccountEntryBean.java

private void calcTotals(List<AccountEntry> res) {
    costs = new BigDecimal(0);
    incomes = new BigDecimal(0);

    costsType = new BigDecimal(0);
    incomesType = new BigDecimal(0);

    Hashtable mapaCajaTotales = new Hashtable();

    for (AccountEntry elem : res) {
        Integer accountAct = elem.getAccount().getId();
        BigDecimal accountValueAct = null;
        if (!mapaCajaTotales.containsKey(accountAct)) {
            mapaCajaTotales.put(accountAct, new BigDecimal(0));
        }/* ww w . j  a  v a  2  s  .c  o  m*/

        accountValueAct = (BigDecimal) mapaCajaTotales.get(accountAct);

        BigDecimal actual = elem.getAmount();
        BigDecimal resul = accountValueAct.add(actual);
        elem.setAmountAccountNow(resul);
        mapaCajaTotales.remove(accountAct);
        mapaCajaTotales.put(accountAct, resul);

        if (actual.signum() >= 0) {
            setIncomes(incomes.add(actual));
        } else {
            setCosts(costs.add(actual));
        }

        if (elem.getType().getGroup().getId() == ConfigurationUtil.getDefault().getCostId()) {
            setCostsType(costsType.add(actual));
        } else {
            setIncomesType(incomesType.add(actual));
        }
    }

    setTotal(incomes.add(costs));
    setTotalType(incomesType.add(costsType));
}

From source file:jgnash.ui.report.compiled.PayeePieChart.java

private PieDataset[] createPieDataSet(final Account a) {
    DefaultPieDataset[] returnValue = new DefaultPieDataset[2];
    returnValue[0] = new DefaultPieDataset();
    returnValue[1] = new DefaultPieDataset();

    if (a != null) {
        //System.out.print("Account = "); System.out.println(a);
        Map<String, BigDecimal> names = new HashMap<>();

        List<TranTuple> list = getTransactions(a, new ArrayList<>(), startField.getLocalDate(),
                endField.getLocalDate());

        CurrencyNode currency = a.getCurrencyNode();

        for (final TranTuple tranTuple : list) {

            Transaction tran = tranTuple.transaction;
            Account account = tranTuple.account;

            String payee = tran.getPayee();
            BigDecimal sum = tran.getAmount(account);

            sum = sum.multiply(account.getCurrencyNode().getExchangeRate(currency));

            //System.out.print("   Transaction = "); System.out.print(payee); System.out.print(" "); System.out.println(sum);

            if (useFilters.isSelected()) {
                for (String aFilterList : filterList) {

                    PayeeMatcher pm = new PayeeMatcher(aFilterList, false);

                    if (pm.matches(tran)) {
                        payee = aFilterList;
                        //System.out.println(filterList.get(i));
                        break;
                    }//from w w  w.  j av  a  2s .c  o  m
                }
            }

            if (names.containsKey(payee)) {
                sum = sum.add(names.get(payee));
            }

            names.put(payee, sum);
        }

        for (final Map.Entry<String, BigDecimal> entry : names.entrySet()) {
            BigDecimal value = entry.getValue();

            if (value.compareTo(BigDecimal.ZERO) == -1) {
                value = value.negate();
                returnValue[1].setValue(entry.getKey(), value);
            } else {
                returnValue[0].setValue(entry.getKey(), value);
            }
        }
    }
    return returnValue;
}

From source file:com.xumpy.thuisadmin.services.implementations.BedragenSrvImpl.java

@Override
@Transactional//from   w w  w.ja va 2  s. c  om
public OverzichtGroepBedragenTotal rapportOverzichtGroepBedragen(Integer typeGroepId, Date beginDate,
        Date eindDate, Integer showBedragPublicGroep, OverzichtGroepBedragenTotal overzichtGroepBedragenTotal) {
    List<? extends Bedragen> lstBedragenInPeriode = bedragenDao.BedragInPeriode(beginDate, eindDate, null,
            showBedragPublicGroep, userInfo.getPersoon().getPk_id());

    Groepen groepenSrv = groepenDao.findOne(typeGroepId);

    List<? extends Bedragen> lstBedragenNeg = getBedragenInGroep(lstBedragenInPeriode, groepenSrv, 1);
    List<? extends Bedragen> lstBedragenPos = getBedragenInGroep(lstBedragenInPeriode, groepenSrv, 0);

    List<OverzichtGroepBedragen> overzichtGroepBedragen = new ArrayList<OverzichtGroepBedragen>();

    BigDecimal somOverzicht = new BigDecimal(0);

    for (Bedragen bedrag : lstBedragenNeg) {
        OverzichtGroepBedragen overzichtGroepBedrag = new OverzichtGroepBedragen();

        BedragenSrvPojo bedragSrvPojo = new BedragenSrvPojo(bedrag);
        bedragSrvPojo.setBedrag(bedrag.getBedrag().multiply(new BigDecimal(-1)));
        overzichtGroepBedrag.setWithBedrag(bedragSrvPojo);

        overzichtGroepBedragen.add(overzichtGroepBedrag);
        somOverzicht = somOverzicht.add(bedragSrvPojo.getBedrag());
    }

    for (Bedragen bedrag : lstBedragenPos) {
        OverzichtGroepBedragen overzichtGroepBedrag = new OverzichtGroepBedragen();
        overzichtGroepBedrag.setWithBedrag(bedrag);

        overzichtGroepBedragen.add(overzichtGroepBedrag);
        somOverzicht = somOverzicht.add(bedrag.getBedrag());
    }

    overzichtGroepBedragenTotal.setSomBedrag(somOverzicht);
    overzichtGroepBedragenTotal.setOverzichtGroepBedragen(overzichtGroepBedragen);

    return overzichtGroepBedragenTotal;
}