From 7cf8694694c3758426b9f4e7acb916419e897aa6 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Mon, 23 Jan 2023 16:14:43 +0100 Subject: [PATCH] neuer Zahlungseingangsworkflow Erweiterung --- .../alexanderlogistics/OPListController.java | 48 +- .../forms/alexander/section_opliste.xhtml | 24 +- workflow/zahlungseingang-de-1.0.1-test.bpmn | 819 ++++++++++++++++++ 3 files changed, 874 insertions(+), 17 deletions(-) create mode 100644 workflow/zahlungseingang-de-1.0.1-test.bpmn 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 6c17903..513cf6a 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 @@ -120,26 +120,26 @@ public class OPListController implements Serializable { } catch (QueryException e) { logger.severe("Failed to get op liste:" + e.getMessage()); } - + // Zahlugnseingang? if (workflowController.getWorkitem().getModelVersion().startsWith("zahlungseingang")) { // berechnung des Basisumsatzes bei Fremdwährungen for (ItemCollection invoice : invoiceList) { - float rate=invoice.getItemValueFloat("invoice.rate"); - float maxSaldo=invoice.getItemValueFloat("invoice.saldo"); - if (rate!=0) { - maxSaldo=maxSaldo/rate; - invoice.setItemValue("invoice.saldo.byrate",maxSaldo); + float rate = invoice.getItemValueFloat("invoice.rate"); + float maxSaldo = invoice.getItemValueFloat("invoice.saldo"); + if (rate != 0) { + maxSaldo = maxSaldo / rate; + invoice.setItemValue("invoice.saldo.byrate", maxSaldo); } - + } - + } // Mahnlauf ? if (workflowController.getWorkitem().getModelVersion().startsWith("mahnlauf")) { // wir selektieren hier alle fälligen Rechnungen vor, falls der Mahnlauf gerade - // erstellt wird. + // erstellt wird. if (workflowController.getWorkitem().getItemValueInteger("$version") == 0 || (workflowController.getWorkitem().getItemValueInteger("$version") == 1 && workflowController.getWorkitem().getItemValueInteger("$lastevent") == 100)) { @@ -327,15 +327,41 @@ public class OPListController implements Serializable { */ public double calculatePaymentDifference() { double paymentAmount = workflowController.getWorkitem().getItemValueDouble("payment.amount"); + double paymentDifference = workflowController.getWorkitem().getItemValueDouble("payment.difference"); + double paymentTotal = workflowController.getWorkitem().getItemValueDouble("payment.total"); // paymentAmount - calculateInvoiceSaldo(); - double result = paymentAmount - paymentTotal; + double result = (paymentAmount+paymentDifference) - paymentTotal; - logger.info("...new PaymentDifference=" + result); + logger.fine("...new PaymentDifference=" + result); // rond with 2 digits return Math.round(result * 100.0) / 100.0; } + /** + * Berechnet den Zahlbetrag in EUR bei Fremdwärungen + * + * @return + */ + public double calculatePaymentSaldoEUR() { + double result = 0; + if (invoiceList != null) { + for (ItemCollection invoice : invoiceList) { + double rate = invoice.getItemValueDouble("invoice.rate"); + double pay = invoice.getItemValueDouble("payment.amount"); + if (rate != 0) { + result = result + pay / rate; + } else { + result = result + pay; + + } + } + } + // rond with 2 digits + return Math.round(result * 100.0) / 100.0; + + } + /** * Returns true if the reminder date is today or in the past * diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste.xhtml index 5ce7bc2..1e36c5d 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_opliste.xhtml @@ -29,7 +29,7 @@ - + @@ -143,8 +143,8 @@ - + - + + + +
#{message['form.invoicenumber']}Rg-Nr. #{message['form.date']} #{message['form.deadline']}
- - Summary + + Summary + - + + + +
+ EUR + + +
+
diff --git a/workflow/zahlungseingang-de-1.0.1-test.bpmn b/workflow/zahlungseingang-de-1.0.1-test.bpmn new file mode 100644 index 0000000..1c8a2f5 --- /dev/null +++ b/workflow/zahlungseingang-de-1.0.1-test.bpmn @@ -0,0 +1,819 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + application.urlindex.jsf?workitem=$uniqueid + +]]> + + + application.urlindex.jsf?workitem=$uniqueid + +]]> + + + + + + + + + + StartEvent_1 + Task_1 + IntermediateCatchEvent_3 + IntermediateCatchEvent_1 + EndEvent_3 + EventBasedGateway_1 + IntermediateCatchEvent_5 + Task_6 + + + Task_3 + IntermediateCatchEvent_2 + Task_2 + IntermediateCatchEvent_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + home]]> + + + + + + + + + false + + + + + + + SequenceFlow_13 + SequenceFlow_18 + + + SequenceFlow_4 + + + + + payment.date - payment.amount payment.currency (dbtr.number - dbtr.name)]]> + + + true + + + + + + + + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + + SequenceFlow_1 + SequenceFlow_13 + SequenceFlow_5 + + + SequenceFlow_10 + SequenceFlow_17 + + + + + payment.date - payment.amount payment.currency (dbtr.number - dbtr.name)]]> + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_14 + SequenceFlow_4 + SequenceFlow_1 + + + + + + payment.date - payment.amount payment.currency (dbtr.number - dbtr.name)]]> + + + true + + + + + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_18 + SequenceFlow_17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + false + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + home]]> + + + + + + + + + + + + false + + + + SequenceFlow_5 + SequenceFlow_3 + + + DataOutput_1 + + + DataOutput_1 + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + payment.date - payment.amount payment.currency (dbtr.number - dbtr.name)]]> + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_3 + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + home]]> + + + + + + + + + + + + false + + + + SequenceFlow_2 + SequenceFlow_7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file