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

Applying a Discount with more than 2 decimals ends up in wrong calculation #723

Open
pannagger opened this issue Jan 31, 2025 · 0 comments

Comments

@pannagger
Copy link

Hi folks,

We encountered an issue when applying a discount on a ZFItem with more than 2 decimal places, for example, "12.20040000" Euros. This number results from a discount on the document level divided by an odd quantity.

The problem occurs in:

mustangproject/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java at Line 59.

Here, the setScale(..) method uses 2 as the new scale, which causes the total net amount (with other similar positions) to be 211.10 instead of 211.094000. After applying the VAT of 19% and rounding the result to 2 decimal places, the total becomes 251.21 instead of 251.20.

I recommend to adapt the mentioned line to use a scale of 18 like in Line 58.

Kind regards
Philip

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

No branches or pull requests

1 participant