refactoring multi currency
This commit is contained in:
parent
81549ab4e0
commit
a6f4b68fba
10 changed files with 113 additions and 81 deletions
|
|
@ -67,7 +67,7 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
WorkflowService workflowService;
|
WorkflowService workflowService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPListExportService opListExportService;
|
InvoiceService opListExportService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DocumentService documentService;
|
DocumentService documentService;
|
||||||
|
|
@ -90,12 +90,14 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
||||||
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
||||||
if (currencyList == null || currencyList.size() < 2) {
|
if (currencyList == null || currencyList.size() < 2) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
"missing Currency configuration - please check parameters");
|
"missing Currency configuration - please check parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the Steuerbescheide options
|
// read the Steuerbescheide options
|
||||||
ItemCollection steuerbescheideConfig = workflowService.evalWorkflowResult(event, "steuerbescheide", document,
|
ItemCollection steuerbescheideConfig = workflowService.evalWorkflowResult(event, "steuerbescheide",
|
||||||
|
document,
|
||||||
false);
|
false);
|
||||||
if (steuerbescheideConfig == null || !steuerbescheideConfig.hasItem("excel-export")) {
|
if (steuerbescheideConfig == null || !steuerbescheideConfig.hasItem("excel-export")) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), CONFIG_ERROR,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), CONFIG_ERROR,
|
||||||
|
|
@ -118,7 +120,8 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
logger.info("... loading poi configuration..");
|
logger.info("... loading poi configuration..");
|
||||||
// Process POI instructions
|
// Process POI instructions
|
||||||
// read the config
|
// read the config
|
||||||
ItemCollection poiConfig = workflowService.evalWorkflowResult(event, "poi-update", document, false);
|
ItemCollection poiConfig = workflowService.evalWorkflowResult(event, "poi-update", document,
|
||||||
|
false);
|
||||||
if (poiConfig == null || !poiConfig.hasItem("findreplace")) {
|
if (poiConfig == null || !poiConfig.hasItem("findreplace")) {
|
||||||
throw new PluginException(POIFindReplaceAdapter.class.getSimpleName(), CONFIG_ERROR,
|
throw new PluginException(POIFindReplaceAdapter.class.getSimpleName(), CONFIG_ERROR,
|
||||||
"missing poi configuration");
|
"missing poi configuration");
|
||||||
|
|
@ -130,7 +133,8 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
this.updateFileData(document.getFileData(targetName), document, replaceDevList, eval);
|
this.updateFileData(document.getFileData(targetName), document, replaceDevList, eval);
|
||||||
|
|
||||||
} catch (PluginException | IOException | QueryException e) {
|
} catch (PluginException | IOException | QueryException e) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update steuerbescheide: " + e.getMessage());
|
"failed to update steuerbescheide: " + e.getMessage());
|
||||||
}
|
}
|
||||||
logger.info("... completed!");
|
logger.info("... completed!");
|
||||||
|
|
@ -218,14 +222,16 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
doc.write(byteArrayOutputStream);
|
doc.write(byteArrayOutputStream);
|
||||||
|
|
||||||
byte[] newContent = byteArrayOutputStream.toByteArray();
|
byte[] newContent = byteArrayOutputStream.toByteArray();
|
||||||
FileData fileDataNew = new FileData(fileData.getName(), newContent, fileData.getContentType(), null);
|
FileData fileDataNew = new FileData(fileData.getName(), newContent, fileData.getContentType(),
|
||||||
|
null);
|
||||||
// update the fileData
|
// update the fileData
|
||||||
document.addFileData(fileDataNew);
|
document.addFileData(fileDataNew);
|
||||||
|
|
||||||
logger.finest("......new document added");
|
logger.finest("......new document added");
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update opliste: " + e.getMessage());
|
"failed to update opliste: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
|
|
@ -246,11 +252,13 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
* @param document
|
* @param document
|
||||||
* @throws PluginException
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
private void appendExcelTemplate(ItemCollection document, String textblockRef, String template, String targetName)
|
private void appendExcelTemplate(ItemCollection document, String textblockRef, String template,
|
||||||
|
String targetName)
|
||||||
throws PluginException {
|
throws PluginException {
|
||||||
|
|
||||||
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
"invalid steuerbescheide configuration in model event - textblock/template reference not defined!");
|
"invalid steuerbescheide configuration in model event - textblock/template reference not defined!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -259,8 +267,10 @@ public class AGLAnalyticExcelAdapter extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
// do we found the document?
|
// do we found the document?
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
"invalid steuerbescheide configuration in model event - template=" + template + " not found!");
|
InvoiceService.ERROR_CONFIG,
|
||||||
|
"invalid steuerbescheide configuration in model event - template=" + template
|
||||||
|
+ " not found!");
|
||||||
}
|
}
|
||||||
fileData.setName(targetName);
|
fileData.setName(targetName);
|
||||||
// append document
|
// append document
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
|
||||||
WorkflowService workflowService;
|
WorkflowService workflowService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPListExportService opListExportService;
|
InvoiceService invoiceService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DocumentService documentService;
|
DocumentService documentService;
|
||||||
|
|
@ -89,13 +89,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
|
||||||
throws AdapterException, PluginException {
|
throws AdapterException, PluginException {
|
||||||
|
|
||||||
// ermittle die Hauptwährungen
|
// ermittle die Hauptwährungen
|
||||||
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
List<String> currencyList = invoiceService.getCurrenciesOut();
|
||||||
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
|
||||||
if (currencyList == null || currencyList.size() < 1) {
|
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
|
||||||
OPListExportService.ERROR_CONFIG,
|
|
||||||
"missing Currency configuration - please check parameters");
|
|
||||||
}
|
|
||||||
|
|
||||||
// read the options
|
// read the options
|
||||||
ItemCollection ausgangsrechnungConfig = workflowService.evalWorkflowResult(event, "soa",
|
ItemCollection ausgangsrechnungConfig = workflowService.evalWorkflowResult(event, "soa",
|
||||||
|
|
@ -142,7 +136,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
} catch (IOException | QueryException e) {
|
} catch (IOException | QueryException e) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
OPListExportService.ERROR_CONFIG,
|
InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update opliste: " + e.getMessage());
|
"failed to update opliste: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
|
|
@ -160,7 +154,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
} catch (PluginException e) {
|
} catch (PluginException e) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
OPListExportService.ERROR_CONFIG,
|
InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update steuerbescheide: " + e.getMessage());
|
"failed to update steuerbescheide: " + e.getMessage());
|
||||||
}
|
}
|
||||||
logger.info("... completed!");
|
logger.info("... completed!");
|
||||||
|
|
@ -329,17 +323,17 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
OPListExportService.ERROR_CONFIG,
|
InvoiceService.ERROR_CONFIG,
|
||||||
"invalid SOA configuration in model event - textblock/template reference not defined!");
|
"invalid SOA configuration in model event - textblock/template reference not defined!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the text block
|
// load the text block
|
||||||
FileData fileData = opListExportService.loadTextBlockFileData(textblockRef, template);
|
FileData fileData = invoiceService.loadTextBlockFileData(textblockRef, template);
|
||||||
|
|
||||||
// do we found the document?
|
// do we found the document?
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
OPListExportService.ERROR_CONFIG,
|
InvoiceService.ERROR_CONFIG,
|
||||||
"invalid SOA configuration in model event - template=" + template
|
"invalid SOA configuration in model event - template=" + template
|
||||||
+ " not found!");
|
+ " not found!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ package com.alexanderlogistics;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||||
|
|
@ -36,25 +37,27 @@ import org.imixs.archive.core.SnapshotService;
|
||||||
import org.imixs.workflow.FileData;
|
import org.imixs.workflow.FileData;
|
||||||
import org.imixs.workflow.ItemCollection;
|
import org.imixs.workflow.ItemCollection;
|
||||||
import org.imixs.workflow.engine.DocumentService;
|
import org.imixs.workflow.engine.DocumentService;
|
||||||
|
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 jakarta.annotation.security.RunAs;
|
import jakarta.annotation.security.RunAs;
|
||||||
import jakarta.ejb.Singleton;
|
import jakarta.ejb.Singleton;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Der OPListExportService ist im Grunde nur dafür da das overdue date zu
|
* Der InvoiceService stellt einige Hilfsmethoden bereit.
|
||||||
* ermitteln.
|
|
||||||
* Ausgangsrechnungen zu akutalisieren.
|
|
||||||
*
|
*
|
||||||
* @author rsoika
|
* @author rsoika
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
@RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
|
@RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
|
||||||
public class OPListExportService {
|
public class InvoiceService {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(OPListExportService.class.getName());
|
private static Logger logger = Logger.getLogger(InvoiceService.class.getName());
|
||||||
|
@Inject
|
||||||
|
ConfigService configService;
|
||||||
|
|
||||||
public static final int MAX_COUNT = 999;
|
public static final int MAX_COUNT = 999;
|
||||||
final String TYPE_TEXTBLOCK = "textblock";
|
final String TYPE_TEXTBLOCK = "textblock";
|
||||||
|
|
@ -74,6 +77,44 @@ public class OPListExportService {
|
||||||
@Inject
|
@Inject
|
||||||
DocumentService documentService;
|
DocumentService documentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Liste der Ausgehenden Währungen
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws PluginException
|
||||||
|
*/
|
||||||
|
public List<String> getCurrenciesOut() throws PluginException {
|
||||||
|
|
||||||
|
// ermittle die Hauptwährungen
|
||||||
|
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
||||||
|
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
||||||
|
if (currencyList == null || currencyList.size() < 1) {
|
||||||
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
|
"missing Currency configuration - please check parameters");
|
||||||
|
}
|
||||||
|
return currencyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Liste der Eingehenden Währungen
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws PluginException
|
||||||
|
*/
|
||||||
|
public List<String> getCurrenciesIn() throws PluginException {
|
||||||
|
|
||||||
|
// ermittle die Hauptwährungen
|
||||||
|
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
||||||
|
List<String> currencyList = configItemCollection.getItemValue("currency.in");
|
||||||
|
if (currencyList == null || currencyList.size() < 1) {
|
||||||
|
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
|
||||||
|
InvoiceService.ERROR_CONFIG,
|
||||||
|
"missing Currency configuration - please check parameters");
|
||||||
|
}
|
||||||
|
return currencyList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prüft ob der Vorgang überflällig ist.
|
* Prüft ob der Vorgang überflällig ist.
|
||||||
* Default ist 21 tage.
|
* Default ist 21 tage.
|
||||||
|
|
@ -54,12 +54,12 @@ public class InvoiceUtil {
|
||||||
.matches();
|
.matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
// @Deprecated
|
||||||
public static double roundConservative(double value) {
|
// public static double roundConservative(double value) {
|
||||||
value = value * 100;
|
// value = value * 100;
|
||||||
long tmp = Math.round(value);
|
// long tmp = Math.round(value);
|
||||||
return (double) tmp / 100;
|
// return (double) tmp / 100;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts the Map List of a workitem into a List of ItemCollectons
|
* converts the Map List of a workitem into a List of ItemCollectons
|
||||||
|
|
|
||||||
|
|
@ -348,6 +348,14 @@ public class OPListController implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Berechnet die Summer aller Rechnungen zu einer Währung.
|
||||||
|
* Es werden nur Rechnungen berücksichtigt, deren Haupt Währung der übergebenen
|
||||||
|
* Währung entspricht.
|
||||||
|
*
|
||||||
|
* @param currency
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public double calculateInvoiceTotal(String currency) {
|
public double calculateInvoiceTotal(String currency) {
|
||||||
double result = 0;
|
double result = 0;
|
||||||
for (ItemCollection invoice : invoiceList) {
|
for (ItemCollection invoice : invoiceList) {
|
||||||
|
|
@ -355,13 +363,13 @@ public class OPListController implements Serializable {
|
||||||
result = result + invoice.getItemValueDouble("invoice.total");
|
result = result + invoice.getItemValueDouble("invoice.total");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// rond with 2 digits
|
// round with 2 digits
|
||||||
return InvoiceUtil.round(result);
|
return InvoiceUtil.round(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Berechnet den gesammten OP Saldo
|
* Berechnet den gesamten OP Saldo
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -372,7 +380,7 @@ public class OPListController implements Serializable {
|
||||||
result = result + invoice.getItemValueDouble("invoice.saldo");
|
result = result + invoice.getItemValueDouble("invoice.saldo");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// rond with 2 digits
|
// round with 2 digits
|
||||||
return InvoiceUtil.round(result);
|
return InvoiceUtil.round(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
WorkflowService workflowService;
|
WorkflowService workflowService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPListExportService opListExportService;
|
InvoiceService invoiceService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DocumentService documentService;
|
DocumentService documentService;
|
||||||
|
|
@ -86,7 +86,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
||||||
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
||||||
if (currencyList == null || currencyList.size() < 2) {
|
if (currencyList == null || currencyList.size() < 2) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"missing Currency configuration - please check parameters");
|
"missing Currency configuration - please check parameters");
|
||||||
}
|
}
|
||||||
String currency1 = currencyList.get(0);
|
String currency1 = currencyList.get(0);
|
||||||
|
|
@ -95,7 +95,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
// 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) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"missing op-list configuration in model event - please check model configuration");
|
"missing op-list configuration in model event - please check model configuration");
|
||||||
}
|
}
|
||||||
String textblock = evalItemCollection.getItemValueString("textblock");
|
String textblock = evalItemCollection.getItemValueString("textblock");
|
||||||
|
|
@ -128,7 +128,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
insertInvoiceRows(document, targetName, filter, currency1, currency2);
|
insertInvoiceRows(document, targetName, filter, currency1, currency2);
|
||||||
} catch (PluginException | IOException | QueryException e) {
|
} catch (PluginException | IOException | QueryException e) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update op-liste: " + e.getMessage());
|
"failed to update op-liste: " + e.getMessage());
|
||||||
}
|
}
|
||||||
logger.info("... completed!");
|
logger.info("... completed!");
|
||||||
|
|
@ -282,7 +282,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
logger.finest("......new document added");
|
logger.finest("......new document added");
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update opliste: " + e.getMessage());
|
"failed to update opliste: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
|
|
@ -307,16 +307,16 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
throws PluginException {
|
throws PluginException {
|
||||||
|
|
||||||
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"invalid op-list configuration in model event - textblock/template reference not defined!");
|
"invalid op-list configuration in model event - textblock/template reference not defined!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the text block
|
// load the text block
|
||||||
FileData fileData = opListExportService.loadTextBlockFileData(textblockRef, template);
|
FileData fileData = invoiceService.loadTextBlockFileData(textblockRef, template);
|
||||||
|
|
||||||
// do we found the document?
|
// do we found the document?
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"invalid op-list configuration in model event - template=" + template + " not found!");
|
"invalid op-list configuration in model event - template=" + template + " not found!");
|
||||||
}
|
}
|
||||||
fileData.setName(targetName);
|
fileData.setName(targetName);
|
||||||
|
|
@ -357,7 +357,7 @@ public class OPListExportAdapter extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
Date date = invoice.getItemValueDate("invoice.duedate");
|
Date date = invoice.getItemValueDate("invoice.duedate");
|
||||||
if (opListExportService.isOverdue(date, invoice.getTaskID())) {
|
if (invoiceService.isOverdue(date, invoice.getTaskID())) {
|
||||||
// logger.info("...invoice - " +invoice.getUniqueID() + " is in overdue");
|
// logger.info("...invoice - " +invoice.getUniqueID() + " is in overdue");
|
||||||
invoiceList.add(invoice);
|
invoiceList.add(invoice);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
ConfigService configService;
|
ConfigService configService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPListExportService opListExportService;
|
InvoiceService invoiceService;
|
||||||
|
|
||||||
// cache for all invoices grouped by week
|
// cache for all invoices grouped by week
|
||||||
Map<String, List<ItemCollection>> invoiceMap = null;
|
Map<String, List<ItemCollection>> invoiceMap = null;
|
||||||
|
|
@ -107,7 +107,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
// read the opliste options
|
// read the opliste options
|
||||||
ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "opliste", document, false);
|
ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "opliste", document, false);
|
||||||
if (evalItemCollection == null) {
|
if (evalItemCollection == null) {
|
||||||
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"missing op-list configuration in model event - please check model configuration");
|
"missing op-list configuration in model event - please check model configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
ItemCollection configItemCollection = configService.loadConfiguration("AGL_CONFIGURATION");
|
||||||
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
List<String> currencyList = configItemCollection.getItemValue("currency.out");
|
||||||
if (currencyList == null || currencyList.size() < 2) {
|
if (currencyList == null || currencyList.size() < 2) {
|
||||||
throw new PluginException(OPListExportAdapter.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapter.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"missing Currency configuration - please check parameters");
|
"missing Currency configuration - please check parameters");
|
||||||
}
|
}
|
||||||
String currency1 = currencyList.get(0);
|
String currency1 = currencyList.get(0);
|
||||||
|
|
@ -144,7 +144,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
|
|
||||||
insertInvoiceRows(document, targetName, currency1, currency2);
|
insertInvoiceRows(document, targetName, currency1, currency2);
|
||||||
} catch (PluginException | IOException | QueryException e) {
|
} catch (PluginException | IOException | QueryException e) {
|
||||||
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update op-liste: " + e.getMessage());
|
"failed to update op-liste: " + e.getMessage());
|
||||||
}
|
}
|
||||||
logger.info("... completed!");
|
logger.info("... completed!");
|
||||||
|
|
@ -508,7 +508,7 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
logger.finest("......new document added");
|
logger.finest("......new document added");
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"failed to update opliste: " + e.getMessage());
|
"failed to update opliste: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
|
|
@ -533,16 +533,16 @@ public class OPListExportAdapterByWeek extends POIFindReplaceAdapter {
|
||||||
throws PluginException {
|
throws PluginException {
|
||||||
|
|
||||||
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
if ((template == null || template.isEmpty()) || (textblockRef == null || textblockRef.isEmpty())) {
|
||||||
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"invalid op-list configuration in model event - textblock/template reference not defined!");
|
"invalid op-list configuration in model event - textblock/template reference not defined!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the text block
|
// load the text block
|
||||||
FileData fileData = opListExportService.loadTextBlockFileData(textblockRef, template);
|
FileData fileData = invoiceService.loadTextBlockFileData(textblockRef, template);
|
||||||
|
|
||||||
// do we found the document?
|
// do we found the document?
|
||||||
if (fileData == null) {
|
if (fileData == null) {
|
||||||
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), OPListExportService.ERROR_CONFIG,
|
throw new PluginException(OPListExportAdapterByWeek.class.getSimpleName(), InvoiceService.ERROR_CONFIG,
|
||||||
"invalid op-list configuration in model event - template=" + template + " not found!");
|
"invalid op-list configuration in model event - template=" + template + " not found!");
|
||||||
}
|
}
|
||||||
fileData.setName(targetName);
|
fileData.setName(targetName);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class OPListExportScheduler implements Scheduler {
|
||||||
DocumentService documentService;
|
DocumentService documentService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OPListExportService opListExportService;
|
InvoiceService invoiceService;
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
TeamService teamService;
|
TeamService teamService;
|
||||||
|
|
@ -148,7 +148,7 @@ public class OPListExportScheduler implements Scheduler {
|
||||||
|
|
||||||
for (ItemCollection invoice : invoices) {
|
for (ItemCollection invoice : invoices) {
|
||||||
Date date = invoice.getItemValueDate("invoice.duedate");
|
Date date = invoice.getItemValueDate("invoice.duedate");
|
||||||
if (opListExportService.isOverdue(date, invoice.getTaskID())) {
|
if (invoiceService.isOverdue(date, invoice.getTaskID())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
</strong></td>
|
</strong></td>
|
||||||
|
|
||||||
|
|
||||||
<td><strong>EUR<br />USD</strong></td>
|
<td><strong>EUR<br />#{invoice.item['invoice.currency']}</strong></td>
|
||||||
|
|
||||||
|
|
||||||
<td />
|
<td />
|
||||||
|
|
|
||||||
|
|
@ -321,37 +321,16 @@ th { font-weight: bold;}
|
||||||
<template>soa_template.xlsx</template>
|
<template>soa_template.xlsx</template>
|
||||||
<target-name>soa_<itemvalue>dbtr.number</itemvalue>_<itemvalue format="yyyy-MM-dd">$lasteventdate</itemvalue>.xlsx</target-name>
|
<target-name>soa_<itemvalue>dbtr.number</itemvalue>_<itemvalue format="yyyy-MM-dd">$lasteventdate</itemvalue>.xlsx</target-name>
|
||||||
</soa>
|
</soa>
|
||||||
|
|
||||||
<poi-update name="findreplace">
|
<poi-update name="findreplace">
|
||||||
<find>I6</find>
|
<find>F6</find>
|
||||||
<replace><itemvalue format="dd.MM.yyyy">$lasteventdate</itemvalue></replace>
|
<replace><itemvalue format="dd.MM.yyyy">$lasteventdate</itemvalue></replace>
|
||||||
<type>date</type>
|
<type>date</type>
|
||||||
</poi-update>
|
</poi-update>
|
||||||
<poi-update name="findreplace">
|
<poi-update name="findreplace">
|
||||||
<find>D6</find>
|
<find>A7</find>
|
||||||
<replace><itemvalue>dbtr.name</itemvalue></replace>
|
<replace><itemvalue>dbtr.name</itemvalue></replace>
|
||||||
<type>date</type>
|
|
||||||
</poi-update>
|
|
||||||
<poi-update name="findreplace">
|
|
||||||
<find>G10</find>
|
|
||||||
<replace>Total AED</replace>
|
|
||||||
</poi-update>
|
|
||||||
<poi-update name="findreplace">
|
|
||||||
<find>H10</find>
|
|
||||||
<replace>Saldo AED</replace>
|
|
||||||
</poi-update>
|
|
||||||
<poi-update name="findreplace">
|
|
||||||
<find>I10</find>
|
|
||||||
<replace>Total USD</replace>
|
|
||||||
</poi-update>
|
|
||||||
<poi-update name="findreplace">
|
|
||||||
<find>J10</find>
|
|
||||||
<replace>Saldo USD</replace>
|
|
||||||
</poi-update>
|
</poi-update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<poi-update name="eval">TOTAL1;TOTAL2;TOTAL3;TOTAL4</poi-update>
|
|
||||||
]]></imixs:value>
|
]]></imixs:value>
|
||||||
</imixs:item>
|
</imixs:item>
|
||||||
</bpmn2:extensionElements>
|
</bpmn2:extensionElements>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue