diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoAPIService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoAPIService.java index eea709b..b612cd8 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoAPIService.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoAPIService.java @@ -131,12 +131,12 @@ public class ZohoAPIService { * @param invoice * @throws PluginException */ - public ZohoInvoice exportInvoice(ItemCollection invoice, String contactID, String currencyID, String accessToken) + public ZohoInvoice exportInvoice(ItemCollection invoice, String contactID, String accessToken) throws PluginException { logger.info("├── Zoho Export Invoice " + invoice.getItemValueString("invoice.number") + "..."); // Konvertiere ItemCollection zu ZohoInvoiceDTO - ZohoInvoice zohoInvoice = convertToZohoInvoice(invoice, contactID, currencyID); + ZohoInvoice zohoInvoice = convertToZohoInvoice(invoice, contactID); try { String requestBody = jsonb.toJson(zohoInvoice); @@ -202,12 +202,12 @@ public class ZohoAPIService { * @param invoice * @throws PluginException */ - public ZohoBill exportBill(ItemCollection invoice, String contactID, String currencyID, String accountID, + public ZohoBill exportBill(ItemCollection invoice, String contactID, String accountID, String accessToken) throws PluginException { logger.info("├── Zoho Export Bill " + invoice.getItemValueString("invoice.number") + "..."); // Konvertiere ItemCollection zu ZohoInvoiceDTO - ZohoBill zohoBill = convertToZohoBill(invoice, contactID, currencyID, accountID); + ZohoBill zohoBill = convertToZohoBill(invoice, contactID, accountID); try { String requestBody = jsonb.toJson(zohoBill); @@ -330,7 +330,7 @@ public class ZohoAPIService { } - private ZohoInvoice convertToZohoInvoice(ItemCollection invoice, String contactID, String currencyID) + private ZohoInvoice convertToZohoInvoice(ItemCollection invoice, String contactID) throws PluginException { ZohoInvoice zohoInvoice = new ZohoInvoice(); @@ -339,15 +339,14 @@ public class ZohoAPIService { zohoInvoice.setInvoiceNumber(invoice.getItemValueString("invoice.number")); zohoInvoice.setDate( LocalDate.ofInstant(invoice.getItemValueDate("invoice.date").toInstant(), ZoneId.systemDefault())); - zohoInvoice.setDueDate( LocalDate.ofInstant(invoice.getItemValueDate("invoice.duedate").toInstant(), ZoneId.systemDefault())); - zohoInvoice.setTotal(invoice.getItemValueDouble("invoice.total")); zohoInvoice.setCustomerId(contactID); - if (currencyID != null && !currencyID.isEmpty()) { - zohoInvoice.setCurrencyId(currencyID); - } + + // convert total by rate + zohoInvoice.setTotal(convertInvoiceTotalToAED(invoice, invoice.getItemValueDouble("invoice.total"))); + List positionen = InvoiceUtil.explodeChildList(invoice); List lineItems = positionen.stream().map(item -> { @@ -355,7 +354,7 @@ public class ZohoAPIService { ZohoInvoiceItem lineItem = new ZohoInvoiceItem(); lineItem.setName(itemCol.getItemValueString("datev.text")); lineItem.setDescription(itemCol.getItemValueString("billingtext")); - lineItem.setRate(itemCol.getItemValueDouble("datev.umsatz")); + lineItem.setRate(convertInvoiceTotalToAED(invoice, itemCol.getItemValueDouble("datev.umsatz"))); lineItem.setQuantity(1); return lineItem; }).collect(Collectors.toList()); @@ -364,7 +363,52 @@ public class ZohoAPIService { return zohoInvoice; } - private ZohoBill convertToZohoBill(ItemCollection invoice, String contactID, String currencyID, String accountID) + /** + * Diese Hilfsmethode rechnet den Rechnungsbetrag in Fremdwährung auf AED um + * + * es ist eine Fremdwährung + * Herr Heolzl 15.05.2025 + * However the backend reports the P&L & Balance sheet will reflect in AED as + * AGL Dubai books are maintained in AED therefore we need to have an + * exchange rate which can be fixed @3.6725 AED for 1 USD. + * + * Aus diesem Grund rechnen wir direkt in AED um! + * + * @return + */ + public double convertInvoiceTotalToAED(ItemCollection invoice, double total) { + // convert total by fixed rate? + String currency = invoice.getItemValueString("invoice.currency"); + if (!currency.isEmpty() && !currency.equalsIgnoreCase("AED")) { + + // es ist eine Fremdwährung + // Herr Heolzl 15.05.2025 + // However the backend reports the P&L & Balance sheet will reflect in AED as + // AGL Dubai books are maintained in AED therefore we need to have an exchange + // rate which can be fixed @3.6725 AED for 1 USD. + // + // Aus diesem Grund rechnen wir direkt in AED um! + + // wir verwenden unsere Rate + // double rate=3.6725; + double rate = 0; + if (invoice.getModelVersion().startsWith("rechnungsausgang-")) { + rate = invoice.getItemValueDouble("invoice.rate"); + } else { + rate = invoice.getItemValueDouble("invoice.exchangerate"); + } + if (rate == 0) { + rate = 0.27229; // (3.6725) = default rate + } + double aedBetrag = total / rate; + logger.info("│ ├── convert into AED=" + aedBetrag); + return aedBetrag; + } else { + return total; + } + } + + private ZohoBill convertToZohoBill(ItemCollection invoice, String contactID, String accountID) throws PluginException { ZohoBill zohoBill = new ZohoBill(); @@ -373,13 +417,12 @@ public class ZohoAPIService { zohoBill.setInvoiceNumber(invoice.getItemValueString("invoice.number")); zohoBill.setDate( LocalDate.ofInstant(invoice.getItemValueDate("invoice.date").toInstant(), ZoneId.systemDefault())); + // convert total by rate + zohoBill.setAmount(convertInvoiceTotalToAED(invoice, invoice.getItemValueDouble("invoice.total"))); - zohoBill.setAmount(invoice.getItemValueDouble("invoice.total")); // Kunden-ID (muss angepasst werden je nachdem wie du sie speicherst) zohoBill.setVendorId(contactID); - if (currencyID != null && !currencyID.isEmpty()) { - zohoBill.setCurrencyId(currencyID); - } + // zohoBill.setPaid_through_account_id("1700"); List positionen = InvoiceUtil.explodeChildList(invoice); // {amount=[11825.00], total=[11825.00], numpos=[1], name=[AB-DEFGHI-1234-567], @@ -390,7 +433,7 @@ public class ZohoAPIService { lineItem.setName(itemCol.getItemValueString("name")); lineItem.setAccountId(accountID); lineItem.setQuantity(1); - lineItem.setRate(itemCol.getItemValueDouble("amount")); + lineItem.setRate(convertInvoiceTotalToAED(invoice, itemCol.getItemValueDouble("amount"))); return lineItem; }).collect(Collectors.toList()); diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoExportAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoExportAdapter.java index 478cf6c..15926c7 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoExportAdapter.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/ZohoExportAdapter.java @@ -86,8 +86,10 @@ public class ZohoExportAdapter implements SignalAdapter { // find companyID String contactID = zohoAPIService.lookupContact(document.getItemValueString("dbtr.name"), "customer", accessToken); - String currencyID = zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), accessToken); - ZohoInvoice zohoInvoice = zohoAPIService.exportInvoice(document, contactID, currencyID, accessToken); + // String currencyID = + // zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), + // accessToken); + ZohoInvoice zohoInvoice = zohoAPIService.exportInvoice(document, contactID, accessToken); // Attache Files.... List files = null; @@ -117,10 +119,12 @@ public class ZohoExportAdapter implements SignalAdapter { String contactID = zohoAPIService.lookupContact(document.getItemValueString("cdtr.name"), "vendor", accessToken); - String currencyID = zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), accessToken); + // String currencyID = + // zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), + // accessToken); String accountID = zohoOAuthManager.getAccountId(); - ZohoBill zohoBill = zohoAPIService.exportBill(document, contactID, currencyID, accountID, accessToken); + ZohoBill zohoBill = zohoAPIService.exportBill(document, contactID, accountID, accessToken); // Attache Files.... List files = null; diff --git a/workflow/dwc/zahlungseingang-dwc-1.0.1.bpmn b/workflow/dwc/deprecated/zahlungseingang-dwc-1.0.1.bpmn similarity index 100% rename from workflow/dwc/zahlungseingang-dwc-1.0.1.bpmn rename to workflow/dwc/deprecated/zahlungseingang-dwc-1.0.1.bpmn diff --git a/workflow/dwc/zahlungseingang-dwc-1.0.2.bpmn b/workflow/dwc/deprecated/zahlungseingang-dwc-1.0.2.bpmn similarity index 100% rename from workflow/dwc/zahlungseingang-dwc-1.0.2.bpmn rename to workflow/dwc/deprecated/zahlungseingang-dwc-1.0.2.bpmn diff --git a/workflow/dwc/rechnungseingang-dwc-1.0.5.bpmn b/workflow/dwc/rechnungseingang-dwc-1.0.5.bpmn index 53b4c89..7c1d1ca 100644 --- a/workflow/dwc/rechnungseingang-dwc-1.0.5.bpmn +++ b/workflow/dwc/rechnungseingang-dwc-1.0.5.bpmn @@ -97,7 +97,6 @@ IntermediateCatchEvent_21 EventBasedGateway_2 IntermediateCatchEvent_5005-20 - IntermediateCatchEvent_2 IntermediateCatchEvent_26 IntermediateThrowEvent_2 Task_12 @@ -113,6 +112,7 @@ EndEvent_3 IntermediateCatchEvent_7 IntermediateCatchEvent_24 + event_yosOIA Task_5000 @@ -135,23 +135,16 @@ IntermediateCatchEvent_35 IntermediateThrowEvent_1 IntermediateCatchEvent_58 - IntermediateCatchEvent_22 Task_5 - Task_15 IntermediateCatchEvent_48 IntermediateCatchEvent_8 IntermediateCatchEvent_4 IntermediateCatchEvent_14 - Task_7 - IntermediateCatchEvent_18 EndEvent_2 - IntermediateCatchEvent_5 Task_6 IntermediateCatchEvent_23 Task_19 IntermediateCatchEvent_63 - IntermediateCatchEvent_34 - IntermediateCatchEvent_59 IntermediateCatchEvent_41 IntermediateCatchEvent_65 IntermediateCatchEvent_66 @@ -163,6 +156,7 @@ gateway_Al0gGg event_vjVWqA event_PlzIaQ + event_poLLDQ @@ -187,11 +181,10 @@ - + - @@ -554,7 +547,7 @@ if (b>0 && (a!=b) ) { DataOutput_1 - sequenceFlow_JFtS8Q + sequenceFlow_7wMzHA @@ -788,7 +781,7 @@ if (b>0 && (a!=b) ) { - + txtlastcomment @@ -808,7 +801,6 @@ if (b>0 && (a!=b) ) { - @@ -833,6 +825,7 @@ if (b>0 && (a!=b) ) { SequenceFlow_88 sequenceFlow_W0RBHg sequenceFlow_g0kLUQ + sequenceFlow_BiMuxg @@ -1159,98 +1152,19 @@ if (paymentType=="no_sepa") { - SequenceFlow_18 SequenceFlow_1 SequenceFlow_68 + sequenceFlow_LPXJdg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $uniqueid - 60000 - - ftp.target.path - \.pdf$ - - ]]> - - - - - - - - - false - - - - - - - - - - - - - - - - - - SequenceFlow_18 - - sequenceFlow_JFtS8Q - - SequenceFlow_126 - - - @@ -1524,7 +1438,7 @@ if (paymentType=="no_sepa") { - + false @@ -1538,138 +1452,13 @@ if (paymentType=="no_sepa") { - + - - - - - - - txtlastcomment -numsequencenumber_sub]]> - - - - - - - - - _imgnumsequencenumber: cdtr.name invoice.number (invoice.currency invoice.total) space.name]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - $workflowgroup - $workflowstatus]]> - SequenceFlow_42 - SequenceFlow_3 - SequenceFlow_43 - - - - - - - - - - - _subject]]> - - - - - - - - - _amount (Brutto € _amount_brutto) -_description]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - home]]> - - - - - - - - - - - - false - - - - SequenceFlow_43 - SequenceFlow_44 - - - - - - - - + - + @@ -2090,7 +1879,7 @@ result.isValid=true; - + @@ -2120,79 +1909,6 @@ result.isValid=true; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - false - - - - SequenceFlow_3 - - - - @@ -2447,8 +2163,8 @@ result.isValid=true; - - + + @@ -3162,198 +2878,6 @@ result.isValid=true; - - - - - - - txtlastcomment]]> - - - - - - - - - _imgnumsequencenumber: cdtr.name invoice.number (invoice.currency invoice.total) space.name]]> - - - true - - - - - - - - - - - - - - - - - $workflowgroup - $workflowstatus]]> - SequenceFlow_79 - SequenceFlow_124 - SequenceFlow_57 - sequenceFlow_MV1o2Q - sequenceFlow_EuJd3g - - - - - - - - - - - _subject]]> - - - - - - - - - _amount (Brutto € _amount_brutto) -_description]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - home]]> - - - - - - - - - - - - false - - - - SequenceFlow_57 - SequenceFlow_58 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - false - - - - SequenceFlow_79 - - - - @@ -4319,29 +3843,6 @@ result.isValid=true; - - - - - - - - - - SequenceFlow_124 - - - DataOutput_4 - - - DataOutput_4 - - - - - - - SequenceFlow_125 @@ -4352,9 +3853,6 @@ result.isValid=true; - - - txtlastcomment]]> @@ -4378,7 +3876,7 @@ result.isValid=true; - + @@ -4469,7 +3967,7 @@ Betrag: _amount (Brutto € _amount_brutto sequenceFlow_MxzvVQ - sequenceFlow_MV1o2Q + sequenceFlow_QzY8PA @@ -4645,9 +4143,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - @@ -4738,15 +4233,13 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - SequenceFlow_25 sequenceFlow_9rYDHA - SequenceFlow_58 - SequenceFlow_44 + SequenceFlow_42 + sequenceFlow_EuJd3g + sequenceFlow_QzY8PA @@ -4779,7 +4272,7 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - + @@ -4790,10 +4283,49 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - + + + + + + + + + + + + + sequenceFlow_7wMzHA + sequenceFlow_LPXJdg + + + + + + + + + + + + + + + + + + + sequenceFlow_BiMuxg + + + + + + + @@ -4925,12 +4457,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - @@ -4982,15 +4508,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - - - - @@ -5060,12 +4577,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - @@ -5150,21 +4661,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - - - - - - - - - - @@ -5279,12 +4775,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - @@ -5395,16 +4885,11 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + - - - - - @@ -5458,21 +4943,10 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - + - - - - - - - - - - - - + @@ -5485,8 +4959,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5520,8 +4994,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5540,11 +5014,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - @@ -5679,21 +5148,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - - - - - - - - - - @@ -5786,8 +5240,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5802,8 +5256,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5821,11 +5275,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - @@ -5844,8 +5293,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5856,10 +5305,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - @@ -5875,8 +5320,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - + + @@ -5896,10 +5341,6 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - @@ -5942,12 +5383,42 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'cargosoft-export']] - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workflow/dwc/zahlungseingang-dwc-1.0.3-draft.bpmn b/workflow/dwc/zahlungseingang-dwc-1.0.3.bpmn similarity index 84% rename from workflow/dwc/zahlungseingang-dwc-1.0.3-draft.bpmn rename to workflow/dwc/zahlungseingang-dwc-1.0.3.bpmn index e43d524..fb34d77 100644 --- a/workflow/dwc/zahlungseingang-dwc-1.0.3-draft.bpmn +++ b/workflow/dwc/zahlungseingang-dwc-1.0.3.bpmn @@ -40,11 +40,42 @@ ]]> - - + +name + +

+Debitor: dbtr.name (dbtr.number) +

+

+Payment details: payment.date : payment.amount payment.currency +

+ + + + + + + + + + -application.urlindex.jsf?workitem=$uniqueid - + + + + + + + + + + + + + + +
No.DateDue DateTotalBalancePayment
invoice.numberinvoice.dateinvoice.duedateinvoice.total invoice.currencyinvoice.saldo invoice.currencypayment.amount invoice.currency
]]>
@@ -170,6 +201,8 @@ Task_6 DataObject_1 + event_rs4HbQ + gateway_gSQAJA Task_2 @@ -288,8 +321,8 @@ result.isValid=true; $workflowgroup - $workflowstatus]]> SequenceFlow_6 SequenceFlow_10 - SequenceFlow_3 sequenceFlow_HyzQdw + sequenceFlow_s7bTKw
@@ -299,6 +332,7 @@ result.isValid=true; SequenceFlow_13 SequenceFlow_5 + sequenceFlow_ck6Btg SequenceFlow_10 @@ -611,7 +645,7 @@ result.isValid=true; - + @@ -658,41 +692,7 @@ result.isValid=true; Html-Header E-Mail - Receipt of Payment -
-name
-
-

-Debitor: dbtr.name (dbtr.number) -

-

-Payment details: payment.date : payment.amount payment.currency -

- - - - - - - - - - - - - - - - - - - - - - - - - -
No.DateDue DateTotalBalancePayment
invoice.numberinvoice.dateinvoice.duedateinvoice.total invoice.currencyinvoice.saldo invoice.currencypayment.amount invoice.currency
+Mail-Body E-Mail - Receipt of Payment Footer Html-Footer ]]>
@@ -757,6 +757,112 @@ result.isValid=true; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + home]]> + + + + + + + + + dbtr.mail.]]> + + + false + + + + + + + + + + + + + + Html-Header +E-Mail - Receipt of Payment +Mail-Body +E-Mail - Receipt of Payment Footer +Html-Footer +]]> + + + + + + + + + DataOutput_1 + + + DataOutput_1 + + + sequenceFlow_ck6Btg + sequenceFlow_vDNaXA + + + + + SequenceFlow_3 + sequenceFlow_vDNaXA + sequenceFlow_s7bTKw + + + + + + + + + + @@ -801,13 +907,13 @@ th { font-weight: bold;} - + - + - + @@ -825,7 +931,7 @@ th { font-weight: bold;} - + @@ -840,24 +946,24 @@ th { font-weight: bold;} - + - + - + - + - + - + - + @@ -873,15 +979,15 @@ th { font-weight: bold;} - + - + - + - + @@ -891,26 +997,26 @@ th { font-weight: bold;} - - - + + + - - + + + - - - + + + - - - + + @@ -919,8 +1025,8 @@ th { font-weight: bold;} - - + + @@ -933,22 +1039,21 @@ th { font-weight: bold;} - + - - - + + + - - + + - - - + + @@ -959,13 +1064,13 @@ th { font-weight: bold;} - - + + - + - + @@ -1014,6 +1119,31 @@ th { font-weight: bold;} + + + + + + + + + + + + + + + + + + + + + + + + +