update op liste

This commit is contained in:
Ralph Soika 2024-11-21 11:55:53 +01:00
parent 566c32c94a
commit 4d2ce3527a
2 changed files with 39 additions and 14 deletions

View file

@ -272,6 +272,11 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
return;
}
sheet.shiftRows(rowPos, lastRow, totalRowCount, true, true);
Map<String, Double> currencyTotalSum = new HashMap();
for (String cur : currencyList) {
currencyTotalSum.put(cur, Double.valueOf(0));
}
// Build a category for each debitor...
for (Map.Entry<String, List<ItemCollection>> entry : invoiceMap.entrySet()) {
String dbtrNumber = entry.getKey();
@ -285,8 +290,23 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
String debitorName = invoices.get(0).getItemValueString("dbtr.name");
categoryRow.getCell(1).setCellValue(debitorName);
categoryRow.getCell(6).setCellValue(42);
categoryRow.getCell(8).setCellValue(42);
// calculate summ of all invoices for this debitor...
Map<String, Double> currencyCatSum = new HashMap();
for (String cur : currencyList) {
currencyCatSum.put(cur, Double.valueOf(0));
}
for (ItemCollection invoice : invoices) {
String currency = invoice.getItemValueString("invoice.currency");
Double saldo = currencyCatSum.get(currency);
saldo = InvoiceUtil.round(saldo + invoice.getItemValueDouble("invoice.saldo"));
currencyCatSum.put(currency, saldo);
}
int i = 0;
for (String cur : currencyList) {
i++;
Double catSum = currencyCatSum.get(cur);
categoryRow.getCell(4 + i).setCellValue(catSum);
}
rowPos++;
@ -324,17 +344,12 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
// Saldo in richtige Spalte setzen...
int currencyColIndex = currencyList.indexOf(currency);
row.getCell(5 + currencyColIndex).setCellValue(total);
// if (currency1.equals(currency)) {
// // EUR
// row.getCell(6).setCellValue(total);
// row.getCell(7).setCellValue(currency);
// saldo1 = InvoiceUtil.round(saldo1 + total);
// } else {
// // USD
// row.getCell(8).setCellValue(total);
// row.getCell(9).setCellValue(currency);
// saldo2 = InvoiceUtil.round(saldo2 + total);
// }
// Gesamtsumme berechnen
Double totalSaldo = currencyTotalSum.get(currency);
totalSaldo = InvoiceUtil.round(totalSaldo + total);
currencyTotalSum.put(currency, totalSaldo);
row.getCell(5 + currencyList.size()).setCellValue(invoice.getItemValueString("$workflowstatus"));
rowPos++;
@ -345,7 +360,17 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
rowPos++;
}
// delete reference row 11
sheet.shiftRows(referenceRowPos, lastRow + totalRowCount, -1, true, true);
// sheet.shiftRows(referenceRowPos, lastRow + totalRowCount, -3, true, true);
// sheet.shiftRows(rowPos, lastRow, -3, true, true);
// finally update the totals...
int i = 0;
XSSFRow totalRow = sheet.getRow(rowPos + 1);
for (String cur : currencyList) {
i++;
Double totalSum = currencyTotalSum.get(cur);
totalRow.getCell(4 + i).setCellValue(totalSum);
}
}

Binary file not shown.