public static final String getFormattedDuration(final long duration) { if (duration == 0) { return ""; } final BigDecimal hours = new BigDecimal(duration).divide(new BigDecimal(1000 * 60 * 60), 2, BigDecimal.ROUND_HALF_UP); return NumberHelper.formatFraction2(hours); }
@Override public String getVacationCount(final int fromYear, final int fromMonth, final int toYear, final int toMonth, final PFUserDO user) { long hours = 0; BigDecimal days = BigDecimal.ZERO; if (fromYear == toYear) { for (int i = fromMonth; i <= toMonth; i++) { MonthlyEmployeeReport reportOfMonth = employeeService.getReportOfMonth(fromYear, i, user); hours += reportOfMonth.getTotalNetDuration(); days = days.add(reportOfMonth.getNumberOfWorkingDays()); } } else { for (int i = fromMonth; i <= 11; i++) { MonthlyEmployeeReport reportOfMonth = employeeService.getReportOfMonth(fromYear, i, user); hours += reportOfMonth.getTotalNetDuration(); days = days.add(reportOfMonth.getNumberOfWorkingDays()); } for (int i = 0; i <= toMonth; i++) { MonthlyEmployeeReport reportOfMonth = employeeService.getReportOfMonth(toYear, i, user); hours += reportOfMonth.getTotalNetDuration(); days = days.add(reportOfMonth.getNumberOfWorkingDays()); } } final BigDecimal big_hours = new BigDecimal(hours).divide(new BigDecimal(1000 * 60 * 60), 2, BigDecimal.ROUND_HALF_UP); return NumberHelper.formatFraction2(big_hours.doubleValue() / days.doubleValue()); }
buf.append(NumberHelper.formatFraction2(hours)).append(getString("calendar.unit.hour")).append(" ") .append(entry.getProjektNameOrStatus()); if (StringUtils.isNotBlank(entry.getDescription()) == true) {
heading += ": " + NumberHelper.formatFraction2(totalHours);