Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong exchange rate used for US sales when "Lateinamerika und Karibik (USD)" is present in currency data file #1

Closed
blach opened this issue Apr 24, 2024 · 2 comments · Fixed by #2

Comments

@blach
Copy link

blach commented Apr 24, 2024

When there is a row for "Lateinamerika und Karibik (USD)", the wrong exchange rate is used for "Nord- und Südamerika (USD)".

You already handle that USD can appear twice in currency data, but in fact it can occur three times when there were sales in Latin America and the Caribbean.

This code would need to be changed to account for this:

// USD can occur twice in the file: We must take special care to distinguish between USD (and their corresponding
// exchange rate) for purchases made in "Americas" and in "Rest of World", as Apple calls it. Unfortunately, Apple
// decided to localize the aforementioned strings so they need to be looked up in a translation table. Luckily,
// localized report files currently seem to be generated only for French, German, Italian and Spanish locale settings.
let localizationsRoW = ["of World", "du monde", "der Welt", "del mondo", "del mundo"]
if currency == "USD" {
for localization in localizationsRoW {
if currencyCol.lowercased().contains(localization.lowercased()) {
currency = "USD - RoW"
}
}
}

Here are three example lines from a German currency data .csv file:

"Rest der Welt (USD)","3","26.37","26.37","0","0","0","26.37","0.92074","24.28","EUR",
"Lateinamerika und Karibik (USD)","2","19.53","19.53","0","0","0","19.53","0.92063","17.98","EUR",
"Nord- und Südamerika (USD)","253","2381.72","2381.72","0","0","0","2381.72","0.92080","2193.09","EUR",

In this case I had USD sales in Dominican Republic (DO) and Nicaragua (NI).

When importing this file, the exchange rate 0.92063 is used for Apple Inc. sales instead of the 0.92080 exchange rate, resulting in wrong invoice totals for US sales.

Thanks for the great tool!

@mikakruschel
Copy link
Member

Thank you so much for reporting this!

@fedoco
Copy link

fedoco commented Apr 25, 2024

Hi there, please consider reporting issues like this upstream as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants