Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BR_IC_08 incorrect fail? #336

Closed
ubabap opened this issue Feb 3, 2023 · 9 comments
Closed

BR_IC_08 incorrect fail? #336

ubabap opened this issue Feb 3, 2023 · 9 comments
Assignees
Milestone

Comments

@ubabap
Copy link

ubabap commented Feb 3, 2023

Hello,

checking the Rule BR_IC_08 in the attached example , i do not see the reason for the reported failure.

[BR-IC-08]-In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Intra-community supply" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Intra-community supply".

Or: (BT-116)1421.70 = (BT-131)1225.60 + (BT-92)196.10
Screenshot 2023-02-03 173531
BR_IC_08.txt

What is wrong with that rule according Schematron rules for EN16931 (CII) (val-sch.1) checked with version 2.2 ?

Hoping for any help
with best regards

Ulrich Becker

@phax
Copy link
Collaborator

phax commented Feb 3, 2023

Note: XRechnung 2.2 uses CEN rules 1.3.7 but the error can be reproduced with CEN rules 1.3.9:

Error

Location: BR_IC_08.txt

Element/context: /rsm:CrossIndustryInvoice[1]/rsm:SupplyChainTradeTransaction[1]/ram:ApplicableHeaderTradeSettlement[1]/ram:ApplicableTradeTax[1]/ram:CategoryCode[1]

XPath test: ../ram:BasisAmount = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement[ram:ApplicableTradeTax/ram:CategoryCode = 'K']/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='K']/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='K']/ram:ActualAmount)*10*10)div 100)

Error message: [BR-IC-08]-In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Intra-community supply" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Intra-community supply".

@ubabap
Copy link
Author

ubabap commented Feb 3, 2023

I don't get the comment.
Yes there is a error message, but there is only one higher basisAmount in the file with 1421.70
and there is only one LineTotalAmount o the Leve of the rule of 1225.60 ( with K)
and one Charge indicator (with K) of 196.10
So for my the rule should be folowed, but the validation fails.

So why does it fail, when the Sum is correct ?

Actually there is an similar issue reported
kosit_issue77

Trying with a simple xpath tester even with the round added : the result is Double='1421.6999999999998'

@phax
Copy link
Collaborator

phax commented Feb 3, 2023

I was not trying to answer. I was just putting the question in context :) Because XRechnung 2.2 uses an older version of the rules, I wanted to avoid an initial rejection.

I guess it is again a round problem. I leave that to @oriol to determine - Thanks for the example file.

@ubabap
Copy link
Author

ubabap commented Feb 3, 2023

Ok, Thank you .

Actually with:

((round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement[ram:ApplicableTradeTax/ram:CategoryCode = 'K']/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount)*100 ) ) +(round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=true() and ram:CategoryTradeTax/ram:CategoryCode='K']/ram:ActualAmount)*100)) -(round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/udt:Indicator=false() and ram:CategoryTradeTax/ram:CategoryCode='K']/ram:ActualAmount)*100 ))) div 100

It worked in a tester:
Double='1421.7' Is the result then on the right side
But maybe it is better use a round for the amount to be compared too and skip the div . Only compare "integers" .

My Question.
I am on a customer that does send invoices and only checking with validators and the released ones are stating to be 2.2..
It is not easy to argue, that the validation is wrong and not our document.

@phax
Copy link
Collaborator

phax commented Feb 3, 2023

Yes in this particular case it seems to be a bug in the validation rules and your document is fine. Please contact the XRechnung support team for details how to progress in this particular case.

@oriol
Copy link
Collaborator

oriol commented Feb 7, 2023

Hi @ubabap, you are right, the rule as is raises an error due to the calculation and rounding. It shall be corrected in the next release of the validation artefacts. Thanks for spotting the problem.

@oriol oriol added this to the v1.3.5 milestone Feb 7, 2023
@phax
Copy link
Collaborator

phax commented Feb 7, 2023

@oriol The last release was 1.3.9 - I think the milestone 1.3.5 is invalid

@oriol oriol removed this from the v1.3.5 milestone Feb 7, 2023
@oriol
Copy link
Collaborator

oriol commented Feb 7, 2023

indeed, a mistake

@oriol oriol added this to the 1.3.10 milestone Mar 29, 2023
@oriol oriol self-assigned this Mar 29, 2023
@oriol
Copy link
Collaborator

oriol commented Mar 29, 2023

Added a slack of 1 in the calculation

@oriol oriol closed this as completed in e1fd129 Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants