Skip to content

Commit

Permalink
Fix Tests, Updated Test data
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Dec 25, 2022
1 parent 2d2bad0 commit 96f4c68
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
15 changes: 7 additions & 8 deletions examples/OrderBuilderComfortSimple.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
->addDocumentAllowanceCharge(31.00, false, "S", "VAT", 20, null, 10.00, 310.00, null, null, "64", "SPECIAL AGREEMENT")
->addDocumentAllowanceCharge(21.00, true, "S", "VAT", 20, null, 10.00, 210.00, null, null, "FC", "FREIGHT SERVICES")
->setDocumentSummation(310, 360, 21, 31, 300, 60)
->setDocumentReceivableSpecifiedTradeAccountingAccount("BUYER_ACCOUNT_REF")
->setDocumentReceivableSpecifiedTradeAccountingAccount("BUYER_ACCOUNT_REF", "BUYER_ACCOUNT_REF_TYPE")

->addDocumentTax("S", "VAT", 300.00, 60.00, 20.00, "ExcReason-1", "ExcReasonCode-1", 300.00, 300.00, null)

->addNewPosition("1")
->setDocumentPositionNote("WEEE Tax of 0,50 euros per item included", null, "TXD")
Expand All @@ -108,8 +110,8 @@
->addDocumentPositionAdditionalReferencedDocument("ADD_REF_DOC_ID", "916", "ADD_REF_DOC_URIID", 5, "ADD_REF_DOC_Desc")
->addDocumentPositionAdditionalReferencedDocument("OBJECT_125487", "130", null, null, null, "AWV")
->setDocumentPositionGrossPrice(10.50, 1, "C62")
->addDocumentPositionGrossPriceAllowanceCharge(1.00, false, null, null, "DISCOUNT", null, null, null, null, null, null, null, "95")
->addDocumentPositionGrossPriceAllowanceCharge(0.50, true, null, null, "WEEE", null, null, null, null, null, null, null, "AEW")
->addDocumentPositionGrossPriceAllowanceCharge(1.00, false, null, null, "DISCOUNT", null, null, null, null, null, null, "95")
->addDocumentPositionGrossPriceAllowanceCharge(0.50, true, null, null, "WEEE", null, null, null, null, null, null, "AEW")
->setDocumentPositionNetPrice(10, 1, "C62")
->setDocumentPositionCatalogueReferencedDocument("CATALOG_REF_ID", 2)
->setDocumentPositionBlanketOrderReferencedDocument(2)
Expand All @@ -118,11 +120,11 @@
->setDocumentPositionDeliverPackageQuantity(3, "C62")
->setDocumentPositionDeliverPerPackageQuantity(2, "C62")
->addDocumentPositionRequestedDeliverySupplyChainEvent(null, new \DateTime(), new \DateTime())
->addDocumentPositionTax("S", "VAT", 20.0)
->addDocumentPositionAllowanceCharge(6.00, false, 10.0, 60.0, "64", "SPECIAL AGREEMENT")
->addDocumentPositionAllowanceCharge(6.00, true, 10.0, 60.0, "FC", "FREIGHT SERVICES")
->setDocumentPositionLineSummation(60.0)
->setDocumentPositionReceivableTradeAccountingAccount("BUYER_ACCOUNTING_REF")
->setDocumentPositionTax("S", "VAT", 19.0, 0.00, "Reason-1", "RC1")

->addNewPosition("2")
->setDocumentPositionNote("WEEE Tax of 0,50 euros per item included", null, "TXD")
Expand All @@ -138,7 +140,7 @@
->addDocumentPositionAdditionalReferencedDocument("ADD_REF_DOC_ID", "916", "ADD_REF_DOC_URIID", 5, "ADD_REF_DOC_Desc")
->addDocumentPositionAdditionalReferencedDocument("OBJECT_125487", "130", null, null, null, "AWV")
->setDocumentPositionGrossPrice(19.50, 2, "C62")
->addDocumentPositionGrossPriceAllowanceCharge(0.50, true, null, null, "WEEE TAX", null, null, null, null, null, null, null, "AEW")
->addDocumentPositionGrossPriceAllowanceCharge(0.50, true, null, null, "WEEE TAX", null, null, null, null, null, null, "AEW")
->setDocumentPositionNetPrice(20, 2, "C62")
->setDocumentPositionCatalogueReferencedDocument("CATALOG_REF_ID", 2)
->setDocumentPositionBlanketOrderReferencedDocument(3)
Expand All @@ -147,7 +149,6 @@
->setDocumentPositionDeliverPackageQuantity(5, "C62")
->setDocumentPositionDeliverPerPackageQuantity(2, "C62")
->addDocumentPositionRequestedDeliverySupplyChainEvent(new \DateTime())
->addDocumentPositionTax("S", "VAT", 20.0)
->addDocumentPositionAllowanceCharge(1.00, false, 1.0, 100.0, "64", "SPECIAL AGREEMENT")
->addDocumentPositionAllowanceCharge(1.00, true, 1.0, 100.0, "FC", "FREIGHT SERVICES")
->setDocumentPositionLineSummation(100.0)
Expand Down Expand Up @@ -176,12 +177,10 @@
->setDocumentPositionDeliverPackageQuantity(3, "C62")
->setDocumentPositionDeliverPerPackageQuantity(2, "C62")
->addDocumentPositionRequestedDeliverySupplyChainEvent(null, new \DateTime(), new \DateTime())
->addDocumentPositionTax("S", "VAT", 20.0)
->addDocumentPositionAllowanceCharge(15.00, false, 10.0, 150.0, "64", "SPECIAL AGREEMENT")
->addDocumentPositionAllowanceCharge(15.00, true, 10.0, 150.0, "FC", "FREIGHT SERVICES")
->setDocumentPositionLineSummation(150.0)
->setDocumentPositionReceivableTradeAccountingAccount("BUYER_ACCOUNTING_REF")

->writeFile(getcwd() . "/order-x.xml");

$pdfDocument = new OrderDocumentPdfBuilder(
Expand Down
9 changes: 9 additions & 0 deletions tests/assets/reader-order-x-comfort.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@
<udt:Indicator>false</udt:Indicator>
</ram:ChargeIndicator>
<ram:ActualAmount>1.00</ram:ActualAmount>
<ram:ReasonCode>95</ram:ReasonCode>
<ram:Reason>DISCOUNT</ram:Reason>
</ram:AppliedTradeAllowanceCharge>
<ram:AppliedTradeAllowanceCharge>
<ram:ChargeIndicator>
<udt:Indicator>true</udt:Indicator>
</ram:ChargeIndicator>
<ram:ActualAmount>0.50</ram:ActualAmount>
<ram:ReasonCode>AEW</ram:ReasonCode>
<ram:Reason>WEEE</ram:Reason>
</ram:AppliedTradeAllowanceCharge>
</ram:GrossPriceProductTradePrice>
Expand All @@ -143,6 +145,11 @@
<ram:PerPackageUnitQuantity unitCode="C62">2.00</ram:PerPackageUnitQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeAllowanceCharge>
<ram:ChargeIndicator>
<udt:Indicator>false</udt:Indicator>
Expand Down Expand Up @@ -246,6 +253,7 @@
<udt:Indicator>true</udt:Indicator>
</ram:ChargeIndicator>
<ram:ActualAmount>0.50</ram:ActualAmount>
<ram:ReasonCode>AEW</ram:ReasonCode>
<ram:Reason>WEEE TAX</ram:Reason>
</ram:AppliedTradeAllowanceCharge>
</ram:GrossPriceProductTradePrice>
Expand Down Expand Up @@ -751,6 +759,7 @@
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:ReceivableSpecifiedTradeAccountingAccount>
<ram:ID>BUYER_ACCOUNT_REF</ram:ID>
<ram:TypeCode>BUYER_ACCOUNT_REF_TYPE</ram:TypeCode>
</ram:ReceivableSpecifiedTradeAccountingAccount>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
Expand Down
10 changes: 5 additions & 5 deletions tests/testcases/OrderDocumentReaderComfortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ public function testGetDocumentReceivableSpecifiedTradeAccountingAccount(): void
self::$document->getDocumentReceivableSpecifiedTradeAccountingAccount($id, $typeCode);

$this->assertEquals("BUYER_ACCOUNT_REF", $id);
$this->assertEquals("", $typeCode);
$this->assertEquals("BUYER_ACCOUNT_REF_TYPE", $typeCode);
}

/**
Expand Down Expand Up @@ -2652,7 +2652,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos1(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("95", $reasonCode);

self::$document->nextDocumentPositionGrossPriceAllowanceCharge();
self::$document->getDocumentPositionGrossPriceAllowanceCharge($actualAmount, $isCharge, $calculationPercent, $basisAmount, $reason, $taxTypeCode, $taxCategoryCode, $rateApplicablePercent, $sequence, $basisQuantity, $basisQuantityUnitCode, $reasonCode);
Expand All @@ -2668,7 +2668,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos1(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("AEW", $reasonCode);

$this->assertFalse(self::$document->nextDocumentPositionGrossPriceAllowanceCharge());
}
Expand All @@ -2694,7 +2694,7 @@ public function testGetDocumentPositionGrossPriceAllowanceChargePos2(): void
$this->assertEquals(0, $sequence);
$this->assertEquals(0, $basisQuantity);
$this->assertEquals("", $basisQuantityUnitCode);
$this->assertEquals("", $reasonCode);
$this->assertEquals("AEW", $reasonCode);

$this->assertFalse(self::$document->nextDocumentPositionGrossPriceAllowanceCharge());
}
Expand Down Expand Up @@ -3455,7 +3455,7 @@ public function testFirstDocumentPositionTaxPos1(): void
{
self::$document->firstDocumentPosition();

$this->assertFalse(self::$document->firstDocumentPositionTax());
$this->assertTrue(self::$document->firstDocumentPositionTax());
}

/**
Expand Down

0 comments on commit 96f4c68

Please sign in to comment.