Example usage for java.lang Double sum

List of usage examples for java.lang Double sum

Introduction

In this page you can find the example usage for java.lang Double sum.

Prototype

public static double sum(double a, double b) 

Source Link

Document

Adds two double values together as per the + operator.

Usage

From source file:retsys.client.controller.CreditNoteController.java

public void addItem(ActionEvent event) {
    sno++;//from   w ww  .  ja  v  a 2s  .  com
    ObservableList<CreditNoteItem> list = creditNoteDetail.getItems();
    if (list == null) {
        list = FXCollections.observableArrayList();
    }
    Integer id = null;
    if (!creditNoteNo.getText().isEmpty()) {
        id = Integer.parseInt(creditNoteNo.getText());
    }
    CreditNoteItem item = new CreditNoteItem(name.getText(), Double.parseDouble(amount.getText()),
            Double.parseDouble(quantity.getText()), true);
    list.add(item);
    totalCredit.setText(Double.toString(Double.sum(Double.parseDouble(totalCredit.getText() + "0"),
            Double.parseDouble(amount.getText()) * Double.parseDouble(quantity.getText()))));
    creditNoteDetail.setItems(list);
}

From source file:org.egov.collection.service.CollectionReportHeadWiseService.java

public void rebateTotal(CollectionSummaryHeadWiseReport collectionSummaryHeadWiseReport,
        List<CollectionSummaryHeadWiseReport> rebateResultList) {
    for (final CollectionSummaryHeadWiseReport rebate : rebateResultList) {
        if (!rebate.getCashAmount().equals(new Double(0.0)))
            collectionSummaryHeadWiseReport.setTotalCashRebateAmount(Double
                    .sum(collectionSummaryHeadWiseReport.getTotalCashRebateAmount(), rebate.getCashAmount()));
        if (!rebate.getChequeddAmount().equals(new Double(0.0)))
            collectionSummaryHeadWiseReport.setTotalChequeddRebateAmount(
                    Double.sum(collectionSummaryHeadWiseReport.getTotalChequeddRebateAmount(),
                            rebate.getChequeddAmount()));
        if (!rebate.getCardAmount().equals(new Double(0.0)))
            collectionSummaryHeadWiseReport.setTotalCardRebateAmount(Double
                    .sum(collectionSummaryHeadWiseReport.getTotalCardRebateAmount(), rebate.getCardAmount()));
        if (!rebate.getOnlineAmount().equals(new Double(0.0)))
            collectionSummaryHeadWiseReport.setTotalOnlineRebateAmount(Double.sum(
                    collectionSummaryHeadWiseReport.getTotalOnlineRebateAmount(), rebate.getOnlineAmount()));
        if (!rebate.getTotalAmount().equals(new Double(0.0)))
            collectionSummaryHeadWiseReport.setTotalRebateAmount(Double
                    .sum(collectionSummaryHeadWiseReport.getTotalRebateAmount(), rebate.getTotalAmount()));
    }//from w  ww  .  j  a  v a  2s.  c o m
}

From source file:org.egov.collection.service.CollectionReportHeadWiseService.java

public List<CollectionSummaryHeadWiseReport> populateQueryResults(
        final List<CollectionSummaryHeadWiseReport> queryResults) {
    for (final CollectionSummaryHeadWiseReport collectionSummaryHeadWiseReport : queryResults) {
        if (collectionSummaryHeadWiseReport.getCashCount() == null)
            collectionSummaryHeadWiseReport.setCashCount("");
        if (collectionSummaryHeadWiseReport.getChequeddCount() == null)
            collectionSummaryHeadWiseReport.setChequeddCount("");
        if (collectionSummaryHeadWiseReport.getOnlineCount() == null)
            collectionSummaryHeadWiseReport.setOnlineCount("");
        if (collectionSummaryHeadWiseReport.getCardCount() == null)
            collectionSummaryHeadWiseReport.setCardCount("");
        if (collectionSummaryHeadWiseReport.getTotalReceiptCount() == null)
            collectionSummaryHeadWiseReport.setTotalReceiptCount("");
        if (collectionSummaryHeadWiseReport.getCashAmount() == null)
            collectionSummaryHeadWiseReport.setCashAmount(0.0);
        if (collectionSummaryHeadWiseReport.getChequeddAmount() == null)
            collectionSummaryHeadWiseReport.setChequeddAmount(0.0);
        if (collectionSummaryHeadWiseReport.getOnlineAmount() == null)
            collectionSummaryHeadWiseReport.setOnlineAmount(0.0);
        if (collectionSummaryHeadWiseReport.getCardAmount() == null)
            collectionSummaryHeadWiseReport.setCardAmount(0.0);
        collectionSummaryHeadWiseReport.getOnlineAmount();
        collectionSummaryHeadWiseReport/*from w w w.  j a  v a2 s . c  o  m*/
                .setTotalAmount(Double.sum(collectionSummaryHeadWiseReport.getCardAmount(),
                        Double.sum(collectionSummaryHeadWiseReport.getChequeddAmount(),
                                collectionSummaryHeadWiseReport.getCashAmount())));
    }
    return queryResults;
}