From 1bb65234fad8b4350a40e030d1db97b87e09f52e Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Sat, 23 Nov 2024 14:15:21 +0100 Subject: [PATCH] Neuer Analyse Workflow OP Liste --- .../AGLAnalyticControllerOPListe.java | 177 +++++ workflow/analyse-debitor-de-1.0.0.bpmn | 4 +- workflow/analyse-opliste-de-1.0.3.bpmn | 679 ++++++++++++++++++ workflow/analyse-steuerbescheid-de-1.0.2.bpmn | 4 +- .../{ => deprecated}/opliste-de-1.0.2.bpmn | 0 .../{ => deprecated}/opliste-de-1.0.3.bpmn | 0 6 files changed, 860 insertions(+), 4 deletions(-) create mode 100644 office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerOPListe.java create mode 100644 workflow/analyse-opliste-de-1.0.3.bpmn rename workflow/{ => deprecated}/opliste-de-1.0.2.bpmn (100%) rename workflow/{ => deprecated}/opliste-de-1.0.3.bpmn (100%) diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerOPListe.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerOPListe.java new file mode 100644 index 0000000..d318fee --- /dev/null +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerOPListe.java @@ -0,0 +1,177 @@ +package com.alexanderlogistics; + +import java.io.Serializable; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; +import java.util.TreeMap; +import java.util.logging.Logger; + +import org.imixs.marty.team.TeamService; +import org.imixs.workflow.ItemCollection; +import org.imixs.workflow.engine.DocumentService; +import org.imixs.workflow.exceptions.QueryException; +import org.imixs.workflow.faces.data.WorkflowController; +import org.imixs.workflow.office.forms.AnalyticController; +import org.imixs.workflow.office.forms.AnalyticEvent; + +import jakarta.enterprise.context.ConversationScoped; +import jakarta.enterprise.event.Observes; +import jakarta.inject.Inject; +import jakarta.inject.Named; + +/** + * Der AGLAnalyticControllerOPListe berechnet Analyse Daten über alle offenen + * Rechnungen + * und bietet im Workflow noch eine Excel-Export Funktion + * + * @author rsoika + * + */ +@Named +@ConversationScoped +public class AGLAnalyticControllerOPListe implements Serializable { + + private static final long serialVersionUID = 1L; + private static Logger logger = Logger.getLogger(AnalyticController.class.getName()); + + @Inject + protected DocumentService documentService; + + @Inject + protected AGLConfigController aglConfigController; + + @Inject + protected WorkflowController workflowController; + + @Inject + TeamService teamService; + + TreeMap stats = null; + + String departmentID; + String departmentIDLast = null; + String departmentName; + ItemCollection department; + + int countAll = 0; + int countOpen = 0; + int countDue = 0; + int countDunning = 0; + boolean refreshCalculation = true; + + public void onEvent(@Observes AnalyticEvent event) { + + if (!"workitem".equals(event.getWorkitem().getType())) { + // no op + return; + } + + department = null; + departmentID = event.getWorkitem().getItemValueString("space.ref"); + + if ((!departmentID.isEmpty() && !departmentID.equals(departmentIDLast))) { + department = documentService.load(departmentID); + departmentName = department.getItemValueString("name"); + departmentIDLast = departmentID; + refreshCalculation = true; + } + + if (refreshCalculation) { + calculateStats(); + refreshCalculation = false; + } + + String link = "/pages/workitems/worklist.xhtml"; + logger.fine("process ref=" + workflowController.getWorkitem().getItemValueString("process.ref")); + ItemCollection process = documentService + .load(workflowController.getWorkitem().getItemValueString("process.ref")); + if (process != null) { + link = link + "&processref=" + process.getUniqueID() + + "&phrase=" + departmentName; + } + if ("analytic.invoices.count.all".equals(event.getKey())) { + event.setValue("" + countAll); + event.setLabel("Invoices"); + event.setDescription("open"); + event.getWorkitem().setItemValue("invoices.total", event.getValue()); + event.setLink(link); + } + + if ("analytic.invoices.count.open".equals(event.getKey())) { + event.setValue("" + (countOpen - countDunning - countDue)); + event.setLabel("Invoices"); + event.setDescription("Total invoices not yet in due"); + event.getWorkitem().setItemValue("invoices.total.open", event.getValue()); + event.setLink(link); + } + + if ("analytic.invoices.count.due".equals(event.getKey())) { + event.setValue("" + countDue); + event.setLabel("Invoices"); + event.setDescription("Total invoices in due"); + event.getWorkitem().setItemValue("invoices.total.due", event.getValue()); + event.setLink(link); + } + if ("analytic.invoices.count.dunning".equals(event.getKey())) { + event.setValue("" + countDunning); + event.setLabel("Invoices"); + event.setDescription("Total invoices in dunning"); + event.getWorkitem().setItemValue("invoices.total.dunning", event.getValue()); + event.setLink(link); + } + + } + + /** + * Läd die statistik daten zu einem department die Anzahl an aktuellen + * Rechnungen zu ermitteln + * + * int countAll = 0; + * int countOpen = 0; + * int countDue = 0; + * int countDunning = 0; + * + */ + private void calculateStats() { + countAll = 0; + countOpen = 0; + countDue = 0; + countDunning = 0; + logger.info(" ├──calculate stats for " + departmentID + "...."); + + try { + + if (departmentID == null || !departmentID.isEmpty()) { + countOpen = documentService.count("(type:workitem) AND $uniqueidref:" + departmentID + + " AND $modelversion:rechnungsausgang-*"); + countDue = documentService.count("(type:workitem) AND $uniqueidref:" + departmentID + + " AND $modelversion:rechnungsausgang-* AND $taskid:[5100 TO 5199]"); + countDunning = documentService.count("(type:workitem) AND $uniqueidref:" + departmentID + + " AND $modelversion:rechnungsausgang-* AND $taskid:[5200 TO 5399]"); + } else { + countOpen = documentService.count("(type:workitem) AND $modelversion:rechnungsausgang-*"); + countDue = documentService + .count("(type:workitem) AND $modelversion:rechnungsausgang-* AND $taskid:[5100 TO 5199]"); + countDunning = documentService + .count("(type:workitem) AND $modelversion:rechnungsausgang-* AND $taskid:[5200 TO 5399]"); + } + + } catch (QueryException e) { + logger.warning("Failed to query invoices: " + e.getMessage()); + + } + + } + + private String formatCurrency(Double value) { + + DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault()); + symbols.setGroupingSeparator('.'); + symbols.setDecimalSeparator(','); + DecimalFormat formatter = new DecimalFormat("#,##0.00", symbols); + + return formatter.format(value); + } + +} diff --git a/workflow/analyse-debitor-de-1.0.0.bpmn b/workflow/analyse-debitor-de-1.0.0.bpmn index d782449..77e6e51 100644 --- a/workflow/analyse-debitor-de-1.0.0.bpmn +++ b/workflow/analyse-debitor-de-1.0.0.bpmn @@ -70,7 +70,7 @@ th { font-weight: bold;} ]]> - + @@ -78,7 +78,7 @@ th { font-weight: bold;} - + StartEvent_1 diff --git a/workflow/analyse-opliste-de-1.0.3.bpmn b/workflow/analyse-opliste-de-1.0.3.bpmn new file mode 100644 index 0000000..e27ff79 --- /dev/null +++ b/workflow/analyse-opliste-de-1.0.3.bpmn @@ -0,0 +1,679 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + +<itemvalue>$workflowstatus</itemvalue> + +]]> + + + +]]> + + + + + + + + + + + + + + StartEvent_1 + Task_1 + IntermediateCatchEvent_3 + IntermediateCatchEvent_1 + Task_4 + EndEvent_3 + IntermediateCatchEvent_4 + + TextAnnotation_1 + DataObject_1 + DataObject_2 + TextAnnotation_2 + event_rEFclQ + gateway_L9r5iA + gateway_37SSsw + textAnnotation_iPsg3g + + + + SequenceFlow_4 + + + + SequenceFlow_19 + + + + + + sequencenumber space.name - $lasteventdate]]> + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_4 + sequenceFlow_5g3SfA + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + sequencenumber space.name - $created]]> + + + + + + + + + Html-Header +

Hallo,

+

+Bitte prüfen Sie die angefügte OP-Liste. Diese enthält sämtlich noch offenen Rechnungen zum Zeitpunkt des Exports für diesen Fachbereich. +

+

+Nach Prüfung schließen Sie bitte den Vorgang über die Schaltfläche "Erledigt" ab. +

+application.urlpages/workitems/workitem.jsf?id=$uniqueid + +Html-Footer]]>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + home +Mahnwesen +OP-Liste Template +op-liste_template.xlsx +op-liste_space.name_$lasteventdate.xlsx +true + + C6 + sequencenumber + text + + + D6 + Überfällig / 2. Mahnstufe + text + + + C8 + space.name + text + + + + I6 + $lasteventdate + date + +]]> + + + + + + + + + + + + false + + + + + +
+ + SequenceFlow_5 + + DataOutput_2 + + + sequenceFlow_JUVo7A +
+ + + + sequencenumber space.name - $lasteventdate]]> + + + true + + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_19 + Association_1 + sequenceFlow_N0jfWA + + + + + + + + + + + + + + + + + + SequenceFlow_3 + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + OP-Liste Template + + op-liste_dbtr.number_$lasteventdate.xlsx + + + + C6 + sequencenumber + text + + + B7 + space.name + text + + + + F6 + $lasteventdate + date + ]]> + + + SequenceFlow_6 + + + sequenceFlow_NSPD6g + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mahnwesen +OP-Liste KW Template +op-liste_kw_template.xlsx +op-liste_space.name_$lasteventdate.xlsx + + + + I6 + $lasteventdate + date + + +I7 +]]> + + + + + sequenceFlow_McYLMw + sequenceFlow_L9cMeA + + + + + + + + + + sequenceFlow_5g3SfA + sequenceFlow_McYLMw + sequenceFlow_NSPD6g + SequenceFlow_3 + + + + + + + + + + sequenceFlow_L9cMeA + SequenceFlow_6 + sequenceFlow_JUVo7A + sequenceFlow_N0jfWA + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/analyse-steuerbescheid-de-1.0.2.bpmn b/workflow/analyse-steuerbescheid-de-1.0.2.bpmn index e0bca87..c819aa8 100644 --- a/workflow/analyse-steuerbescheid-de-1.0.2.bpmn +++ b/workflow/analyse-steuerbescheid-de-1.0.2.bpmn @@ -72,7 +72,7 @@ th { font-weight: bold;} ]]> - + @@ -80,7 +80,7 @@ th { font-weight: bold;} - + StartEvent_1 diff --git a/workflow/opliste-de-1.0.2.bpmn b/workflow/deprecated/opliste-de-1.0.2.bpmn similarity index 100% rename from workflow/opliste-de-1.0.2.bpmn rename to workflow/deprecated/opliste-de-1.0.2.bpmn diff --git a/workflow/opliste-de-1.0.3.bpmn b/workflow/deprecated/opliste-de-1.0.3.bpmn similarity index 100% rename from workflow/opliste-de-1.0.3.bpmn rename to workflow/deprecated/opliste-de-1.0.3.bpmn