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 454f213..12e8b63 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
@@ -10,7 +10,6 @@ import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.LocalDate;
import java.time.ZoneId;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@@ -140,67 +139,6 @@ public class ZohoAPIService {
}
- /**
- * This finder method returns the tax ID to a given percentage.
- * The method returns null if no tax with this percentage exists
- *
- * @param tax_percentage
- * @param accessToken
- * @return taxID
- * @throws PluginException
- */
- public String findTaxIDByPercentage(float tax_percentage, String accessToken)
- throws PluginException {
-
- if (tax_percentage == 0.0) {
- return null;
- }
- // Print JSON to console for verification
- logger.info("├── Zoho lookup tax '" + tax_percentage + "'...");
- try {
- // https://www.zohoapis.com/books/v3/settings/taxes?organization_id=10234695&company_name=xxx'
- String uri = zohoOAuthManager.getBaseURI() + "settings/taxes?organization_id="
- + zohoOAuthManager.getOrganization();
- logger.fine("│ ├── uri= " + uri);
- logger.fine("│ ├── accessToken=" + accessToken);
- HttpRequest request = HttpRequest.newBuilder().uri(URI.create(uri))
- .header("Authorization", "Zoho-oauthtoken " + accessToken)
- .header("Content-Type", "application/json").GET().build();
-
- HttpResponse response;
-
- response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
-
- // Print response details to console
- logger.fine("├── Zoho Response:");
- logger.fine("│ ├── Status Code: " + response.statusCode());
- logger.fine("│ ├── Response Body: " + response.body());
- if (response.statusCode() >= 300) {
- throw new PluginException(this.getClass().getName(), "Zoho API error",
- "Failed to find Contacts - Status code: " + response.statusCode() + ", Response: "
- + response.body());
- }
-
- ZohoTaxListResponse taxListResponse = jsonb.fromJson(response.body(), ZohoTaxListResponse.class);
-
- if (taxListResponse != null && taxListResponse.getTaxes() != null) {
- // Durchsuche die Ergebnisse nach exakter Übereinstimmung
- for (ZohoTax tax : taxListResponse.getTaxes()) {
- if (tax_percentage == tax.getRate()) {
- logger.info("│ ├── taxID= " + tax.getTaxId());
- return tax.getTaxId();
- }
- }
- }
- logger.warning("│ ├── No tax with " + tax_percentage + "% found in Zoho taxes!");
- } catch (IOException | InterruptedException e) {
- throw new PluginException(this.getClass().getName(), "Zoho API error",
- "Failed to find tax: " + e.getMessage());
- }
- return null;
-
- }
-
/**
* Exports an invocie document
*
@@ -213,8 +151,10 @@ public class ZohoAPIService {
throws PluginException {
logger.info("├── Zoho Export Invoice " + invoice.getItemValueString("invoice.number") + "...");
+ String currencyID = lookupCurrency(invoice.getItemValueString("invoice.currency"), accessToken);
+
// Konvertiere ItemCollection zu ZohoInvoiceDTO
- ZohoInvoice zohoInvoice = convertToZohoInvoice(invoice, contactID);
+ ZohoInvoice zohoInvoice = convertToZohoInvoice(invoice, contactID, currencyID);
try {
String requestBody = jsonb.toJson(zohoInvoice);
@@ -284,8 +224,10 @@ public class ZohoAPIService {
String accessToken) throws PluginException {
logger.info("├── Zoho Export creditnote " + invoice.getItemValueString("invoice.number") + "...");
+ String currencyID = lookupCurrency(invoice.getItemValueString("invoice.currency"), accessToken);
+
// Konvertiere ItemCollection zu ZohoInvoiceDTO
- ZohoCreditnote zohoCreditnote = convertToZohoCreditnote(invoice, contactID);
+ ZohoCreditnote zohoCreditnote = convertToZohoCreditnote(invoice, contactID, currencyID);
try {
String requestBody = jsonb.toJson(zohoCreditnote);
@@ -354,8 +296,10 @@ public class ZohoAPIService {
String accessToken) throws PluginException {
logger.info("├── Zoho Export Bill " + invoice.getItemValueString("invoice.number") + "...");
+ String currencyID = lookupCurrency(invoice.getItemValueString("invoice.currency"), accessToken);
+
// Konvertiere ItemCollection zu ZohoInvoiceDTO
- ZohoBill zohoBill = convertToZohoBill(invoice, contactID, accountID);
+ ZohoBill zohoBill = convertToZohoBill(invoice, contactID, accountID, currencyID);
try {
String requestBody = jsonb.toJson(zohoBill);
@@ -422,8 +366,10 @@ public class ZohoAPIService {
String accessToken) throws PluginException {
logger.info("├── Zoho Export VendorCredit " + invoice.getItemValueString("invoice.number") + "...");
+ String currencyID = lookupCurrency(invoice.getItemValueString("invoice.currency"), accessToken);
+
// Konvertiere ItemCollection zu ZohoInvoiceDTO
- ZohoVendorCredit zohoVendorCredit = convertToZohoVendorCredit(invoice, contactID, accountID);
+ ZohoVendorCredit zohoVendorCredit = convertToZohoVendorCredit(invoice, contactID, accountID, currencyID);
try {
String requestBody = jsonb.toJson(zohoVendorCredit);
@@ -480,18 +426,6 @@ public class ZohoAPIService {
}
- public String lookupContact(String companyName, String contactType, String accessToken) throws PluginException {
- // first lookup contact!
- String contactID = "";
- contactID = findContactIDByCompanyName(companyName, contactType, accessToken);
- if (contactID == null) {
- logger.info("│ ├── contact '" + companyName + "' not found");
- ZohoContact contact = createContact(companyName, contactType, accessToken);
- contactID = contact.getContactId();
- }
- return contactID;
- }
-
/**
* Erstellt einen neuen Contact in Zoho Books
*
@@ -500,7 +434,7 @@ public class ZohoAPIService {
* @return Der erstellte ZohoContact mit contact_id
* @throws PluginException Wenn der API-Aufruf fehlschlägt
*/
- public ZohoContact createContact(String companyName, String contactType, String accessToken)
+ public ZohoContact createContact(String companyName, String contactType, String currencyID, String accessToken)
throws PluginException {
logger.info("├── Zoho create contact '" + companyName + "'...");
try {
@@ -510,6 +444,11 @@ public class ZohoAPIService {
newContact.setCompanyName(companyName);
newContact.setContactType(contactType);
+ // set currency?
+ if (currencyID != null && !currencyID.isEmpty()) {
+ newContact.setCurrencyId(currencyID);
+ }
+
// JSON serialisieren
String requestBody = jsonb.toJson(newContact);
logger.fine("│ ├── " + requestBody);
@@ -548,7 +487,16 @@ public class ZohoAPIService {
}
- private ZohoInvoice convertToZohoInvoice(ItemCollection invoice, String contactID)
+ /**
+ * Ausgangsrechnung
+ *
+ * @param invoice
+ * @param contactID
+ * @param currencyID
+ * @return
+ * @throws PluginException
+ */
+ private ZohoInvoice convertToZohoInvoice(ItemCollection invoice, String contactID, String currencyID)
throws PluginException {
ZohoInvoice zohoInvoice = new ZohoInvoice();
@@ -562,39 +510,45 @@ public class ZohoAPIService {
zohoInvoice.setCustomerId(contactID);
- // convert total by rate
- zohoInvoice.setTotal(convertInvoiceTotalToAED(invoice, invoice.getItemValueDouble("invoice.total")));
+ // set currency?
+ if (currencyID != null && !currencyID.isEmpty()) {
+ zohoInvoice.setCurrencyId(currencyID);
+ }
- /*
- * Change: 10.06.2025
- * Das Cargosoft unlogische Positionen sendet, ZOHO diese aber erzwingt,
- * erzeugen wir nur noch eine einzige Zeile mit dem tatsächlichen Betrag!
- *
- */
- // List positionen = InvoiceUtil.explodeChildList(invoice);
- // List lineItems = positionen.stream().map(item -> {
- // ItemCollection itemCol = (ItemCollection) item;
- // ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
- // lineItem.setName(itemCol.getItemValueString("datev.text"));
- // lineItem.setDescription(itemCol.getItemValueString("billingtext"));
- // lineItem.setRate(convertInvoiceTotalToAED(invoice,
- // itemCol.getItemValueDouble("datev.umsatz")));
- // lineItem.setQuantity(1);
- // return lineItem;
- // }).collect(Collectors.toList());
- List lineItems = new ArrayList<>();
- ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
- lineItem.setName(invoice.getItemValueString("invoice.text"));
- lineItem.setDescription("");
- lineItem.setRate(convertInvoiceTotalToAED(invoice, invoice.getItemValueDouble("invoice.total")));
- lineItem.setQuantity(1);
- lineItems.add(lineItem);
+ // convert total by rate
+ zohoInvoice.setTotal(invoice.getItemValueDouble("invoice.total"));
+ // set exchange Rate
+ double exchangeRate = invoice.getItemValueDouble("invoice.rate");
+ if (exchangeRate != 0.0) {
+ zohoInvoice.setExchangeRate(exchangeRate);
+ }
+
+ // add line items...
+ List positionen = InvoiceUtil.explodeChildList(invoice);
+ List lineItems = positionen.stream().map(item -> {
+ ItemCollection itemCol = (ItemCollection) item;
+ ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
+ lineItem.setName(itemCol.getItemValueString("datev.text"));
+ lineItem.setDescription(itemCol.getItemValueString("billingtext"));
+ lineItem.setRate(itemCol.getItemValueDouble("datev.umsatz"));
+ lineItem.setQuantity(1);
+ return lineItem;
+ }).collect(Collectors.toList());
zohoInvoice.setLineItems(lineItems);
return zohoInvoice;
}
- private ZohoCreditnote convertToZohoCreditnote(ItemCollection invoice, String contactID)
+ /**
+ * Gutschrift Ausgang
+ *
+ * @param invoice
+ * @param contactID
+ * @param currencyID
+ * @return
+ * @throws PluginException
+ */
+ private ZohoCreditnote convertToZohoCreditnote(ItemCollection invoice, String contactID, String currencyID)
throws PluginException {
ZohoCreditnote zohoCreditnote = new ZohoCreditnote();
@@ -608,35 +562,29 @@ public class ZohoAPIService {
zohoCreditnote.setCustomerId(contactID);
- // convert total by rate - negativer betrag!
- zohoCreditnote
- .setTotal(convertInvoiceTotalToAED(invoice, Math.abs(invoice.getItemValueDouble("invoice.total"))));
+ // set currency?
+ if (currencyID != null && !currencyID.isEmpty()) {
+ zohoCreditnote.setCurrencyId(currencyID);
+ }
- /*
- * Change: 10.06.2025
- * Das Cargosoft unlogische Positionen sendet, ZOHO diese aber erzwingt,
- * erzeugen wir nur noch eine einzige Zeile mit dem tatsächlichen Betrag!
- *
- */
- // List positionen = InvoiceUtil.explodeChildList(invoice);
- // List lineItems = positionen.stream().map(item -> {
- // ItemCollection itemCol = (ItemCollection) item;
- // ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
- // lineItem.setName(itemCol.getItemValueString("datev.text"));
- // lineItem.setDescription(itemCol.getItemValueString("billingtext"));
- // lineItem.setRate(convertInvoiceTotalToAED(invoice,
- // itemCol.getItemValueDouble("datev.umsatz")));
- // lineItem.setQuantity(1);
- // return lineItem;
- // }).collect(Collectors.toList());
- List lineItems = new ArrayList<>();
- ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
- lineItem.setName(invoice.getItemValueString("invoice.text"));
- lineItem.setDescription("");
- // negativer Betrag!
- lineItem.setRate(convertInvoiceTotalToAED(invoice, Math.abs(invoice.getItemValueDouble("invoice.total"))));
- lineItem.setQuantity(1);
- lineItems.add(lineItem);
+ // convert total by rate - negativer betrag!
+ zohoCreditnote.setTotal(Math.abs(invoice.getItemValueDouble("invoice.total")));
+ // set exchange Rate
+ double exchangeRate = invoice.getItemValueDouble("invoice.rate");
+ if (exchangeRate != 0.0) {
+ zohoCreditnote.setExchangeRate(exchangeRate);
+ }
+
+ List positionen = InvoiceUtil.explodeChildList(invoice);
+ List lineItems = positionen.stream().map(item -> {
+ ItemCollection itemCol = (ItemCollection) item;
+ ZohoInvoiceItem lineItem = new ZohoInvoiceItem();
+ lineItem.setName(itemCol.getItemValueString("datev.text"));
+ lineItem.setDescription(itemCol.getItemValueString("billingtext"));
+ lineItem.setRate(itemCol.getItemValueDouble("datev.umsatz"));
+ lineItem.setQuantity(1);
+ return lineItem;
+ }).collect(Collectors.toList());
zohoCreditnote.setLineItems(lineItems);
return zohoCreditnote;
@@ -645,8 +593,8 @@ public class ZohoAPIService {
/**
* Diese Hilfsmethode rechnet den Rechnungsbetrag in Fremdwährung auf AED um
*
- * es ist eine Fremdwährung
- * Herr Heolzl 15.05.2025
+ *
+ * Herr Hoelzl 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.
@@ -655,7 +603,8 @@ public class ZohoAPIService {
*
* @return
*/
- public double convertInvoiceTotalToAED(ItemCollection invoice, double total) {
+ @Deprecated
+ public double xxxxconvertInvoiceTotalToAED(ItemCollection invoice, double total) {
// convert total by fixed rate?
String currency = invoice.getItemValueString("invoice.currency");
if (!currency.isEmpty() && !currency.equalsIgnoreCase("AED")) {
@@ -687,20 +636,30 @@ public class ZohoAPIService {
}
}
- private ZohoBill convertToZohoBill(ItemCollection invoice, String contactID, String accountID)
+ private ZohoBill convertToZohoBill(ItemCollection invoice, String contactID, String accountID, String currencyID)
throws PluginException {
ZohoBill zohoBill = new ZohoBill();
- // Basisinformationen
+ // Kunden-ID (muss angepasst werden je nachdem wie du sie speicherst)
+ zohoBill.setVendorId(contactID);
+
+ // set currency?
+ if (currencyID != null && !currencyID.isEmpty()) {
+ zohoBill.setCurrencyId(currencyID);
+ }
+ // Basisinformationen
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);
+ // set exchange Rate
+ double exchangeRate = invoice.getItemValueDouble("invoice.exchangerate");
+ if (exchangeRate != 0.0) {
+ zohoBill.setExchangeRate(exchangeRate);
+ }
// zohoBill.setPaid_through_account_id("1700");
List positionen = InvoiceUtil.explodeChildList(invoice);
@@ -712,12 +671,12 @@ public class ZohoAPIService {
lineItem.setName(itemCol.getItemValueString("name"));
lineItem.setAccountId(accountID);
lineItem.setQuantity(1);
- lineItem.setRate(convertInvoiceTotalToAED(invoice, itemCol.getItemValueDouble("amount")));
+ lineItem.setRate(itemCol.getItemValueDouble("amount"));
// tax - tax_id, tax_percentage
try {
float tax = itemCol.getItemValueFloat("tax");
- String taxID = findTaxIDByPercentage(tax, accountID);
+ String taxID = lookupTaxID(tax, accountID);
if (taxID != null && !taxID.isEmpty()) {
lineItem.setTaxId(taxID);
}
@@ -732,7 +691,8 @@ public class ZohoAPIService {
return zohoBill;
}
- private ZohoVendorCredit convertToZohoVendorCredit(ItemCollection invoice, String contactID, String accountID)
+ private ZohoVendorCredit convertToZohoVendorCredit(ItemCollection invoice, String contactID,
+ String accountID, String currencyID)
throws PluginException {
ZohoVendorCredit zohoVendorCredit = new ZohoVendorCredit();
@@ -748,6 +708,17 @@ public class ZohoAPIService {
// Kunden-ID (muss angepasst werden je nachdem wie du sie speicherst)
zohoVendorCredit.setVendorId(contactID);
+ // set currency?
+ if (currencyID != null && !currencyID.isEmpty()) {
+ zohoVendorCredit.setCurrencyId(currencyID);
+ }
+
+ // set exchange Rate
+ double exchangeRate = invoice.getItemValueDouble("invoice.exchangerate");
+ if (exchangeRate != 0.0) {
+ zohoVendorCredit.setExchangeRate(exchangeRate);
+ }
+
// zohoBill.setPaid_through_account_id("1700");
List positionen = InvoiceUtil.explodeChildList(invoice);
// {amount=[11825.00], total=[11825.00], numpos=[1], name=[AB-DEFGHI-1234-567],
@@ -758,12 +729,12 @@ public class ZohoAPIService {
lineItem.setName(itemCol.getItemValueString("name"));
lineItem.setAccountId(accountID);
lineItem.setQuantity(1);
- lineItem.setRate(convertInvoiceTotalToAED(invoice, itemCol.getItemValueDouble("amount")));
+ lineItem.setRate(itemCol.getItemValueDouble("amount"));
// tax - tax_id, tax_percentage
try {
float tax = itemCol.getItemValueFloat("tax");
- String taxID = findTaxIDByPercentage(tax, accountID);
+ String taxID = lookupTaxID(tax, accountID);
if (taxID != null && !taxID.isEmpty()) {
lineItem.setTaxId(taxID);
}
@@ -890,8 +861,8 @@ public class ZohoAPIService {
}
/**
- * Sucht eine currency ID Wegen eifnachheit parsen wir hier direkt die JSON
- * struktur
+ * Sucht eine currency ID. Die Methode läd die Liste aller Currencies und parsed
+ * the currency ID mit einer Regex
*
* @param currency
* @param accessToken
@@ -903,7 +874,7 @@ public class ZohoAPIService {
// Print JSON to console for verification
logger.info("├── Zoho lookup currency '" + currency + "'...");
try {
- // https://www.zohoapis.com/books/v3/contacts?organization_id=10234695&company_name=xxx'
+ // https://www.zohoapis.com/books/v3/currencies?organization_id=10234695'
String uri = zohoOAuthManager.getBaseURI() + "settings/currencies?organization_id="
+ zohoOAuthManager.getOrganization();
logger.fine("│ ├── uri= " + uri);
@@ -936,9 +907,94 @@ public class ZohoAPIService {
} catch (IOException | InterruptedException e) {
throw new PluginException(this.getClass().getName(), "Zoho API error",
- "Failed to find Contacts: " + e.getMessage());
+ "Failed to find currency: " + e.getMessage());
}
}
+ /**
+ * This method lookups a Contact by name.
+ * If no contact with the given name exists, the method creats a new one. In
+ * this case the defaultCurrencyID is mandatory!
+ *
+ * @param companyName
+ * @param contactType
+ * @param defaultCurrencyID
+ * @param accessToken
+ * @return
+ * @throws PluginException
+ */
+ public String lookupContact(String companyName, String contactType, String defaultCurrencyID, String accessToken)
+ throws PluginException {
+ // first lookup contact!
+ String contactID = "";
+ contactID = findContactIDByCompanyName(companyName, contactType, accessToken);
+ if (contactID == null) {
+ logger.info("│ ├── contact '" + companyName + "' not found");
+ ZohoContact contact = createContact(companyName, contactType, defaultCurrencyID, accessToken);
+ contactID = contact.getContactId();
+ }
+ return contactID;
+ }
+
+ /**
+ * This finder method returns the tax ID to a given percentage.
+ * The method returns null if no tax with this percentage exists
+ *
+ * @param tax_percentage
+ * @param accessToken
+ * @return taxID
+ * @throws PluginException
+ */
+ public String lookupTaxID(float tax_percentage, String accessToken)
+ throws PluginException {
+
+ if (tax_percentage == 0.0) {
+ return null;
+ }
+ // Print JSON to console for verification
+ logger.info("├── Zoho lookup tax '" + tax_percentage + "'...");
+ try {
+ // https://www.zohoapis.com/books/v3/settings/taxes?organization_id=10234695'
+ String uri = zohoOAuthManager.getBaseURI() + "settings/taxes?organization_id="
+ + zohoOAuthManager.getOrganization();
+ logger.fine("│ ├── uri= " + uri);
+ logger.fine("│ ├── accessToken=" + accessToken);
+ HttpRequest request = HttpRequest.newBuilder().uri(URI.create(uri))
+ .header("Authorization", "Zoho-oauthtoken " + accessToken)
+ .header("Content-Type", "application/json").GET().build();
+
+ HttpResponse response;
+
+ response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ // Print response details to console
+ logger.fine("├── Zoho Response:");
+ logger.fine("│ ├── Status Code: " + response.statusCode());
+ logger.fine("│ ├── Response Body: " + response.body());
+ if (response.statusCode() >= 300) {
+ throw new PluginException(this.getClass().getName(), "Zoho API error",
+ "Failed to find Contacts - Status code: " + response.statusCode() + ", Response: "
+ + response.body());
+ }
+
+ ZohoTaxListResponse taxListResponse = jsonb.fromJson(response.body(), ZohoTaxListResponse.class);
+
+ if (taxListResponse != null && taxListResponse.getTaxes() != null) {
+ // Durchsuche die Ergebnisse nach exakter Übereinstimmung
+ for (ZohoTax tax : taxListResponse.getTaxes()) {
+ if (tax_percentage == tax.getRate()) {
+ logger.info("│ ├── taxID= " + tax.getTaxId());
+ return tax.getTaxId();
+ }
+ }
+ }
+ logger.warning("│ ├── No tax with " + tax_percentage + "% found in Zoho taxes!");
+ } catch (IOException | InterruptedException e) {
+ throw new PluginException(this.getClass().getName(), "Zoho API error",
+ "Failed to find tax: " + e.getMessage());
+ }
+ return null;
+
+ }
}
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 f569f15..8f75583 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
@@ -85,12 +85,14 @@ public class ZohoExportAdapter implements SignalAdapter {
* @throws PluginException
*/
private void exportRechnungsausgang(ItemCollection document, String accessToken) throws PluginException {
+
+ // find currencyID
+ String currencyID = zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), accessToken);
+
// find companyID
String contactID = zohoAPIService.lookupContact(document.getItemValueString("dbtr.name"), "customer",
+ currencyID,
accessToken);
- // String currencyID =
- // zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"),
- // accessToken);
// Gutschrift??
if (document.getItemValueDouble("invoice.total") < 0) {
@@ -142,13 +144,13 @@ public class ZohoExportAdapter implements SignalAdapter {
* @throws PluginException
*/
private void exportRechnungseingang(ItemCollection document, String accessToken) throws PluginException {
+
+ String currencyID = zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"), accessToken);
+
// find companyID
- String contactID = zohoAPIService.lookupContact(document.getItemValueString("cdtr.name"), "vendor",
+ String contactID = zohoAPIService.lookupContact(document.getItemValueString("cdtr.name"), "vendor", currencyID,
accessToken);
- // String currencyID =
- // zohoAPIService.lookupCurrency(document.getItemValueString("invoice.currency"),
- // accessToken);
String accountID = zohoOAuthManager.getAccountId();
// Gutschrift??
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoBill.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoBill.java
index 58a6f44..7b31de7 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoBill.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoBill.java
@@ -30,7 +30,10 @@ public class ZohoBill {
@JsonbProperty("line_items")
private List lineItems;
- private double amount;
+ @JsonbProperty("exchange_rate")
+ private double exchangeRate;
+
+ // private double amount;
// Getter und Setter
@@ -82,13 +85,13 @@ public class ZohoBill {
this.lineItems = lineItems;
}
- public double getAmount() {
- return amount;
- }
+ // public double getAmount() {
+ // return amount;
+ // }
- public void setAmount(double amount) {
- this.amount = amount;
- }
+ // public void setAmount(double amount) {
+ // this.amount = amount;
+ // }
public String getCurrencyId() {
return currencyId;
@@ -98,4 +101,12 @@ public class ZohoBill {
this.currencyId = currencyId;
}
+ public double getExchangeRate() {
+ return exchangeRate;
+ }
+
+ public void setExchangeRate(double exchangeRate) {
+ this.exchangeRate = exchangeRate;
+ }
+
}
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoContact.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoContact.java
index 5086a79..63b695e 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoContact.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoContact.java
@@ -16,6 +16,9 @@ public class ZohoContact {
@JsonbProperty("contact_type")
private String contactType;
+ @JsonbProperty("currency_id")
+ private String currencyId;
+
// Weitere Felder nach Bedarf
// Getter und Setter
@@ -51,4 +54,12 @@ public class ZohoContact {
this.contactType = contactType;
}
+ public String getCurrencyId() {
+ return currencyId;
+ }
+
+ public void setCurrencyId(String currencyId) {
+ this.currencyId = currencyId;
+ }
+
}
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoCreditnote.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoCreditnote.java
index 2451ad3..a2352d4 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoCreditnote.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoCreditnote.java
@@ -29,6 +29,9 @@ public class ZohoCreditnote {
@JsonbProperty("line_items")
private List lineItems;
+ @JsonbProperty("exchange_rate")
+ private double exchangeRate;
+
private double total;
// Getter und Setter
@@ -96,4 +99,12 @@ public class ZohoCreditnote {
public void setCurrencyId(String currencyId) {
this.currencyId = currencyId;
}
+
+ public double getExchangeRate() {
+ return exchangeRate;
+ }
+
+ public void setExchangeRate(double exchangeRate) {
+ this.exchangeRate = exchangeRate;
+ }
}
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoInvoice.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoInvoice.java
index 8d64281..d4b0650 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoInvoice.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoInvoice.java
@@ -30,6 +30,9 @@ public class ZohoInvoice {
@JsonbProperty("line_items")
private List lineItems;
+ @JsonbProperty("exchange_rate")
+ private double exchangeRate;
+
private double total;
// Getter und Setter
@@ -97,4 +100,12 @@ public class ZohoInvoice {
public void setCurrencyId(String currencyId) {
this.currencyId = currencyId;
}
+
+ public double getExchangeRate() {
+ return exchangeRate;
+ }
+
+ public void setExchangeRate(double exchangeRate) {
+ this.exchangeRate = exchangeRate;
+ }
}
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoVendorCredit.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoVendorCredit.java
index c1536b2..d7a48b8 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoVendorCredit.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/zoho/dto/ZohoVendorCredit.java
@@ -23,6 +23,9 @@ public class ZohoVendorCredit {
@JsonbProperty("vendor_credit_number")
private String invoiceNumber;
+ @JsonbProperty("exchange_rate")
+ private double exchangeRate;
+
@JsonbProperty("line_items")
private List lineItems;
@@ -76,4 +79,12 @@ public class ZohoVendorCredit {
this.currencyId = currencyId;
}
+ public double getExchangeRate() {
+ return exchangeRate;
+ }
+
+ public void setExchangeRate(double exchangeRate) {
+ this.exchangeRate = exchangeRate;
+ }
+
}
diff --git a/workflow/dwc/rechnungsausgang-dwc-1.0.5.bpmn b/workflow/dwc/rechnungsausgang-dwc-1.0.5.bpmn
new file mode 100644
index 0000000..fa8ab3a
--- /dev/null
+++ b/workflow/dwc/rechnungsausgang-dwc-1.0.5.bpmn
@@ -0,0 +1,2081 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+$workflowstatus
+
+]]>
+
+
+ In case you have already made the payment, please disregard this notice. If you require any information regarding your account, please do not hesitate to contact us.
+Thank you for your cooperation.
+
+Kind regards
Alexander Global Logistics GmbH
+
+