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 aee22c3..c55b6f2 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 @@ -114,21 +114,23 @@ public class OPListController implements Serializable { } catch (QueryException e) { logger.severe("Failed to get op liste:" + e.getMessage()); } - // wir selektieren hier alle fälligen Rechnungen vor, falls der Mahnlauf gerade erstellt + // wir selektieren hier alle fälligen Rechnungen vor, falls der Mahnlauf gerade + // erstellt // wird. - if (workflowController.getWorkitem().getItemValueInteger("$version") == 0 - || (workflowController.getWorkitem().getItemValueInteger("$version") == 1 - && workflowController.getWorkitem().getItemValueInteger("$lastevent") == 100)) { - List intialSelection = new ArrayList(); - for (ItemCollection invoice : invoiceList) { - - if ("workitem".equals(invoice.getType()) && invoice.getTaskID()>=5100) { - intialSelection.add(invoice.getUniqueID()); - } - } - workflowController.getWorkitem().setItemValue("$workitemref", intialSelection); - } + if (workflowController.getWorkitem().getModelVersion().startsWith("mahnlauf")) { + if (workflowController.getWorkitem().getItemValueInteger("$version") == 0 + || (workflowController.getWorkitem().getItemValueInteger("$version") == 1 + && workflowController.getWorkitem().getItemValueInteger("$lastevent") == 100)) { + List intialSelection = new ArrayList(); + for (ItemCollection invoice : invoiceList) { + if ("workitem".equals(invoice.getType()) && invoice.getTaskID() >= 5100) { + intialSelection.add(invoice.getUniqueID()); + } + } + workflowController.getWorkitem().setItemValue("$workitemref", intialSelection); + } + } } else { // We are no longer in TASK_ERSTELLUNG, so // fetch only selected invoices @@ -286,14 +288,32 @@ public class OPListController implements Serializable { */ public double calculateInvoiceSaldo() { double result = 0; - for (ItemCollection invoice : invoiceList) { - result = result + invoice.getItemValueDouble("invoice.saldo"); + if (invoiceList != null) { + for (ItemCollection invoice : invoiceList) { + result = result + invoice.getItemValueDouble("invoice.saldo"); + } } // rond with 2 digits return Math.round(result * 100.0) / 100.0; } + /** + * Berechnet den noch offenen Differenz vom Zahlbetrag + * + * @return + */ + public double calculatePaymentDifference() { + double paymentAmount = workflowController.getWorkitem().getItemValueDouble("payment.amount"); + double paymentTotal = workflowController.getWorkitem().getItemValueDouble("payment.total"); + // paymentAmount - calculateInvoiceSaldo(); + double result = paymentAmount -paymentTotal; + + logger.info("...new PaymentDifference=" + result); + // 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 5798169..26cc0ba 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 @@ -16,6 +16,17 @@ + +
+
Restbetrag:
+
+ + + +
+
+ + @@ -88,7 +99,7 @@ value="#{invoice.item['payment.amount']}" style="width:100px;text-align: right;"> - @@ -105,7 +116,7 @@ @@ -154,12 +165,18 @@ /*v2) { + amountValue=maxAmount; + } if (element.checked) { + // wenn wir noch keinen wert haben, dann betrag übernehmen if ($(amountInput).val()=='' || $(amountInput).val()=='0,00') { $(amountInput).val(amountValue); } 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 392a8d0..09c7a6b 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 @@ -97,10 +97,10 @@ - - +
#{message['form.invoicenumber']} -
+ Summary diff --git a/workflow/zahlungseingang-de-1.0.0.bpmn b/workflow/zahlungseingang-de-1.0.0.bpmn index c758ab6..bcd1959 100644 --- a/workflow/zahlungseingang-de-1.0.0.bpmn +++ b/workflow/zahlungseingang-de-1.0.0.bpmn @@ -390,7 +390,7 @@ result.isValid=true; - + @@ -480,7 +480,7 @@ result.isValid=true; - +