final BigDecimal netDuration = new BigDecimal(report.getTotalNetDuration());
final Map<String, Kost2Row> rows = report.getKost2Rows();
BigDecimal sum = BigDecimal.ZERO;
int j = rows.size();
for (final Kost2Row row : rows.values()) {
final Kost2DO kost2 = row.getKost2();
final MonthlyEmployeeReportEntry entry = report.getKost2Durations().get(kost2.getId());
mapping.add(ExcelColumn.KOST1, kost1.getNummer());
mapping.add(ExcelColumn.MITARBEITER, user.getFullname());
mapping.add(ExcelColumn.KOST2, kost2.getNummer());
final BigDecimal duration = new BigDecimal(entry.getMillis() / 1000); // Seconds
// duration = duration.divide(new BigDecimal(60 * 60 * 24), 8, RoundingMode.HALF_UP); // Fraction of day (24 hours)
// mapping.add(ExcelColumn.STUNDEN, duration);
mapping.add(ExcelColumn.STUNDEN, duration.divide(new BigDecimal(3600), 2, RoundingMode.HALF_UP));
mapping.add(ExcelColumn.BEZEICHNUNG, kost2.getToolTip());
final BigDecimal betrag = CurrencyHelper.multiply(bruttoMitAGAnteil,
new BigDecimal(entry.getMillis()).divide(netDuration, 8, RoundingMode.HALF_UP));
sum = sum.add(betrag);
if (--j == 0) {
final BigDecimal korrektur = bruttoMitAGAnteil.subtract(sum);