← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: [tag] Groups - UBL 2 Invoice Example Calculation Model Expressed in TAML v1.0 (ubl-ta-draft-1-0.xml) uploaded

From
Stephen D Green <>
Date
2011-12-14T16:23:39+00:00
ID
CAA0AChVugffEGJF8AMujFp15=
Thread
Re: [tag] Groups - UBL 2 Invoice Example Calculation Model Expressed in TAML v1.0 (ubl-ta-draft-1-0.xml) uploaded
To the UBL TC,

 

The OASIS Test Assertions Guidelines TC have now completed a further

and possibly final public review and have approved their updated committee

specifications for the Test Assertions Model and Test Assertions Markup

Language so I need to update the example tests assertions for UBL 2 

example invoice calculation model to comply with the minor changes. The

amended test assertions document can be used with Tamelizer version 0.96

(on Google Code). This is the resulting document which is valid according

to the Test Assertion Markup Language committee spec at

http://docs.oasis-open.org/tag/taml/v1.0/csprd03/testassertionmarkuplanguage-1.0-csprd03.pdf

conformance clause 4.2:

 

[see also zipped file attached]

<taml:testAssertionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

	xsi:schemaLocation="http://docs.oasis-open.org/ns/tag/taml-201002/ http://docs.oasis-open.org/tag/taml/v1.0/csprd03/xsd/testAssertionMarkupLanguage.xsd"

 xmlns:taml="http://docs.oasis-open.org/ns/tag/taml-201002/"

 setid="ubl-ta-1-3" setname="UBL 2 Invoice Example Calculation Model Test Assertions">

	<taml:common>

		<taml:sourceDocument version="1" revision="5">UBL 2 Invoice Calculation Model Rules</taml:sourceDocument>

		<taml:authors>Stephen D Green</taml:authors>

		<taml:location>http://lists.oasis-open.org/archives/ubl-comment/200910/msg00012.html</taml:location>

		<taml:namespaces xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:in="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">

			<taml:namespace>

				<taml:prefix>#default</taml:prefix>

				<taml:uri>urn:oasis:names:specification:ubl:schema:xsd:Invoice-2</taml:uri>

			</taml:namespace>

			<taml:namespace>

				<taml:prefix>in</taml:prefix>

				<taml:uri>urn:oasis:names:specification:ubl:schema:xsd:Invoice-2</taml:uri>

			</taml:namespace>

			<taml:namespace>

				<taml:prefix>cac</taml:prefix>

				<taml:uri>urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2</taml:uri>

			</taml:namespace>

			<taml:namespace>

				<taml:prefix>cbc</taml:prefix>

				<taml:uri>urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2</taml:uri>

			</taml:namespace>

		</taml:namespaces>

	</taml:common>

	<taml:testAssertion id="IN1" name="Invoice">

		<taml:normativeSource>U2ICMDraft5Rule1: 

			"To be a conforming UBL 2 invoice the document MUST be valid according

			to a standard UBL 2 Invoice schema."</taml:normativeSource>

		<taml:target type="document" idscheme="'document'">/</taml:target>

		<taml:predicate>count(//in:Invoice) ge 1</taml:predicate>

		<taml:prescription level="mandatory"/>

		<taml:report label="failed" message="Not a standard UBL 2 invoice">The file does not contain a standard UBL 2 invoice.</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT1" name="LineExtensionAmount (1)">

		<taml:normativeSource>U2ICMDraft5Rule2: 

			"The 'LineExtensionAmount' in the invoice 'LegalMonetaryTotal' SHOULD 

			equal the sum of all 'LineExtensionAmount's in all of the invoice lines."</taml:normativeSource>

		<taml:target type="total" idscheme="'invoice-total'">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1)</taml:prerequisite>

		<taml:predicate>number(./cbc:LineExtensionAmount) eq sum(/in:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Line Extension Amount">The line extension total is not the sum of the invoice lines' line extension amounts.</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT2" name="TaxExclusiveAmount">

		<taml:normativeSource>U2ICMDraft5Rule3: 

			"The 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal' SHOULD

			equal the sum of the 'LineExtensionAmount's in all of the invoice lines 

			plus the sum of the invoice 'AllowanceCharge' charges minus the sum of 

			the invoice 'AllowanceCharge' allowances (with the exception of there 

			being no 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(/in:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount) gt 0) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) eq 1)</taml:prerequisite>

		<taml:predicate>number(./cbc:TaxExclusiveAmount) eq

      (sum(/in:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount) +

      sum(/in:Invoice/cac:AllowanceCharge[cbc:ChargeIndicator='true']/cbc:Amount) -

      sum(/in:Invoice/cac:AllowanceCharge[cbc:ChargeIndicator='false']/cbc:Amount))</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Tax Exclusive Amount">the 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal' is not equal to the sum of the 'LineExtensionAmount's in all of the invoice lines plus the sum of the invoice 'AllowanceCharge' charges minus the sum of the invoice 'AllowanceCharge' allowances</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT3" name="AllowanceTotalAmount">

		<taml:normativeSource>U2ICMDraft5Rule4: 

			"The 'AllowanceTotalAmount' in the invoice 'LegalMonetaryTotal' SHOULD

			equal the sum of any invoice 'AllowanceCharge' allowances."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(/in:Invoice/cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount) eq 1) and (count(distinct-values(//*/@currencyID)) eq 1)</taml:prerequisite>

		<taml:predicate>sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount) eq sum(/in:Invoice/cac:AllowanceCharge[cbc:ChargeIndicator='false']/cbc:Amount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Allowance Total Amount">the 'AllowanceTotalAmount' in the invoice 'LegalMonetaryTotal' is not equal to the the sum of the invoice 'AllowanceCharge' allowances</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT4" name="ChargeTotalAmount">

		<taml:normativeSource>U2ICMDraft5Rule5: 

			"The 'ChargeTotalAmount' in the invoice 'LegalMonetaryTotal' SHOULD

			equal the sum of any invoice 'AllowanceCharge' charges."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(/in:Invoice/cac:LegalMonetaryTotal/cbc:ChargeTotalAmount) eq 1) and (count(distinct-values(//*/@currencyID)) eq 1)</taml:prerequisite>

		<taml:predicate>sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:ChargeTotalAmount) eq sum(/in:Invoice/cac:AllowanceCharge[cbc:ChargeIndicator='true']/cbc:Amount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Charge Total Amount">the 'ChargeTotalAmount' in the invoice 'LegalMonetaryTotal' is not equal to the the sum of the invoice 'AllowanceCharge' charges</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT5a" name="TaxExclusiveAmount (With Taxes)">

		<taml:normativeSource>U2ICMDraft5Rule6: 

			"If there are no taxes amounts in the invoice then the 'TaxExclusiveAmount' 

			in the invoice 'LegalMonetaryTotal' SHOULD equal the 'LineExtensionAmount' 

			minus any 'AllowanceTotalAmount' plus any 'ChargeTotalAmount' minus any

			'PrepaidAmount' (in the invoice 'LegalMonetaryTotal'), (with the exception 

			of there being no 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal').

			If there are taxes amounts in the invoice but no PrepaidAmount then the 

			'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal' SHOULD equal the 

			'LineExtensionAmount' minus any 'AllowanceTotalAmount' plus any 

			'ChargeTotalAmount' (in the invoice 'LegalMonetaryTotal'), (with the exception 

			of there being no 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(//cbc:TaxAmount) gt 0) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) gt 0)</taml:prerequisite>

		<taml:predicate>number(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) eq

			sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:LineExtensionAmount) - sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount) + sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:ChargeTotalAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Tax Exclusive Amount">in the invoice 'LegalMonetaryTotal' (the invoice including tax amounts) the 'TaxExclusiveAmount' is not equal to the 'LineExtensionAmount' minus any 'AllowanceTotalAmount' plus any 'ChargeTotalAmount'</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT5b" name="TaxExclusiveAmount (Without Taxes)">

		<taml:normativeSource>U2ICMDraft5Rule6: 

			"If there are no taxes amounts in the invoice then the 'TaxExclusiveAmount' 

			in the invoice 'LegalMonetaryTotal' SHOULD equal the 'LineExtensionAmount' 

			minus any 'AllowanceTotalAmount' plus any 'ChargeTotalAmount' minus any

			'PrepaidAmount' (in the invoice 'LegalMonetaryTotal'), (with the exception 

			of there being no 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal').

			If there are taxes amounts in the invoice but no PrepaidAmount then the 

			'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal' SHOULD equal the 

			'LineExtensionAmount' minus any 'AllowanceTotalAmount' plus any 

			'ChargeTotalAmount' (in the invoice 'LegalMonetaryTotal'), (with the exception 

			of there being no 'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(//cbc:TaxAmount) eq 0) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) gt 0)</taml:prerequisite>

		<taml:predicate>number(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) eq

			sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:LineExtensionAmount) - sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount) - sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:PrepaidAmount) + sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:ChargeTotalAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Tax Exclusive Amount">in the invoice 'LegalMonetaryTotal' (the invoice not including any tax amounts) the 'TaxExclusiveAmount' is not equal to the 'LineExtensionAmount' minus any 'PrepaidAmount' minus any 'AllowanceTotalAmount' plus any 'ChargeTotalAmount'</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT6" name="TaxInclusiveAmount">

		<taml:normativeSource>U2ICMDraft5Rule7: 

			"Any 'TaxInclusiveAmount' in the invoice 'LegalMonetaryTotal' SHOULD be

			equal to the 'TaxExclusiveAmount' (in the invoice 'LegalMonetaryTotal')

			plus the sum of any invoice total tax amounts (at invoice document level) 

			(with the exception of there being tax amounts in currencies other 

			than the currency of the invoice totals or there being is no 

			'TaxExclusiveAmount' in the invoice 'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount) gt 0)</taml:prerequisite>

		<taml:predicate>number(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount) eq

     sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) + sum(/in:Invoice/cac:TaxTotal/cbc:TaxAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Tax Inclusive Amount">the 'TaxInclusiveAmount' in the invoice 'LegalMonetaryTotal' is not equal to any TaxExclusiveAmount (in the invoice 'LegalMonetaryTotal') plus the sum of any invoice total tax amounts (at invoice document level)</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT7a" name="PayableAmount (With TaxInclusiveAmount)">

		<taml:normativeSource>U2ICMDraft5Rule8: 

			"The 'PayableAmount' in the invoice 'LegalMonetaryTotal' SHOULD be

			equal to any 'TaxInclusiveAmount' (in the invoice 'LegalMonetaryTotal')

			minus any 'PrepaidAmount' (in the invoice 'LegalMonetaryTotal') unless

			there is no 'TaxInclusiveAmount' and there are no tax amounts in 

			which case the 'PayableAmount' SHOULD equal the 'TaxExclusiveAmount' 

			minus any 'PrepaidAmount' (in the invoice 'LegalMonetaryTotal') (with 

			the exception of there being no 'TaxExclusiveAmount' in the invoice 

			'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount) gt 0) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) gt 0)</taml:prerequisite>

		<taml:predicate>number(/in:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount) eq

      number(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount) - sum(/in:Invoice/cac:PrepaidPayment/cbc:PaidAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Payable Amount">The 'PayableAmount' in the invoice 'LegalMonetaryTotal' is not equal to the 'TaxInclusiveAmount' (in the invoice 'LegalMonetaryTotal') minus any 'PrepaidAmount'.</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTOT7b" name="PayableAmount (With no taxes and no TaxInclusiveAmount)">

		<taml:normativeSource>U2ICMDraft5Rule8: 

			"The 'PayableAmount' in the invoice 'LegalMonetaryTotal' SHOULD be

			equal to any 'TaxInclusiveAmount' (in the invoice 'LegalMonetaryTotal')

			minus any 'PrepaidAmount' (in the invoice 'LegalMonetaryTotal') unless

			there is no 'TaxInclusiveAmount' and there are no tax amounts in 

			which case the 'PayableAmount' SHOULD equal the 'TaxExclusiveAmount' 

			minus any 'PrepaidAmount' (in the invoice 'LegalMonetaryTotal') (with 

			the exception of there being no 'TaxExclusiveAmount' in the invoice 

			'LegalMonetaryTotal')."</taml:normativeSource>

		<taml:target type="total">/in:Invoice/cac:LegalMonetaryTotal</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount) eq 0) and (count(//cbc:TaxAmount) eq 0) and (count(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) gt 0)</taml:prerequisite>

		<taml:predicate>number(/in:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount) eq

			number(/in:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount) - sum(/in:Invoice/cac:LegalMonetaryTotal/cbc:PrepaidAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in Payable Amount">The 'PayableAmount' in the invoice 'LegalMonetaryTotal' (there being no 'TaxInclusiveAmount' and no tax amounts) is not equal to the 'TaxExclusiveAmount' (in the invoice 'LegalMonetaryTotal') minus any 'PrepaidAmount'.</taml:report>

	</taml:testAssertion>

	<taml:testAssertion id="INTAX1" name="TaxAmount">

		<taml:normativeSource>U2ICMDraft5Rule9: 

			"The sum of any invoice document level tax total amounts SHOULD equal the

			sum of any document level subtotal tax amounts (with the exception of

			there being tax amounts in currencies other than the currency of the

			invoice totals)."</taml:normativeSource>

		<taml:target type="tax" idscheme="concat('tax',position())">/in:Invoice/cac:TaxTotal/cbc:TaxAmount</taml:target>

		<taml:prerequisite>(count(distinct-values(//*/@currencyID)) eq 1)</taml:prerequisite>

		<taml:predicate>sum(/in:Invoice/cac:TaxTotal/cbc:TaxAmount) eq sum(/in:Invoice/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount)</taml:predicate>

		<taml:prescription level="preferred"/>

		<taml:report label="failed" message="Error in sum of Tax Amount">The sum of document level tax total amounts does not equal the sum of all document level subtotal tax amounts</taml:report>

	</taml:testAssertion>

</taml:testAssertionSet>

 

 

Best regards

 

----

Stephen D Green

 

 

On 4 February 2010 21:12, Stephen Green <> wrote:

FYI

Best regards

Steve

---

Stephen D Green

---------- Forwarded message ----------

From:  <>

Date: 4 February 2010 21:11

Subject: [tag] Groups - UBL 2 Invoice Example Calculation Model

Expressed in TAML v1.0   (ubl-ta-draft-1-0.xml) uploaded

To: 

The document revision named UBL 2 Invoice Example Calculation Model

Expressed in TAML v1.0 (ubl-ta-draft-1-0.xml) has been submitted by Stephen

Green to the OASIS Test Assertions Guidelines (TAG) TC document repository.

 This document is revision #19 of ubl-ta-draft-0-61.xml.

Document Description:

This is a working example of test assertions written in the Test Assertion

Markup Language. It represents an example calculation model for the OASIS

Universal Business Language version 2 (UBL 2) - defining as test assertions

one way to calculate the totals in a UBL 2 invoice. The test assertions

here use an XPath profile of Test Assertion Markup Language designed with a

dual role: They are executable as an actual test suite as well as providing

documentation of the test assertions themselves.

View Document Details:

http://www.oasis-open.org/committees/document.php?document_id=36265

Download Document:

http://www.oasis-open.org/committees/download.php/36265/ubl-ta-draft-1-0.xml

Revision:

This document is revision #19 of ubl-ta-draft-0-61.xml.  The document

details page referenced above will show the complete revision history.

PLEASE NOTE:  If the above links do not work for you, your email application

may be breaking the link into two pieces.  You may be able to copy and paste

the entire link address into the address field of your web browser.

-OASIS Open Administration

Attachment:
ubl-ta-1-3.zip

Description: Zip archive
← Prev in month ← Prev in thread
Next in thread → Next in month →