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 @@
| #{message['form.invoicenumber']} | +Rg-Nr. | #{message['form.date']} | #{message['form.deadline']} | @@ -143,8 +143,8 @@||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - | - | Summary | + | + | Summary | |
-
+ |
- + + + | + |