konik-io / konik

A library to create, read and validate ZUGFeRD compliant invoices. Available for Java and .NET
https://konik.io
Other
46 stars 18 forks source link

Payment in PaymentDiscountTerms can not be assigned with correct precision #66

Closed AchuThanFinstreet closed 5 years ago

AchuThanFinstreet commented 5 years ago

I am trying to use a 4-digit-precision-amount to PaymentDiscountTerm.setBasis() on my extended-profile-invoice. Nevertheless the xml-data of the created pdf will contain a 2-digit Number. This is the error-message in "www.din-zugferd-validation.org": Preise und Zwischenwerte bei der Rabattberechnung müssen nach der ZUGFeRD-Vorgabe mit 4 Nachkommastellen angegeben werden. So we must use here 4-digit precision according to ZUGFeRD-specification.

This is how I tried to create the Amount-Object in Kotlin:

Amount(BigDecimal.valueOf(value).setScale(4, RoundingMode.HALF_UP), CurrencyCode.getByCode(currency))

Konik-configs have this set: io.konik.jaxb.adapter.TwoDigitRoundingAdapter.scale=2 io.konik.jaxb.adapter.TwoDigitRoundingAdapter.roundingMode=HALF_UP io.konik.jaxb.adapter.FourDigitRoundingAdapter.scale=4 io.konik.jaxb.adapter.FourDigitRoundingAdapter.roundingMode=HALF_UP

We can't create a valid invoice-pdf with a discount in EXTENDED-profile or am I missing something?

Vad1mo commented 5 years ago

1943 6.6.2 Decimal points 1944 Amounts are shown to two decimal places and are rounded where necessary (e.g. 15.00). 1945 VAT rates are stated as percentages with maximum 2 decimals. E.g. twenty one and one third percent is 1946 stated as 21.33. Quantities are shown to four decimal places (e.g. 1.0000). 1947 Prices and interim values in the calculation of the discount are shown to four decimal places (e.g. 0.6667).

AchuThanFinstreet commented 5 years ago

since this is about the class PaymentDiscountTerm, the line 1947 should apply, but currently the definition of line 1944 is used. So this is why the validation of "www.din-zugferd-validation.org" is complaining.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.