weitere optimierung

This commit is contained in:
Ralph Soika 2024-11-24 15:50:30 +01:00
parent 2e66c68e40
commit 20c3410489
2 changed files with 28 additions and 2 deletions

View file

@ -393,12 +393,13 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
column = 1; column = 1;
double kwTotalEUR = 0; double kwTotalEUR = 0;
double kwTotalUSD = 0; double kwTotalUSD = 0;
WeekInvoiceData weekDataTotal = weekDataMap.get("TOTAL/" + week);
for (String name : spaceNames) { for (String name : spaceNames) {
String key = name + "/" + week; String key = name + "/" + week;
logger.info("search WeekInvoiceData for " + key); logger.info("search WeekInvoiceData for " + key);
// list of invoices // list of invoices
WeekInvoiceData weekData = weekDataMap.get(key); WeekInvoiceData weekData = weekDataMap.get(key);
if (weekData != null) { if (weekData != null) {
// logger.fine(" " + currency1 + "=" + weekData.totalCurrency1 + " " + currency2 // logger.fine(" " + currency1 + "=" + weekData.totalCurrency1 + " " + currency2
// + "=" // + "="
@ -414,8 +415,12 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
} else { } else {
totalDataMapFaellig.get(name).add(betrag, currency); totalDataMapFaellig.get(name).add(betrag, currency);
} }
weekDataTotal.add(betrag, currency);
column++; column++;
} }
// row.getCell(column).setCellValue(weekData.totalCurrency1); // row.getCell(column).setCellValue(weekData.totalCurrency1);
// column++; // column++;
// row.getCell(column).setCellValue(weekData.totalCurrency2); // row.getCell(column).setCellValue(weekData.totalCurrency2);
@ -450,6 +455,12 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
} }
} }
// KW Summe anzeigen // KW Summe anzeigen
for (String currency : currencyList) {
row.getCell(column).setCellValue(weekDataTotal.getTotal(currency));
column++;
}
// if (week.equals(currentWeekCategory)) { // if (week.equals(currentWeekCategory)) {
// XSSFCell kwTotalCell = row.getCell(column); // XSSFCell kwTotalCell = row.getCell(column);
// // kwTotalCell.copyCellFrom(cellKWTotalReference, new CellCopyPolicy()); // // kwTotalCell.copyCellFrom(cellKWTotalReference, new CellCopyPolicy());
@ -545,9 +556,10 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
// totalCell.setCellValue(totalsUeberfaelligCurrency2.get("TOTAL") + // totalCell.setCellValue(totalsUeberfaelligCurrency2.get("TOTAL") +
// totalsFaelligCurrency2.get("TOTAL")); // totalsFaelligCurrency2.get("TOTAL"));
// delete placeholder rows // delete placeholder rows (Never change these lines)
sheet.shiftRows(_rowNo, _rowNo + 3, -1); sheet.shiftRows(_rowNo, _rowNo + 3, -1);
sheet.shiftRows(_rowNo - 1, _rowNo - 1 + 3, -1); sheet.shiftRows(_rowNo - 1, _rowNo - 1 + 3, -1);
sheet.shiftRows(12, _rowNo + 3, -1);
logger.finest("......invoices added"); logger.finest("......invoices added");
} }
@ -593,6 +605,11 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
if (weekData == null) { if (weekData == null) {
weekData = new WeekInvoiceData(spaceName, weekCategory); weekData = new WeekInvoiceData(spaceName, weekCategory);
} }
WeekInvoiceData weekDataTotal = weekDataCache.get("TOTAL/" + weekCategory);
if (weekDataTotal == null) {
weekDataTotal = new WeekInvoiceData("TOTAL", weekCategory);
weekDataCache.put("TOTAL/" + weekCategory, weekDataTotal);
}
// Jetzt Rechnung addieren // Jetzt Rechnung addieren
weekData.add(invoice); weekData.add(invoice);
weekDataCache.put(key, weekData); weekDataCache.put(key, weekData);
@ -668,6 +685,15 @@ class WeekInvoiceData {
totals.put(currency, InvoiceUtil.round(totalCurrency)); totals.put(currency, InvoiceUtil.round(totalCurrency));
} }
public void add(double total, String currency) {
Double totalCurrency = totals.get(currency);
if (totalCurrency == null) {
totalCurrency = 0.0;
}
totalCurrency = totalCurrency + total;
totals.put(currency, InvoiceUtil.round(totalCurrency));
}
public double getTotal(String currency) { public double getTotal(String currency) {
Double result = totals.get(currency); Double result = totals.get(currency);
if (result != null) { if (result != null) {

Binary file not shown.