diff --git a/src/XmlConverterCiiToUbl.php b/src/XmlConverterCiiToUbl.php index 5929acb..89f70ef 100644 --- a/src/XmlConverterCiiToUbl.php +++ b/src/XmlConverterCiiToUbl.php @@ -310,7 +310,7 @@ function ($additionalReferencedDocumentNode) { function () use ($additionalReferencedDocumentNode) { $this->destination->startElement('cac:AdditionalDocumentReference'); $this->destination->element('cbc:ID', $this->source->queryValue('./ram:IssuerAssignedID', $additionalReferencedDocumentNode)); - if ($this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode) === "50" || $this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode) === "130") { + if ($this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode) === "130") { $this->destination->element('cbc:DocumentTypeCode', $this->source->queryValue('./ram:TypeCode', $additionalReferencedDocumentNode)); } $this->destination->element('cbc:DocumentDescription', $this->source->queryValue('./ram:Name', $additionalReferencedDocumentNode)); @@ -1389,7 +1389,13 @@ function ($tradeLineItemNode) use ($invoiceHeaderSettlement) { $this->source->queryValue('./ram:InvoiceCurrencyCode', $invoiceHeaderSettlement) ); - $this->destination->element('cbc:AccountingCost', $this->source->queryValue('./ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', $tradeLineItemNode)); + $this->source->whenExists( + './ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', + $tradeLineItemNode, + function ($accountingCostNode) { + $this->destination->element('cbc:AccountingCost', $accountingCostNode->nodeValue); + } + ); $this->source->whenExists( './ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod', diff --git a/src/XmlConverterUblToCii.php b/src/XmlConverterUblToCii.php index 8439791..e7b6c74 100644 --- a/src/XmlConverterUblToCii.php +++ b/src/XmlConverterUblToCii.php @@ -72,6 +72,7 @@ protected function getSourceNamespaces(): array protected function getDestinationNamespaces(): array { return [ + 'a' => 'urn:un:unece:uncefact:data:standard:QualifiedDataType:100', 'rsm' => 'urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100', 'ram' => 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100', 'qdt' => 'urn:un:unece:uncefact:data:Standard:QualifiedDataType:100', @@ -360,6 +361,16 @@ function ($invoiceLineInvoicePeriodEndNode) { $this->destination->startElement('ram:SpecifiedTradeSettlementLineMonetarySummation'); $this->destination->element('ram:LineTotalAmount', $this->source->queryValue('cbc:LineExtensionAmount', $invoiceLineNode)); $this->destination->endElement(); + $this->source->whenExists( + './cbc:AccountingCost', + $invoiceLineNode, + function ($invoiceLineAccountingCostNode) { + $this->destination->startElement('ram:ReceivableSpecifiedTradeAccountingAccount'); + $this->destination->element('ram:ID', $invoiceLineAccountingCostNode->nodeValue); + $this->destination->endElement(); + } + ); + $this->destination->endElement(); $this->destination->endElement(); @@ -721,7 +732,9 @@ function ($additionalDocumentReferenceNode) { './cbc:DocumentTypeCode', $additionalDocumentReferenceNode, function ($docTypeCodeNode) { - $this->destination->element('ram:TypeCode', $docTypeCodeNode->nodeValue); + if ($docTypeCodeNode->nodeValue == "50" || $docTypeCodeNode->nodeValue == "130" || $docTypeCodeNode->nodeValue == "916") { + $this->destination->element('ram:TypeCode', $docTypeCodeNode->nodeValue); + } }, function () { $this->destination->element('ram:TypeCode', '916'); @@ -835,6 +848,26 @@ function ($actualDeliveryDateNode) { } ); + $this->source->whenExists( + './cac:DespatchDocumentReference/cbc:ID', + $docRootElement, + function ($despatchDocumentReferenceNode) { + $this->destination->startElement('ram:DespatchAdviceReferencedDocument'); + $this->destination->element('ram:IssuerAssignedID', $despatchDocumentReferenceNode->nodeValue); + $this->destination->endElement(); + } + ); + + $this->source->whenExists( + './cac:ReceiptDocumentReference/cbc:ID', + $docRootElement, + function ($receiptDocumentReferenceNode) { + $this->destination->startElement('ram:ReceivingAdviceReferencedDocument'); + $this->destination->element('ram:IssuerAssignedID', $receiptDocumentReferenceNode->nodeValue); + $this->destination->endElement(); + } + ); + $this->destination->endElement(); } @@ -1210,6 +1243,27 @@ function () { } ); + $this->source->queryAll('./cac:BillingReference/cac:InvoiceDocumentReference', $docRootElement)->foreach( + function ($billingReferenceNode) { + $this->destination->startElement('ram:InvoiceReferencedDocument'); + $this->destination->element('ram:IssuerAssignedID', $this->source->queryValue('./cbc:ID', $billingReferenceNode)); + $this->destination->startElement('ram:FormattedIssueDateTime'); + $this->destination->elementWithAttribute('a:DateTimeString', $this->convertDateTime($this->source->queryValue('./cbc:IssueDate', $billingReferenceNode)), 'format', '102'); + $this->destination->endElement(); + $this->destination->endElement(); + } + ); + + $this->source->whenExists( + './cbc:AccountingCost', + $docRootElement, + function ($accountingCostNode) { + $this->destination->startElement('ram:ReceivableSpecifiedTradeAccountingAccount'); + $this->destination->element('ram:ID', $accountingCostNode->nodeValue); + $this->destination->endElement(); + } + ); + $this->destination->endElement(); } diff --git a/tests/assets/cii/1_cii_simple.xml b/tests/assets/cii/1_cii_simple.xml index f975a20..82f9652 100644 --- a/tests/assets/cii/1_cii_simple.xml +++ b/tests/assets/cii/1_cii_simple.xml @@ -55,6 +55,9 @@ 198.00 + + 0815 + @@ -123,6 +126,12 @@ 20180305 + + 5433 + + + 3544 + EUR @@ -153,6 +162,9 @@ 0.00 529.87 + + 4025:123:4343 + \ No newline at end of file diff --git a/tests/testcases/CiiToUblSimpleTest.php b/tests/testcases/CiiToUblSimpleTest.php index 02e86bb..0d59ba7 100644 --- a/tests/testcases/CiiToUblSimpleTest.php +++ b/tests/testcases/CiiToUblSimpleTest.php @@ -31,7 +31,8 @@ public function testDocumentGeneral(): void $this->assertXPathNotExists('/ubl:Invoice/cbc:TaxPointDate'); $this->assertXPathValue('/ubl:Invoice/cbc:DocumentCurrencyCode', "EUR"); $this->assertXPathNotExists('/ubl:Invoice/cbc:TaxCurrencyCode'); - $this->assertXPathNotExists('/ubl:Invoice/cbc:AccountingCost'); + $this->assertXPathValueWithIndex('/ubl:Invoice/cbc:AccountingCost', 0, '4025:123:4343'); + $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cbc:AccountingCost', 1); $this->assertXPathNotExists('/ubl:Invoice/cbc:BuyerReference'); $this->assertXPathNotExists('/ubl:Invoice/cbc:StartDate'); $this->assertXPathNotExists('/ubl:Invoice/cbc:EndDate'); @@ -39,8 +40,10 @@ public function testDocumentGeneral(): void $this->assertXPathNotExists('/ubl:Invoice/cac:OrderReference/cbc:SalesOrderID'); $this->assertXPathNotExists('/ubl:Invoice/cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID'); $this->assertXPathNotExists('/ubl:Invoice/cac:BillingReference/cac:InvoiceDocumentReference/cbc:IssueDate'); - $this->assertXPathNotExists('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID'); - $this->assertXPathNotExists('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID'); + $this->assertXPathValueWithIndex('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID', 0, '5433'); + $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:DespatchDocumentReference/cbc:ID', 1); + $this->assertXPathValueWithIndex('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID', 0, '3544'); + $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:ReceiptDocumentReference/cbc:ID', 1); $this->assertXPathNotExists('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:ID'); $this->assertXPathNotExists('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentTypeCode'); $this->assertXPathNotExists('/ubl:Invoice/cac:AdditionalDocumentReference/cbc:DocumentDescription'); @@ -218,7 +221,8 @@ public function testInvoiceLine(): void $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cbc:Note', 0); $this->assertXPathValueWithIndexAndAttribute('/ubl:Invoice/cac:InvoiceLine/cbc:InvoicedQuantity', 0, "20.0000", "unitCode", "H87"); $this->assertXPathValueWithIndexAndAttribute('/ubl:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount', 0, "198.00", "currencyID", "EUR"); - $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cbc:AccountingCost', 0); + $this->assertXPathValueWithIndex('/ubl:Invoice/cac:InvoiceLine/cbc:AccountingCost', 0, '0815'); + $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cbc:AccountingCost', 1); $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cac:InvoicePeriod', 0); $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cac:InvoicePeriod/cbc:StartDate', 0); $this->assertXPathNotExistsWithIndex('/ubl:Invoice/cac:InvoiceLine/cac:InvoicePeriod/cbc:EndDate', 0); diff --git a/tests/testcases/UblToCiiSimple2Test.php b/tests/testcases/UblToCiiSimple2Test.php index 7309a70..8683996 100644 --- a/tests/testcases/UblToCiiSimple2Test.php +++ b/tests/testcases/UblToCiiSimple2Test.php @@ -55,6 +55,7 @@ public function testTradeLineItem(): void $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount', 0, '1000.00'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime/udt:DateTimeString', 0, '20130310', 'format', '102'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime/udt:DateTimeString', 0, '20130410', 'format', '102'); + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 0, 'ACC7654'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID', 1, '2'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:IncludedNote/ram:Content', 1, 'second line'); @@ -72,6 +73,7 @@ public function testTradeLineItem(): void $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount', 1, '500.00'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime/udt:DateTimeString', 1, '20130310', 'format', '102'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime/udt:DateTimeString', 1, '20130410', 'format', '102'); + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 1, 'ACC7654'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID', 2, '3'); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:IncludedNote/ram:Content', 2); @@ -88,6 +90,7 @@ public function testTradeLineItem(): void $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:RateApplicablePercent', 2, '12.0'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount', 2, '2500.00'); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod', 2); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 2); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem', 3); } @@ -193,6 +196,11 @@ public function testShipToTradeParty(): void $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty', 1); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ActualDeliverySupplyChainEvent/ram:OccurrenceDateTime/udt:DateTimeString', 0, '20130415', 'format', '102'); + + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:DespatchAdviceReferencedDocument/ram:IssuerAssignedID', 0, '5433'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:DespatchAdviceReferencedDocument/ram:IssuerAssignedID', 1); + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ReceivingAdviceReferencedDocument/ram:IssuerAssignedID', 0, '3544'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ReceivingAdviceReferencedDocument/ram:IssuerAssignedID', 1); } public function testPayeeTradeParty(): void @@ -363,4 +371,18 @@ public function testDocumentSummation(): void $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementHeaderMonetarySummation', 1); } + + public function testInvoiceReferencedDocument(): void + { + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID', 0, 'TOSL109'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID', 1); + $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:FormattedIssueDateTime/a:DateTimeString', 0, '20130310', 'format', '102'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:FormattedIssueDateTime/a:DateTimeString', 1); + } + + public function testDocumentAccountingAccount(): void + { + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 0, '67543'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 1); + } } diff --git a/tests/testcases/UblToCiiSimpleTest.php b/tests/testcases/UblToCiiSimpleTest.php index d5d47c6..b845500 100644 --- a/tests/testcases/UblToCiiSimpleTest.php +++ b/tests/testcases/UblToCiiSimpleTest.php @@ -55,6 +55,7 @@ public function testTradeLineItem(): void $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount', 0, '2800'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:StartDateTime/udt:DateTimeString', 0, '20171001', 'format', '102'); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod/ram:EndDateTime/udt:DateTimeString', 0, '20171031', 'format', '102'); + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 0, 'Konteringsstreng'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID', 1, '2'); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:IncludedNote/ram:Content', 1); @@ -71,6 +72,7 @@ public function testTradeLineItem(): void $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:RateApplicablePercent', 1, '25.0'); $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount', 1, '-1500'); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod', 1); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 1); $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem', 2); } @@ -175,6 +177,11 @@ public function testShipToTradeParty(): void $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty', 1); $this->assertXPathValueWithIndexAndAttribute('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ActualDeliverySupplyChainEvent/ram:OccurrenceDateTime/udt:DateTimeString', 0, '20171101', 'format', '102'); + + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:DespatchAdviceReferencedDocument/ram:IssuerAssignedID', 0); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:DespatchAdviceReferencedDocument/ram:IssuerAssignedID', 1); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ReceivingAdviceReferencedDocument/ram:IssuerAssignedID', 0); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ReceivingAdviceReferencedDocument/ram:IssuerAssignedID', 1); } public function testPayeeTradeParty(): void @@ -264,4 +271,18 @@ public function testDocumentSummation(): void $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementHeaderMonetarySummation', 1); } + + public function testInvoiceReferencedDocument(): void + { + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID', 0); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:IssuerAssignedID', 1); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:FormattedIssueDateTime/a:DateTimeString', 0); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument/ram:FormattedIssueDateTime/a:DateTimeString', 1); + } + + public function testDocumentAccountingAccount(): void + { + $this->assertXPathValueWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 0, '4025:123:4343'); + $this->assertXPathNotExistsWithIndex('/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ReceivableSpecifiedTradeAccountingAccount/ram:ID', 1); + } }