diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticExcelAdapterDebitor.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticExcelAdapterDebitor.java index 04b50ed..692148b 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticExcelAdapterDebitor.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticExcelAdapterDebitor.java @@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.CellCopyPolicy; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -126,7 +127,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter { // first add the columns for the currency list addCurrencyColumns(doc, sheet, currencyList); - + // add rows insertInvoiceRows(sheet, document, currencyList); // write back the updated excel file @@ -154,23 +155,8 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter { } } - // Process POI instructions - // processPOIUpdate(document, event, targetName); - // // read the config - // ItemCollection poiConfig = workflowService.evalWorkflowResult(event, - // "poi-update", document, - // false); - // if (poiConfig == null || !poiConfig.hasItem("findreplace")) { - // throw new PluginException(POIFindReplaceAdapter.class.getSimpleName(), - // CONFIG_ERROR, - // "missing poi configuration"); - // } - // List replaceDevList = poiConfig.getItemValue("findreplace"); - // String eval = poiConfig.getItemValueString("eval"); - - // logger.info("... update template with normal poi information.."); - // this.updateFileData(document.getFileData(targetName), document, - // replaceDevList, eval); + // Finally process POI instructions + processPOIUpdate(document, event, targetName); } catch (PluginException e) { throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), @@ -261,7 +247,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter { // jetzt füge alle Rechnungen an. int totalRowCount = invoices.size(); - POIUtil.insertRows(sheet, "A11", totalRowCount); + POIUtil.insertRows(sheet, "A11", totalRowCount - 0); for (ItemCollection invoice : invoices) { logger.fine("......add invoice " + invoice.getUniqueID()); @@ -297,6 +283,18 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter { rowPos++; } + // setze Summen Formeln + for (int column = 6; column < currencyList.size() * 2 + 6; column++) { + XSSFCell cell = sheet.getRow(totalRowCount + 11).getCell(column); // G11 + String cellRefFrom = POIUtil.getCellReference(column, 10); + String cellRefTo = POIUtil.getCellReference(column, totalRowCount + 10); + String formula = "SUM(" + cellRefFrom + ":" + cellRefTo + ")"; + cell.setCellFormula(formula); + } + + // Optional: Formel direkt evaluieren + XSSFFormulaEvaluator.evaluateAllFormulaCells(sheet.getWorkbook()); + } /** diff --git a/templates/soa_template.xlsx b/templates/soa_template.xlsx index 403f305..ddf2a38 100644 Binary files a/templates/soa_template.xlsx and b/templates/soa_template.xlsx differ diff --git a/workflow/analyse-debitor-de-1.0.0.bpmn b/workflow/analyse-debitor-de-1.0.0.bpmn index cfffce1..d782449 100644 --- a/workflow/analyse-debitor-de-1.0.0.bpmn +++ b/workflow/analyse-debitor-de-1.0.0.bpmn @@ -90,7 +90,6 @@ th { font-weight: bold;} DataObject_1 event_HrHS9A dataObject_00mX6w - event_n40tzw @@ -125,7 +124,6 @@ th { font-weight: bold;} SequenceFlow_10 sequenceFlow_OL83kQ sequenceFlow_1K0l0g - sequenceFlow_P2Q9fQ @@ -323,7 +321,15 @@ th { font-weight: bold;} soa_dbtr.number_$lasteventdate.xlsx - + + F6 + $lasteventdate + date + + + A7 + dbtr.name + ]]> @@ -364,84 +370,6 @@ th { font-weight: bold;} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - SOA Template - - soa_dbtr.number_$lasteventdate.xlsx - - - - - - - - -]]> - - - - - sequenceFlow_P2Q9fQ - - - - @@ -526,7 +454,7 @@ th { font-weight: bold;} - + @@ -545,18 +473,6 @@ th { font-weight: bold;} - - - - - - - - - - - -