List of usage examples for java.math BigDecimal add
public BigDecimal add(BigDecimal augend)
From source file:com.esd.cs.audit.AuditsController.java
/** * ??//from w ww . j ava 2s .c o m * * @param companyCode * @return */ private BigDecimal getSectionPaid(String year, Integer companyId, List<AccountModel> sb) { BigDecimal amount = new BigDecimal(0.00); // List<Accounts> audits = // accountsService.getUnauditByCompany(companyId, year, // Constants.PROCESS_STATIC_BFJK); List<Accounts> accounts = accountsService.getByYearAndCompany(year, companyId, Constants.PROCESS_STATIC_BFJK); Map<String, Accounts> map = new HashMap<>(); for (Accounts group : accounts) { Object obj = map.get(group.getYear()); if (obj == null) { map.put(group.getYear(), group); } else { Accounts a = (Accounts) obj; a.setTotalMoney(a.getTotalMoney().add(group.getTotalMoney())); } } for (Accounts a : map.values()) { BigDecimal paymentTotal = paymentService.getEffPaid(null, a.getYear(), companyId);// BigDecimal qj = a.getTotalMoney().subtract(paymentTotal); AuditParameter auditParameter = auditParameterService.getByYear(a.getYear()); Date auditDelayDate = auditParameter.getAuditDelayDate(); int days = CalendarUtil.getDaySub(auditDelayDate, new Date()); BigDecimal penalty = qj.multiply(auditParameter.getAuditDelayRate()).multiply(new BigDecimal(days)); BigDecimal total = qj.add(penalty); AccountModel am = new AccountModel(); am.setYear(a.getYear()); am.setDays(String.valueOf(days)); am.setMoney(df.format(qj)); am.setPenalty(df.format(penalty)); am.setProp(df4.format(auditParameter.getAuditDelayRate())); am.setTotal(df.format(total)); sb.add(am); amount = amount.add(total); } if (amount.compareTo(new BigDecimal(0.00)) != 0) { AccountModel am = new AccountModel(); am.setTotal(df.format(amount)); sb.add(am); } return amount; }
From source file:com.xumpy.thuisadmin.services.implementations.BedragenSrvImpl.java
public BigDecimal getTotalRekeningBedragen(List<? extends Bedragen> bedragen) { BigDecimal totaalRekeningen = new BigDecimal(0); List<Rekeningen> rekeningen = new ArrayList<Rekeningen>(); for (Bedragen bedrag : bedragen) { if (!rekeningen.contains(bedrag.getRekening())) { rekeningen.add(bedrag.getRekening()); }//from w ww . jav a 2 s .c om } for (Rekeningen rekening : rekeningen) { totaalRekeningen = totaalRekeningen.add(rekening.getWaarde()); } return totaalRekeningen; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.directiveCouncil.SummariesControlAction.java
private BigDecimal getNotTaughtSummaries(Professorship professorship, Shift shift, BigDecimal notTaughtSummaries, LocalDate oneWeekBeforeToday) { for (Summary summary : shift.getAssociatedSummariesSet()) { if (summary.getProfessorship() != null && summary.getProfessorship() == professorship && !summary.getIsExtraLesson() && !summary.getLessonInstance().getBeginDateTime().toLocalDate().isAfter(oneWeekBeforeToday)) { if (summary.getTaught() != null && summary.getTaught() == false) { notTaughtSummaries = notTaughtSummaries.add(BigDecimal.ONE); }/*from w w w .jav a2s . c o m*/ } } return notTaughtSummaries; }
From source file:com.dp2345.entity.Cart.java
/** * ?/*from www .java 2 s. c o m*/ * * @return */ @Transient public BigDecimal getDiscount() { BigDecimal originalPrice = new BigDecimal(0); BigDecimal currentPrice = new BigDecimal(0); for (Promotion promotion : getPromotions()) { if (promotion != null) { int promotionQuantity = getQuantity(promotion); BigDecimal originalPromotionPrice = getTempPrice(promotion); BigDecimal currentPromotionPrice = promotion.calculatePrice(promotionQuantity, originalPromotionPrice); originalPrice = originalPrice.add(originalPromotionPrice); currentPrice = currentPrice.add(currentPromotionPrice); Set<CartItem> cartItems = getCartItems(promotion); for (CartItem cartItem : cartItems) { if (cartItem != null && cartItem.getTempPrice() != null) { BigDecimal tempPrice; if (originalPromotionPrice.compareTo(new BigDecimal(0)) > 0) { tempPrice = currentPromotionPrice.divide(originalPromotionPrice, 50, RoundingMode.DOWN) .multiply(cartItem.getTempPrice()); } else { tempPrice = new BigDecimal(0); } cartItem.setTempPrice( tempPrice.compareTo(new BigDecimal(0)) > 0 ? tempPrice : new BigDecimal(0)); } } } } if (getCartItems() != null) { for (CartItem cartItem : getCartItems()) { if (cartItem != null) { cartItem.setTempPrice(null); } } } Setting setting = SettingUtils.get(); BigDecimal discount = setting.setScale(originalPrice.subtract(currentPrice)); return discount.compareTo(new BigDecimal(0)) > 0 ? discount : new BigDecimal(0); }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getInvoiceAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(invoices[i].getAmount()); }// w ww.j ava 2 s . c o m } return total; }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getInvoiceVeaAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getVeaAmount())); }//from w w w. ja v a 2 s . c om } return total; }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getInvoiceFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(invoices)) { for (int i = 0; i < invoices.length; i++) { total = total.add(BigDecimalUtil.nullSafe(invoices[i].getOnlineFee())); }//from w ww .j a va 2 s .com } return total; }
From source file:com.aimluck.eip.project.ProjectTaskSimpleSelectData.java
/** * ResultData???? <BR>/* w w w . jav a2 s . c o m*/ * * @param record * * @return ResultData */ @Override protected Object getResultData(EipTProjectTask record) { ProjectTaskResultData data = ProjectUtils.getProjectTaskResultData(record); Integer taskId = (int) data.getTaskId().getValue(); // ? int cntChild = ProjectUtils.getCountChildrenTask(taskId); // ??2??true // ?? data.setHasChildren(cntChild >= 2); // ? data.setHasChildrenForForm(cntChild > 0); // ? int lapsedDays = ProjectUtils.getLapsedDays(ProjectUtils.toString(record.getStartPlanDate()), ProjectUtils.toString(Calendar.getInstance().getTime())); // int taskDays = ProjectUtils.getLapsedDays(ProjectUtils.toString(record.getStartPlanDate()), ProjectUtils.toString(record.getEndPlanDate())); data.setPlanTerm(taskDays); if (lapsedDays > taskDays) { // ??? lapsedDays = taskDays; } // ? data.setPlanProgressRate(ProjectUtils.getPlanWorkload(lapsedDays, taskDays)); // List<ProjectTaskMemberResultData> memberList = data.getMemberList(); BigDecimal workload = BigDecimal.valueOf(0); workload = workload.setScale(1); for (int i = 0; i < memberList.size(); i++) { ProjectTaskMemberResultData member = memberList.get(i); workload = workload.add(member.getWorkload()); } data.setWorkload(workload); // BigDecimal forecastWorkload = BigDecimal.valueOf(0); if (data.getProgressRate().getValue() != 0) { forecastWorkload = workload.multiply(BigDecimal.valueOf(100)) .divide(BigDecimal.valueOf(data.getProgressRate().getValue()), 2, BigDecimal.ROUND_HALF_UP); } data.setForecastWorkload(forecastWorkload); // data.setIndentFlg(indentFlg); return data; }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getViolationAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { total = total.add(violations[i].getCashAmount()); }/*from w w w . jav a 2 s. co m*/ } return total; }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getViolationFeeAmount() { BigDecimal total = new BigDecimal(0.0); if (!ArrayUtils.isEmpty(violations)) { for (int i = 0; i < violations.length; i++) { total = total.add(BigDecimalUtil.nullSafe(violations[i].getOnlineFee())); }/*from w w w . ja v a 2 s.co m*/ } return total; }