From a035998513757c60d07c5c9c90394506899ab375 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Wed, 19 Oct 2022 12:13:13 +0200 Subject: [PATCH] verbesserungen mahnlauf --- .../alexanderlogistics/OPListController.java | 13 ++ .../mahnlauf/MahnlaufExecuteAdapter.java | 67 +++++++---- .../alexander/section_opliste_mahnlauf.xhtml | 17 +-- workflow/mahnlauf-de-1.0.0.bpmn | 27 ----- workflow/rechnungsausgang-de-1.0.0.bpmn | 112 +----------------- 5 files changed, 58 insertions(+), 178 deletions(-) diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListController.java index 0f8b018..ed99b11 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListController.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/OPListController.java @@ -1,6 +1,7 @@ package com.alexanderlogistics; import java.io.Serializable; +import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -278,4 +279,16 @@ public class OPListController implements Serializable { } + + /** + * Returns true if the reminder date is today or in the past + * @param uniqueid + * @return + */ + public boolean isInDue(String uniqueid) { + ItemCollection invoice=workflowService.getWorkItem(uniqueid); + LocalDate date = invoice.getItemValueLocalDate("invoice.reminder"); + return date.compareTo(LocalDate.now())<=0; + } + } diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java index b2113b2..39b1a64 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/mahnlauf/MahnlaufExecuteAdapter.java @@ -1,5 +1,6 @@ package com.alexanderlogistics.mahnlauf; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -62,35 +63,38 @@ public class MahnlaufExecuteAdapter implements SignalAdapter { // get all Invoices of this Mahnlauf List>> invoiceList = new ArrayList>>(); List refList = mahnLaufWorkitem.getItemValue("$workitemref"); - double saldo=0; - String currency=""; + double saldo = 0; + String currency = ""; for (String uniqueId : refList) { ItemCollection invoice = workflowService.getWorkItem(uniqueId); if (invoice != null && (invoice.getTaskID() >= MahnlaufService.TASK_MAHNLAUF_START && invoice.getTaskID() <= MahnlaufService.TASK_MAHNLAUF_END)) { - // set new invoice.reminder date - // first fetch the event of the invoice to be processed - try { - Model invoiceModel; - invoiceModel = this.modelService.getModel(invoice.getModelVersion()); - ItemCollection invoiceEvent = invoiceModel.getEvent(invoice.getTaskID(), - MahnlaufService.EVENT_MAHNLAUF_EXECUTE); - if (invoiceEvent != null) { - ItemCollection eventDunningConfig = this.workflowService.evalWorkflowResult(invoiceEvent, - "dunning", invoice); - int period = eventDunningConfig.getItemValueInteger("period"); - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.DATE, period); - invoice.setItemValue("invoice.reminder", cal.getTime()); + // set new invoice.reminder date only if we in due + if (isInDue(invoice)) { + try { + // first fetch the event of the invoice to be processed + Model invoiceModel; + invoiceModel = this.modelService.getModel(invoice.getModelVersion()); + ItemCollection invoiceEvent = invoiceModel.getEvent(invoice.getTaskID(), + MahnlaufService.EVENT_MAHNLAUF_EXECUTE); + if (invoiceEvent != null) { + ItemCollection eventDunningConfig = this.workflowService.evalWorkflowResult(invoiceEvent, + "dunning", invoice); + int period = eventDunningConfig.getItemValueInteger("period"); + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(Calendar.DATE, period); + invoice.setItemValue("invoice.reminder", cal.getTime()); + } + + } catch (ModelException e) { + e.printStackTrace(); } - - } catch (ModelException e) { - e.printStackTrace(); + mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE)); } - mahnlaufService.processInvoice(invoice.event(MahnlaufService.EVENT_MAHNLAUF_EXECUTE)); - + + // create a workitem stub for the mail message ItemCollection invoiceStub = new ItemCollection(); invoiceStub.setItemValue("invoice.number", invoice.getItemValue("invoice.number")); @@ -101,11 +105,11 @@ public class MahnlaufExecuteAdapter implements SignalAdapter { invoiceStub.setItemValue("invoice.duedate", invoice.getItemValue("invoice.duedate")); invoiceStub.setItemValue("$workflowstatus", invoice.getItemValue("$workflowstatus")); invoiceList.add(invoiceStub.getAllItems()); - + // store currency in mahnlauf - currency= invoice.getItemValueString("invoice.currency"); - - saldo=saldo+invoice.getItemValueDouble("invoice.saldo"); + currency = invoice.getItemValueString("invoice.currency"); + + saldo = saldo + invoice.getItemValueDouble("invoice.saldo"); } } @@ -116,5 +120,16 @@ public class MahnlaufExecuteAdapter implements SignalAdapter { return mahnLaufWorkitem; } + + + /** + * Returns true if the reminder date is today or in the past + * @param uniqueid + * @return + */ + public boolean isInDue(ItemCollection invoice) { + LocalDate date = invoice.getItemValueLocalDate("invoice.reminder"); + return date.compareTo(LocalDate.now())<=0; + } } diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste_mahnlauf.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste_mahnlauf.xhtml index 6743a77..392a8d0 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste_mahnlauf.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste_mahnlauf.xhtml @@ -81,11 +81,10 @@ - - + onclick="initInvoicePayment(this)"> @@ -150,17 +149,7 @@ var prevTD=$(currentTD).prev().prev(); var amountValue=$(prevTD).text(); var amountTD=$(currentTD).prev(); - //var amountInput=$("input",amountTD); - // wenn wir noch keinen wert dann betrag übernehmen - -/* if (element.checked) { - if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') { - $(amountInput).val(amountValue); - } - } else { - // clear value - $(amountInput).val(""); - } */ + } // This method refreshs the layout of the invoice checkboxes diff --git a/workflow/mahnlauf-de-1.0.0.bpmn b/workflow/mahnlauf-de-1.0.0.bpmn index acc8e1f..168210c 100644 --- a/workflow/mahnlauf-de-1.0.0.bpmn +++ b/workflow/mahnlauf-de-1.0.0.bpmn @@ -93,7 +93,6 @@ th { font-weight: bold;} IntermediateCatchEvent_2 IntermediateCatchEvent_6 Task_3 - IntermediateCatchEvent_8 IntermediateCatchEvent_7 @@ -131,7 +130,6 @@ th { font-weight: bold;} SequenceFlow_6 SequenceFlow_15 SequenceFlow_10 - SequenceFlow_16 @@ -174,7 +172,6 @@ th { font-weight: bold;} SequenceFlow_14 SequenceFlow_4 SequenceFlow_1 - SequenceFlow_17 SequenceFlow_2 SequenceFlow_3 @@ -704,12 +701,6 @@ result.isValid=true; - - SequenceFlow_16 - SequenceFlow_17 - - - @@ -824,12 +815,6 @@ result.isValid=true; - - - - - - @@ -928,18 +913,6 @@ result.isValid=true; - - - - - - - - - - - - diff --git a/workflow/rechnungsausgang-de-1.0.0.bpmn b/workflow/rechnungsausgang-de-1.0.0.bpmn index 7756d9c..34c4489 100644 --- a/workflow/rechnungsausgang-de-1.0.0.bpmn +++ b/workflow/rechnungsausgang-de-1.0.0.bpmn @@ -114,7 +114,6 @@ th { font-weight: bold;} IntermediateCatchEvent_5000-20 IntermediateCatchEvent_1 IntermediateCatchEvent_18 - IntermediateCatchEvent_5 Task_8 IntermediateCatchEvent_7 EndEvent_3 @@ -187,7 +186,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com - + @@ -391,7 +390,6 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com SequenceFlow_33 SequenceFlow_14 SequenceFlow_15 - SequenceFlow_22 SequenceFlow_39 SequenceFlow_46 SequenceFlow_37 @@ -1748,101 +1746,6 @@ Betrag: invoice.total invoice.currency - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mahnlauf-de-1.0 -1000 -100 -/pages/workitems/workitem.jsf?id=dunning.ref -]]> - - - - - - - - - - - - false - - - - - - - - - - - - SequenceFlow_22 - - - DataOutput_2 - - - DataOutput_2 - - - - @@ -2777,12 +2680,6 @@ Wiedervorlage wird um 7 bzw. 5 Tage erhöht - - - - - - @@ -3135,13 +3032,6 @@ Wiedervorlage wird um 7 bzw. 5 Tage erhöht - - - - - - -