diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 37923ad..e469bb5 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -3,6 +3,21 @@ ### 1.2.21 (Development) - Beim XML Invoice Import wird nun auch die Sprache für das Mahnwesen ermittelt (fehlte) + - Währungsunabhängigkeit + + +**Migration** + + 1. Paramter Pflegen + a) Währungen pflegen + - DE = EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD + - PL = PLN;EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD + - DWC = AED; EUR;CHF;SEK;RUB;NOK;GBP;USD;CAD + b) Mandant ID + + 2. OP Listen Template im Textbausteein aktualisieren + + 3. Alle Workflow Modelle erneuern ### 1.2.20 diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListExportAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListExportAdapter.java index 8ba2c41..628bda5 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListExportAdapter.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListExportAdapter.java @@ -12,6 +12,7 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; +import javax.ejb.EJB; import javax.inject.Inject; import org.apache.poi.ss.usermodel.CellCopyPolicy; @@ -28,6 +29,7 @@ import org.imixs.workflow.engine.WorkflowService; import org.imixs.workflow.exceptions.AdapterException; import org.imixs.workflow.exceptions.PluginException; import org.imixs.workflow.exceptions.QueryException; +import org.imixs.workflow.office.config.ConfigService; import org.imixs.workflow.poi.POIFindReplaceAdapter; /** @@ -73,6 +75,9 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { @Inject SnapshotService snapshotService; + @EJB + ConfigService configService; + /** * This method finds or create the Zahlungsavis and adds a reference * ($workitemref) to the current invoice. @@ -84,6 +89,12 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { public ItemCollection execute(ItemCollection document, ItemCollection event) throws AdapterException, PluginException { + // ermittle die Hauptwährungen + ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION"); + List currencyList = configItemCollection.getItemValue("currency.out"); + String currency1 = currencyList.get(0); + String currency2 = currencyList.get(1); + // read the zahlungsavis options ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "opliste", document, false); if (evalItemCollection == null) { @@ -115,7 +126,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { // now we add separate lines for each invoice.... logger.info("... insert invoices - filter=" + filter); - insertInvoiceRows(document, targetName, filter); + insertInvoiceRows(document, targetName, filter, currency1, currency2); } catch (PluginException | IOException | QueryException e) { throw new PluginException(OPListExportAdapter.class.getSimpleName(), ERROR_CONFIG, "failed to update op-liste: " + e.getMessage()); @@ -136,7 +147,8 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { * @throws PluginException * @throws QueryException */ - private void insertInvoiceRows(ItemCollection document, String fileName, boolean filter) + private void insertInvoiceRows(ItemCollection document, String fileName, boolean filter, String currency1, + String currency2) throws PluginException, QueryException { double saldoUSD = 0; @@ -155,6 +167,10 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { doc = new XSSFWorkbook(imputStream); // NOTE: we only take the first sheet ! XSSFSheet sheet = doc.getSheetAt(0); + // Währungsüberschriften setzten + sheet.getRow(10).getCell(6).setCellValue(currency1); + sheet.getRow(10).getCell(8).setCellValue(currency2); + CellReference categoryRefCell = new CellReference("A12"); XSSFRow referenceRowCategory = sheet.getRow(categoryRefCell.getRow()); CellReference invoiceRefCell = new CellReference("A13"); @@ -190,9 +206,8 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { double catSumEUR = 0; double catSumUSD = 0; for (ItemCollection invoice : invoices) { - if ("EUR".equals(invoice.getItemValueString("invoice.currency"))) { + if (currency1.equals(invoice.getItemValueString("invoice.currency"))) { catSumEUR = catSumEUR + invoice.getItemValueDouble("invoice.saldo"); - } else { catSumUSD = catSumUSD + invoice.getItemValueDouble("invoice.saldo"); } @@ -220,7 +235,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { row.getCell(5).setCellValue(invoice.getItemValueDate("invoice.duedate")); double total = invoice.getItemValueDouble("invoice.saldo"); String currency = invoice.getItemValueString("invoice.currency"); - if ("EUR".equals(currency)) { + if (currency1.equals(currency)) { // EUR row.getCell(6).setCellValue(total); row.getCell(7).setCellValue(currency); @@ -244,10 +259,15 @@ public class OPListExportAdapter extends POIFindReplaceAdapter { sheet.shiftRows(referenceRowPos, lastRow + totalRowCount, -1, true, true); // finally update the total formula... - XSSFCell cTotalEUR = getCellByRef(doc, sheet, "TOTALEUR"); - XSSFCell cTotalUSD = getCellByRef(doc, sheet, "TOTALUSD"); - cTotalEUR.setCellValue(saldoEUR); - cTotalUSD.setCellValue(saldoUSD); + XSSFCell cTotal1 = getCellByRef(doc, sheet, "TOTAL1"); + XSSFCell cTotal2 = getCellByRef(doc, sheet, "TOTAL2"); + cTotal1.setCellValue(saldoEUR); + cTotal2.setCellValue(saldoUSD); + // Set währung + XSSFCell cTotalCurrency1 = getCellByRef(doc, sheet, "TOTAL_CURRENCY1"); + XSSFCell cTotalCurrency2 = getCellByRef(doc, sheet, "TOTAL_CURRENCY2"); + cTotalCurrency1.setCellValue(currency1); + cTotalCurrency2.setCellValue(currency2); // write back the file ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_in.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_in.xhtml new file mode 100644 index 0000000..c30624d --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_in.xhtml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_out.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_out.xhtml new file mode 100644 index 0000000..939e703 --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/currency_out.xhtml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/.~lock.op-liste_template.xlsx# b/templates/.~lock.op-liste_template.xlsx# new file mode 100644 index 0000000..40b26ea --- /dev/null +++ b/templates/.~lock.op-liste_template.xlsx# @@ -0,0 +1 @@ +,rsoika,ralpus-framework,10.07.2024 16:16,file:///home/rsoika/.config/libreoffice/4; \ No newline at end of file diff --git a/templates/op-liste_template.xlsx b/templates/op-liste_template.xlsx index a60024f..f17aa94 100644 Binary files a/templates/op-liste_template.xlsx and b/templates/op-liste_template.xlsx differ