MLInvoice icon indicating copy to clipboard operation
MLInvoice copied to clipboard

VAT (25.5%) may be rounded inconsistently when third decimal is 5

Open spiregarden opened this issue 1 month ago • 5 comments

Our Finvoice operator seems to bounce some invoices because of a rounding error:

InvoiceNo 12345678: Checking LegalTotal gave a difference that is too large. -0,01 > 0,005 InvoiceNo 12345678: Total amount is not correct: Total excluding VAT + VAT + rounding amount <> Total including VAT InvoiceNo 12345678: Total amount of invoice is incorrect.:267,00 + 68,08 + 0,00 <> 335,09 (0,01) InvoiceNo 12345678: Invoice validation failed

So here the VAT amount would be 68,085 and MLInvoice rounds it down to 68,08. The rounding error seems to occur only when the third decimal is 5.

I tried to add explicit rounding in miscRound2Decim, but it didn't help. Somewhere in the code there's a rounding calculation that don't adhere to the "round half up" rule.

Any pointers, anyone?

spiregarden avatar Jan 27 '25 14:01 spiregarden