List of usage examples for java.math BigDecimal add
public BigDecimal add(BigDecimal augend)
From source file:com.xumpy.thuisadmin.services.implementations.RekeningenSrvImpl.java
@Override @Transactional(value = "transactionManager") public RekeningBedragTotal findAllRekeningen() { RekeningBedragTotal rekeningBedragTotal = new RekeningBedragTotal(); List<? extends Rekeningen> rekeningen = rekeningenDao.findAllRekeningen(userInfo.getPersoon().getPk_id()); BigDecimal totaal = new BigDecimal(0); for (Rekeningen rekening : rekeningen) { totaal = totaal.add(rekening.getWaarde()); }/*www. j av a2 s .c om*/ rekeningBedragTotal.setTotaal(totaal); rekeningBedragTotal.setRekeningen(rekeningen); return rekeningBedragTotal; }
From source file:com.aoindustries.website.signup.SignupCustomizeServerActionHelper.java
/** * Gets the hardware monthly rate for the server, basic server + hardware options *//* www . j a v a 2 s . c o m*/ public static BigDecimal getHardwareMonthlyRate(AOServConnector rootConn, SignupCustomizeServerForm signupCustomizeServerForm, PackageDefinition packageDefinition) throws IOException, SQLException { BigDecimal monthlyRate = packageDefinition.getMonthlyRate(); // Add the power option int powerOption = signupCustomizeServerForm.getPowerOption(); if (powerOption != -1) { PackageDefinitionLimit powerPDL = rootConn.getPackageDefinitionLimits().get(powerOption); int numPower = powerPDL.getHardLimit(); BigDecimal powerRate = powerPDL.getAdditionalRate(); if (powerRate != null) monthlyRate = monthlyRate.add(BigDecimal.valueOf(numPower).multiply(powerRate)); } // Add the cpu option PackageDefinitionLimit cpuPDL = rootConn.getPackageDefinitionLimits() .get(signupCustomizeServerForm.getCpuOption()); int numCpu = cpuPDL.getHardLimit(); BigDecimal cpuRate = cpuPDL.getAdditionalRate(); if (cpuRate != null) monthlyRate = monthlyRate.add(BigDecimal.valueOf(numCpu).multiply(cpuRate)); // Add the RAM option PackageDefinitionLimit ramPDL = rootConn.getPackageDefinitionLimits() .get(signupCustomizeServerForm.getRamOption()); int numRam = ramPDL.getHardLimit(); BigDecimal ramRate = ramPDL.getAdditionalRate(); if (ramRate != null) monthlyRate = monthlyRate.add(BigDecimal.valueOf(numRam).multiply(ramRate)); // Add the SATA controller option int sataControllerOption = signupCustomizeServerForm.getSataControllerOption(); if (sataControllerOption != -1) { PackageDefinitionLimit sataControllerPDL = rootConn.getPackageDefinitionLimits() .get(sataControllerOption); int numSataController = sataControllerPDL.getHardLimit(); BigDecimal sataControllerRate = sataControllerPDL.getAdditionalRate(); if (sataControllerRate != null) monthlyRate = monthlyRate.add(BigDecimal.valueOf(numSataController).multiply(sataControllerRate)); } // Add the SCSI controller option int scsiControllerOption = signupCustomizeServerForm.getScsiControllerOption(); if (scsiControllerOption != -1) { PackageDefinitionLimit scsiControllerPDL = rootConn.getPackageDefinitionLimits() .get(scsiControllerOption); int numScsiController = scsiControllerPDL.getHardLimit(); BigDecimal scsiControllerRate = scsiControllerPDL.getAdditionalRate(); if (scsiControllerRate != null) monthlyRate = monthlyRate.add(BigDecimal.valueOf(numScsiController).multiply(scsiControllerRate)); } // Add the disk options for (String pkey : signupCustomizeServerForm.getDiskOptions()) { if (pkey != null && pkey.length() > 0 && !pkey.equals("-1")) { PackageDefinitionLimit diskPDL = rootConn.getPackageDefinitionLimits().get(Integer.parseInt(pkey)); if (diskPDL != null) { BigDecimal diskRate = diskPDL.getAdditionalRate(); if (diskRate != null) monthlyRate = monthlyRate.add(diskRate); } } } return monthlyRate; }
From source file:org.marat.workflow.demo.task.CalculatePriceTask.java
private BigDecimal calculateTotalPrice(final TaskContext taskContext) { BigDecimal totalPrice = BigDecimal.ZERO; for (final BigDecimal price : taskContext.getPrices()) { totalPrice = totalPrice.add(price); }/* ww w. ja v a2s . c o m*/ return totalPrice; }
From source file:com.benfante.minimark.blo.ResultCalculationBo.java
private BigDecimal addQuestionMarkedWeight(QuestionFilling questionFilling, BigDecimal result) { result = result.add(calculateQuestionMarkedWeight(questionFilling)); return result; }
From source file:com.yimidida.shards.strategy.exit.impl.AggregateExitOperation.java
private BigDecimal getSum(List<Object> results, String fieldName) { BigDecimal sum = new BigDecimal(0.0); for (Object obj : results) { Number num = getNumber(obj, fieldName); sum = sum.add(new BigDecimal(num.toString())); }// ww w . ja v a 2 s . c o m return sum; }
From source file:ca.travelagency.salesstats.InvoicePaymentDistribution.java
public BigDecimal getAmount() { BigDecimal amount = MoneyUtils.ZERO_VALUE; for (InvoicePayment invoicePayment : getInvoicePayments()) { amount = amount.add(invoicePayment.getAmount()); }//from w w w. j a va 2 s . com return MoneyUtils.round(amount); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.scholarship.utl.report.StudentLine.java
private static BigDecimal calculateApprovedECTS(final Collection<Enrolment> list) { BigDecimal result = BigDecimal.ZERO; for (final CurriculumLine curriculumLine : list) { result = result.add(BigDecimal.valueOf(curriculumLine.getAprovedEctsCredits())); }/*from w w w. j a v a 2 s. c o m*/ return result; }
From source file:cn.bjfu.springdao.jpa.domain.order.Order.java
/** * Returns the total of the {@link Order}. * /*from w ww .j ava 2 s. c o m*/ * @return */ public BigDecimal getTotal() { BigDecimal total = BigDecimal.ZERO; for (LineItem item : lineItems) { total = total.add(item.getTotal()); } return total; }
From source file:milo.jersey.entities.Order.java
public BigDecimal getTotalAmount() { BigDecimal totalAmount = fee; for (Product product : products) { totalAmount = totalAmount.add(product.getPrice()); }/*from w w w . ja va2 s . c om*/ return totalAmount; }
From source file:no.dusken.annonseweb.control.InvoiceController.java
@RequestMapping("/print/blank/{invoice}") public String printInvoice(@PathVariable Invoice invoice, Model model) { BigDecimal tot = new BigDecimal(0); for (Sale s : invoice.getSales()) { for (Ad a : s.getAds()) { tot.add(a.getFinalPrice()); }//from w w w . j av a2 s.co m } model.addAttribute("invoice", invoice); model.addAttribute("total", tot.toPlainString()); return "invoice/print"; }