eInvoicing-EN16931 icon indicating copy to clipboard operation
eInvoicing-EN16931 copied to clipboard

Validate line total

Open jstaerk opened this issue 1 year ago • 6 comments

https://unece.org/fileadmin/DAM/uncefact/BRS/BRS_CII_v2.0.6.pdf INV-176 says the line item amount should be quantity * net amount (+ charges - allowances). image001

I've seen invoices in the wild which were miscalculated. This is an anonymized where a line for 86.12 is just claimed to be worth 10€ straight and which does not, but should raise an error:

factur-x.txt

jstaerk avatar Jun 15 '23 13:06 jstaerk

The proposed calculation is incomplete as it does not include e.g. the PriceBaseUnit. A harmonised standard on invoice line calculation is needed that includes, for instance, the requirements of the energy sector as well. The complete invoice syntaxes (CII as well as UBL) provide for this reason additional calculation elements that are (currently) not supported by the EN16931. For this reason, it is currently not possible to define a correct invoice-amount calculation based on the EN16931 provided information fields that is applicable to many big industries.

First the EN16931 should be amended to support the necessary information – then a harmonised calculation scheme should be defined and then implemented.

AndreasPvd avatar Aug 02 '23 13:08 AndreasPvd

The proposed calculation is incomplete as it does not include e.g. the PriceBaseUnit. A harmonised standard on invoice line calculation is needed that includes, for instance, the requirements of the energy sector as well. The complete invoice syntaxes (CII as well as UBL) provide for this reason additional calculation elements that are (currently) not supported by the EN16931.

What are these additional calculation elements? If they are relevant to me it would sound as if they may be business requirements?

jstaerk avatar May 07 '24 06:05 jstaerk

For the time being, there is no calculation rule on line level in EN16931. It has been withdrawn because of rounding issues for too much companies.

The initial rule was BT-131 = Net Unit Price (BT-146) / BT-149 (base quantity for Unit Price) * Invoices Quantity (BT-129) + sum of Line Charges (sum of BT-141) - Sum of line Allowances (sum of BT-136)

And Net Unit Price = Gros Unit Price (BT-148) - Discount on Unit Price (BT-147)

csautereau avatar Sep 05 '24 13:09 csautereau

In addition, in the BRS document Gross price means Unit Price including VAT. We also need to handle invoices calculated based on Unit Prices including VAT (as it exists on B2C).

In EDIFACT, if I remember well, It is said somewhere that the calculation is based on Gross Unit Price (which means that all VAT calculation is different, with a mathematical rounding issue of 1 cent maximum each time a VAT is calculated).

EN16931 was designed only for B2B / B2G invoices where Unit Prices are not including VAT, and VAT is calculated on document level only.

csautereau avatar Sep 05 '24 13:09 csautereau