This commit is contained in:
Ralph Soika 2024-07-10 16:24:52 +02:00
parent 59e195ff1e
commit 40e971e584
6 changed files with 74 additions and 9 deletions

View file

@ -3,6 +3,21 @@
### 1.2.21 (Development) ### 1.2.21 (Development)
- Beim XML Invoice Import wird nun auch die Sprache für das Mahnwesen ermittelt (fehlte) - 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 ### 1.2.20

View file

@ -12,6 +12,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.inject.Inject; import javax.inject.Inject;
import org.apache.poi.ss.usermodel.CellCopyPolicy; 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.AdapterException;
import org.imixs.workflow.exceptions.PluginException; import org.imixs.workflow.exceptions.PluginException;
import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.exceptions.QueryException;
import org.imixs.workflow.office.config.ConfigService;
import org.imixs.workflow.poi.POIFindReplaceAdapter; import org.imixs.workflow.poi.POIFindReplaceAdapter;
/** /**
@ -73,6 +75,9 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
@Inject @Inject
SnapshotService snapshotService; SnapshotService snapshotService;
@EJB
ConfigService configService;
/** /**
* This method finds or create the Zahlungsavis and adds a reference * This method finds or create the Zahlungsavis and adds a reference
* ($workitemref) to the current invoice. * ($workitemref) to the current invoice.
@ -84,6 +89,12 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
public ItemCollection execute(ItemCollection document, ItemCollection event) public ItemCollection execute(ItemCollection document, ItemCollection event)
throws AdapterException, PluginException { throws AdapterException, PluginException {
// ermittle die Hauptwährungen
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
List<String> currencyList = configItemCollection.getItemValue("currency.out");
String currency1 = currencyList.get(0);
String currency2 = currencyList.get(1);
// read the zahlungsavis options // read the zahlungsavis options
ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "opliste", document, false); ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "opliste", document, false);
if (evalItemCollection == null) { if (evalItemCollection == null) {
@ -115,7 +126,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
// now we add separate lines for each invoice.... // now we add separate lines for each invoice....
logger.info("... insert invoices - filter=" + filter); logger.info("... insert invoices - filter=" + filter);
insertInvoiceRows(document, targetName, filter); insertInvoiceRows(document, targetName, filter, currency1, currency2);
} catch (PluginException | IOException | QueryException e) { } catch (PluginException | IOException | QueryException e) {
throw new PluginException(OPListExportAdapter.class.getSimpleName(), ERROR_CONFIG, throw new PluginException(OPListExportAdapter.class.getSimpleName(), ERROR_CONFIG,
"failed to update op-liste: " + e.getMessage()); "failed to update op-liste: " + e.getMessage());
@ -136,7 +147,8 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
* @throws PluginException * @throws PluginException
* @throws QueryException * @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 { throws PluginException, QueryException {
double saldoUSD = 0; double saldoUSD = 0;
@ -155,6 +167,10 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
doc = new XSSFWorkbook(imputStream); doc = new XSSFWorkbook(imputStream);
// NOTE: we only take the first sheet ! // NOTE: we only take the first sheet !
XSSFSheet sheet = doc.getSheetAt(0); 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"); CellReference categoryRefCell = new CellReference("A12");
XSSFRow referenceRowCategory = sheet.getRow(categoryRefCell.getRow()); XSSFRow referenceRowCategory = sheet.getRow(categoryRefCell.getRow());
CellReference invoiceRefCell = new CellReference("A13"); CellReference invoiceRefCell = new CellReference("A13");
@ -190,9 +206,8 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
double catSumEUR = 0; double catSumEUR = 0;
double catSumUSD = 0; double catSumUSD = 0;
for (ItemCollection invoice : invoices) { for (ItemCollection invoice : invoices) {
if ("EUR".equals(invoice.getItemValueString("invoice.currency"))) { if (currency1.equals(invoice.getItemValueString("invoice.currency"))) {
catSumEUR = catSumEUR + invoice.getItemValueDouble("invoice.saldo"); catSumEUR = catSumEUR + invoice.getItemValueDouble("invoice.saldo");
} else { } else {
catSumUSD = catSumUSD + invoice.getItemValueDouble("invoice.saldo"); catSumUSD = catSumUSD + invoice.getItemValueDouble("invoice.saldo");
} }
@ -220,7 +235,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
row.getCell(5).setCellValue(invoice.getItemValueDate("invoice.duedate")); row.getCell(5).setCellValue(invoice.getItemValueDate("invoice.duedate"));
double total = invoice.getItemValueDouble("invoice.saldo"); double total = invoice.getItemValueDouble("invoice.saldo");
String currency = invoice.getItemValueString("invoice.currency"); String currency = invoice.getItemValueString("invoice.currency");
if ("EUR".equals(currency)) { if (currency1.equals(currency)) {
// EUR // EUR
row.getCell(6).setCellValue(total); row.getCell(6).setCellValue(total);
row.getCell(7).setCellValue(currency); row.getCell(7).setCellValue(currency);
@ -244,10 +259,15 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
sheet.shiftRows(referenceRowPos, lastRow + totalRowCount, -1, true, true); sheet.shiftRows(referenceRowPos, lastRow + totalRowCount, -1, true, true);
// finally update the total formula... // finally update the total formula...
XSSFCell cTotalEUR = getCellByRef(doc, sheet, "TOTALEUR"); XSSFCell cTotal1 = getCellByRef(doc, sheet, "TOTAL1");
XSSFCell cTotalUSD = getCellByRef(doc, sheet, "TOTALUSD"); XSSFCell cTotal2 = getCellByRef(doc, sheet, "TOTAL2");
cTotalEUR.setCellValue(saldoEUR); cTotal1.setCellValue(saldoEUR);
cTotalUSD.setCellValue(saldoUSD); 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 // write back the file
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

View file

@ -0,0 +1,15 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<ui:fragment rendered="#{!readonly}">
<h:selectOneMenu required="#{required?validationController.required:false}" value="#{workitem.item[itemname]}">
<f:selectItems value="#{aglConfigController.getSelectItems('currency.in')}" />
</h:selectOneMenu>
</ui:fragment>
<ui:fragment rendered="#{readonly}">
<h:outputText value="#{workitem.item[itemname]}" />
</ui:fragment>
</ui:composition>

View file

@ -0,0 +1,14 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<ui:fragment rendered="#{!readonly}">
<h:selectOneMenu required="#{required?validationController.required:false}" value="#{workitem.item[item.name]}">
<f:selectItems value="#{aglConfigController.getSelectItems('currency.out')}" />
</h:selectOneMenu>
</ui:fragment>
<ui:fragment rendered="#{readonly}">
<h:outputText value="#{workitem.item[item.name]}" />
</ui:fragment>
</ui:composition>

View file

@ -0,0 +1 @@
,rsoika,ralpus-framework,10.07.2024 16:16,file:///home/rsoika/.config/libreoffice/4;

Binary file not shown.