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