Skip to content

Commit

Permalink
Merge pull request #292 from phax/master
Browse files Browse the repository at this point in the history
Proposed fix for #257 and #284 - BR-CO-15
  • Loading branch information
oriol authored Sep 22, 2021
2 parents 18530d4 + f62d365 commit be57e23
Show file tree
Hide file tree
Showing 31 changed files with 711 additions and 270 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ hs_err_pid*
.project
*.iml
target/
target-cii/
target-ubl/
zz*
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ Derivative work created from https://github.com/ConnectingEurope/eInvoicing-EN16
That was Licensed under the Apache License, Version 2.0

# News and noteworthy

* v1.3.6a - 2021-08-03 (UBL and CII only)
* This contains a fix for BR-CO-15 as required by XRechnung 2.1.1 - when https://github.com/ConnectingEurope/eInvoicing-EN16931/pull/292 is merged, the next XRechnung release can be again based on the official rule release. No further hot fixes are assumed.
* v1.3.6 - 2021-05-31 (UBL and CII only)
* See all fixed issues: https://github.com/ConnectingEurope/eInvoicing-EN16931/issues?q=is%3Aissue+is%3Aclosed+milestone%3Av1.3.6
* Hot fix to support country codes 1A - Kosovo and XI - United Kingdom (Northern Ireland) in rule BR-CO-09
* v1.3.5 - 2021-03-29 (UBL and CII only)
* See all fixed issues: https://github.com/ConnectingEurope/eInvoicing-EN16931/issues?q=is%3Aissue+is%3Aclosed+milestone%3Av1.3.5
Expand Down
1 change: 1 addition & 0 deletions buildconfig-cii.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<package>CEN TC434 CII</package>

<testfolder>cii/examples</testfolder>
<testfolder>test/cii</testfolder>

<configuration>
<identifier>tc434-cii</identifier>
Expand Down
12 changes: 6 additions & 6 deletions buildconfig-ubl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<package>CEN TC434 UBL</package>

<testfolder>ubl/examples</testfolder>
<testfolder>test/testfiles</testfolder>
<testfolder>ubl/examples</testfolder>
<testfolder>test/testfiles</testfolder>
<testfolder>test/Invoice-unit-UBL</testfolder>
<testfolder>test/CreditNote-unit-UBL</testfolder>

Expand All @@ -18,31 +18,31 @@
<title>TC434 UBL Invoice</title>
<declaration type="xml.ubl">Invoice::urn:cen.eu:en16931:2017</declaration>
<inherit>ubl-invoice-2.1</inherit>
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
</configuration>

<configuration>
<identifier>tc434-ubl-cn</identifier>
<title>TC434 UBL Credit Note</title>
<declaration type="xml.ubl">CreditNote::urn:cen.eu:en16931:2017</declaration>
<inherit>ubl-creditnote-2.1</inherit>
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
</configuration>

<configuration>
<identifier>tc434-ubl-peppol</identifier>
<title>TC434 UBL Example</title>
<declaration type="xml.ubl">Invoice::urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</declaration>
<inherit>ubl-invoice-2.1</inherit>
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
</configuration>

<configuration>
<identifier>tc434-ubl-peppol-cn</identifier>
<title>TC434 UBL Example</title>
<declaration type="xml.ubl">CreditNote::urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</declaration>
<inherit>ubl-creditnote-2.1</inherit>
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
<file source="ubl/schematron/EN16931-UBL-validation.sch" path="ubl/xslt/EN16931-UBL-validation.xsl" />
</configuration>

</buildConfigurations>
18 changes: 16 additions & 2 deletions cii/schematron/CII/EN16931-CII-model.sch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
-->
<!-- Schematron binding rules generated by Andreas Pelekies -->
<!-- Data binding to CII syntax for EN16931 -->
<!-- Timestamp: 2017-07-30 10:00:00 +0200 -->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" is-a="EN16931" id="EN16931-CII-Model">
<param name="BR-01" value="(rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID != '')"/>
<param name="BR-02" value="(rsm:ExchangedDocument/ram:ID !='')"/>
Expand Down Expand Up @@ -81,7 +80,22 @@
((xs:decimal(ram:TaxBasisTotalAmount) = round((xs:decimal(ram:LineTotalAmount) + xs:decimal(ram:ChargeTotalAmount)) *10 * 10) div 100) and not (ram:AllowanceTotalAmount)) or
((xs:decimal(ram:TaxBasisTotalAmount) = round((xs:decimal(ram:LineTotalAmount)) *10 * 10) div 100) and not (ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount))"/>
<param name="BR-CO-14" value=". = (round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax/ram:CalculatedAmount)*10*10)div 100) "/>
<param name="BR-CO-15" value="(exists(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount) and (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount) = round( (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount) + (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxTotalAmount))) * 10 * 10) div 100)) or (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount) = (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount)))"/>
<!-- Old:
(exists(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount) and
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount)
=
round( (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount) +
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxTotalAmount))) * 10 * 10) div 100)) or
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount) = (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount)))
-->
<param name="BR-CO-15" value="every $Currency
in rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode
satisfies (
count ( rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID=$Currency] ) eq 1 and
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount) = round(
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount) +
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxTotalAmount[@currencyID=$Currency]))) * 10 * 10) div 100)) or
(//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:GrandTotalAmount) = (//ram:SpecifiedTradeSettlementHeaderMonetarySummation/xs:decimal(ram:TaxBasisTotalAmount)))"/>
<param name="BR-CO-16" value="(xs:decimal(ram:DuePayableAmount) = xs:decimal(ram:GrandTotalAmount) - xs:decimal(ram:TotalPrepaidAmount) + xs:decimal(ram:RoundingAmount)) or
((xs:decimal(ram:DuePayableAmount) = xs:decimal(ram:GrandTotalAmount) + xs:decimal(ram:RoundingAmount)) and not (xs:decimal(ram:TotalPrepaidAmount))) or
((xs:decimal(ram:DuePayableAmount) = xs:decimal(ram:GrandTotalAmount) - xs:decimal(ram:TotalPrepaidAmount)) and not (xs:decimal(ram:RoundingAmount))) or
Expand Down
2 changes: 0 additions & 2 deletions cii/schematron/CII/EN16931-CII-syntax.sch
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
-->
<!-- Schematron binding rules generated by Andreas Pelekies -->
<!-- Data binding to CII syntax for TC434 -->
<!-- Timestamp: 2017-08-24 00:00:00 +0200 -->

<pattern xmlns="http://purl.oclc.org/dsdl/schematron" is-a="EN16931-CII" id="EN16931-CII-Syntax">
<!-- Invoice -->
<param name="CII-SR-001" value="not(ram:SpecifiedTransactionID)"/>
Expand Down
1 change: 0 additions & 1 deletion cii/schematron/EN16931-CII-validation.sch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
CII syntax binding to the TC434
Author: Andreas Pelekies
Timestamp: 2017-07-30 00:00:00 +0200
-->
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
Expand Down
1 change: 0 additions & 1 deletion cii/schematron/abstract/EN16931-CII-model.sch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
-->
<!-- Schematron rules generated by Andreas Pelekies -->
<!-- Abstract rules for EN16931 -->
<!-- Timestamp: 2017-07-30 00:00:00 +0200 -->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" abstract="true" id="EN16931">
<rule context="$Additional_supporting_documents ">
<assert test="$BR-52" flag="fatal" id="BR-52">[BR-52]-Each Additional supporting document (BG-24) shall contain a Supporting document reference (BT-122).</assert>
Expand Down
Loading

0 comments on commit be57e23

Please sign in to comment.