ConnectingEurope / eInvoicing-EN16931

Validation artefacts for the European eInvoicing standard EN 16931
Other
136 stars 53 forks source link

CII validation (example file) #73

Closed alarj closed 5 years ago

alarj commented 6 years ago

Hi, We are currently implementing both CII and UBL Invoice import from Peppol for EN 16931. We try to construct identical test invoice files for UBL and CII.
And while preparing those files have come across an interesting case -- UBL example is valid, CII example is not.

We got error message from CEF validator (webservice at http://13.80.11.48:8000/invoice/api/validation) like this:

 <ns3:reports>
               <ns3:error xsi:type="ns3:BAR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns3:description>[BR-CO-12]-Sum of charges on document level (BT-108) = Σ Document level charge amount (BT-99).</ns3:description>
                  <ns3:location>xml:630:0</ns3:location>
                  <ns3:test>(not(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator='true'])and not (ram:ChargeTotalAmount)) or ram:ChargeTotalAmount = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator='true']/ram:ActualAmount)* 10 * 10 ) div 100)</ns3:test>
               </ns3:error>
               <ns3:error xsi:type="ns3:BAR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns3:description>[BR-CO-13]-Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).</ns3:description>
                  <ns3:location>xml:630:0</ns3:location>
                  <ns3:test>(ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount + ram:ChargeTotalAmount) or      ((ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount) and not (ram:ChargeTotalAmount)) or      ((ram:TaxBasisTotalAmount = ram:LineTotalAmount + ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount)) or      ((ram:TaxBasisTotalAmount = ram:LineTotalAmount) and not (ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount))</ns3:test>
               </ns3:error>
               <ns3:error xsi:type="ns3:BAR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns3:description>[BR-CO-16]-Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).</ns3:description>
                  <ns3:location>xml:630:0</ns3:location>
                  <ns3:test>(ram:DuePayableAmount = ram:GrandTotalAmount - ram:TotalPrepaidAmount + ram:RoundingAmount) or      ((ram:DuePayableAmount = ram:GrandTotalAmount + ram:RoundingAmount) and not (ram:TotalPrepaidAmount)) or      ((ram:DuePayableAmount = ram:GrandTotalAmount - ram:TotalPrepaidAmount) and not (ram:RoundingAmount)) or      ((ram:DuePayableAmount = ram:GrandTotalAmount) and not (ram:TotalPrepaidAmount) and not (ram:RoundingAmount))</ns3:test>
               </ns3:error>
               <ns3:error xsi:type="ns3:BAR" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <ns3:description>[BR-S-08]-For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is "Standard rated", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is “Standard rated” and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).</ns3:description>
                  <ns3:location>xml:548:0</ns3:location>
                  <ns3:test>every $rate in ../ram:RateApplicablePercent satisfies (../ram:BasisAmount = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement[ram:ApplicableTradeTax/ram:CategoryCode = 'S' and ram:ApplicableTradeTax/ram:RateApplicablePercent =$rate]/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount) * 10 * 10) div 100 + round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator='true' and ram:CategoryTradeTax/ram:CategoryCode='S' and ram:CategoryTradeTax/ram:RateApplicablePercent=$rate]/ram:ActualAmount) * 10 * 10) div 100 - round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator='false' and ram:CategoryTradeTax/ram:CategoryCode='S' and ram:CategoryTradeTax/ram:RateApplicablePercent=$rate]/ram:ActualAmount) * 10 * 10) div 100))</ns3:test>
               </ns3:error>
            </ns3:reports>

The same error is also coming from validator at https://peppol.helger.com/public/locale-en_US/menuitem-validation-bis2.

We have lack of ideas -- is there something wrong in our CII example or is the problem at validator side... Both files are attached. Invoice_examples.zip

Thank a lot if someone has time to investigate a little bit.

MartinForsberg-Ecru commented 6 years ago

Hi,

I took a quick look using https://open.validex.net and it seems the values are not identical for the charges. That explains the first two validations errors. I didn’t look into the other two due to the fact that it is now Friday evening 😊.

Best regards Martin Forsberg

DianaCarlson commented 6 years ago

Hello Martin,

Thank you very much for the reply. Just got over a long interval to deal with the issue again. Tried with Validex also. Have managed to locate the issue causing to problems, so now got down to two. And still cannot find, what is wrong. Have never assembeld a CII example before, so would really appreciate some help and fresh view on what am i placing wrong in it.

Error 1: [BR-CO-13]-Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).

Invoice values are as follows: BT-109 = 1066.37 BT-131 = 1045.46 BT-107 = 156.82 BT-108 = 177.73

Ending up in such equation= 1045.46 - 156.82 + 177.73 = 1066.37

Seems to match?

Error 2: [BR-CO-16]-Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).

Invoice values are as follows: BT-115 = 792.88 BT-112 = 1327.87 BT-113 = 534.98 BT-114 = -0.01

Ending up with = 1327.82 - 534.98+-0.01=792.88 Seems to match?

Could you please help, if i am using wrong elements or some other error.

Best Regards Diana DEB_positive_invoice_CII.xml.zip

oriol commented 5 years ago

Solved casting to xs:decimal