Closed jurajmarkovic closed 6 years ago
Hi. Can you please provide the whole InvoiceLine - so far I don't see the problem. Okay, PriceAmount has more than 2 digits, but LineExtensionAmount has no. E.g. the following example works for me:
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="EA">2</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">19.90</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Name>PATAT FRITES 10MM 10KG</cbc:Name>
<cac:SellersItemIdentification>
<cbc:ID>166022</cbc:ID>
</cac:SellersItemIdentification>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>6</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VA</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="EUR">9.9473</cbc:PriceAmount>
</cac:Price>
</cac:InvoiceLine>
Hi, thanks for your fast reply. I will try to explain more precisely what seems to me could be a problem. PriceAmount has more than 2 digits (and this is OK), but also Price discount has more than 2 digits and this seems to be a problem (InvoiceLine/Price/AllowanceCharge/Amount and BaseAmount). Here is the whole InvoiceLine
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="EA">100.000</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="HRK">12.12</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Name>stavka 1</cbc:Name>
<cac:OriginCountry>
<cbc:IdentificationCode>HR</cbc:IdentificationCode>
</cac:OriginCountry>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>25</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="HRK">0.1212</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:Amount currencyID="HRK">0.0022</cbc:Amount>
<cbc:BaseAmount currencyID="HRK">0.1234</cbc:BaseAmount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
I see your problem.
As soon as <cbc:Amount currencyID="HRK">0.0022</cbc:Amount>
is added to the XML, the validation fails (with UBL-DT-01
).
Reason: the selector //*[ends-with(name(), 'Amount') and not(ends-with(name(),'PriceAmount'))]
is too vague!
exclusion of AllowanceCharge amounts added in the selector.
Will revert this change as in the Norm, table 26 states that allowance and base amount must have a maximum of 2 digits.
For "InvoiceLine Allowance Amount" I fully agree, but for the "non-binding" Price I think it is something different.
So I suggest instead of adding and not(ancestor::cac:AllowanceCharge)
I suggest to add and not(../../cac:Price/cac:AllowanceCharge)
@jurajmarkovic can you please cross check, if that solution works for you - thanks.
Sure, we will check now. I have already tried it on http://13.80.11.48:8000/invoice/upload (not sure if it is the same validator) and we've got an error that something is wrong with sch file: "An error occurred during the validation [Schematron file [/validator/invoice/ubl/schematron/EN16931-UBL-model.sch] is invalid]"
Weird - is this your validator? Did you resolve the error?
Unfortunatelly, we are still facing the same (fatal) errors: [SVRLFailedAssert@0x-128ae031: diagnosticRefs=[]; text=[UBL-DT-01]-Amounts shall be decimal up to two fraction digits; location=/Invoice/cac:InvoiceLine/cac:Price/cac:AllowanceCharge/cbc:Amount; test=string-length(substring-after(.,'.'))<=2; flag=FATAL_ERROR] [SVRLFailedAssert@0x18ebb84b: diagnosticRefs=[]; text=[UBL-DT-01]-Amounts shall be decimal up to two fraction digits; location=/Invoice/cac:InvoiceLine/cac:Price/cac:AllowanceCharge/cbc:BaseAmount; test=string-length(substring-after(.,'.'))<=2; flag=FATAL_ERROR]
Here is the whole Invoice xml: `<?xml version="1.0" encoding="UTF-8"?>
the xpath should be not(ancestor::cac:Price/cac:AllowanceCharge)
Thanks, we will check this first thing in the morning
Everything OK now. Thanks
Thanks for cross-checking and thanks for the error report!
In UBL validation there are [UBL-DT-01]-Amounts shall be decimal up to two fraction digits which raise the error when using more then 2 decimals on Item price discount (BT-147) and Item gross price (BT-148):
According to the EN 16931-1 Semantic data model document, p. 93-94, Table 26 - Allowed number of decimals, there is no restriction on maximum allowed number of decimals for Item net price (BT-146), Item price discount (BT-147) and Item gross price (BT-148). However, in the same table, Invoice line net amount (BT-131), Invoice line allowance amount (BT-136) and base amount (BT-137), Invoice line charge amount (BT-141) and base amount (BT-142) are restricted to two decimal digits which is all right. Item net price can be more than 2 digits, but gross price and discount amount cannot.
The dilemma is if this is a validation issue or way of rounding Item prices and discounts.