From a50617a1dfbe66f970fc1d4937f576e8d43b835d Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 13 Jun 2023 19:07:39 +0200 Subject: [PATCH 1/3] fix #40: allowance on lines --- src/Writers/UblWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Writers/UblWriter.php b/src/Writers/UblWriter.php index ea9b302..b6770ab 100644 --- a/src/Writers/UblWriter.php +++ b/src/Writers/UblWriter.php @@ -741,7 +741,7 @@ private function addAllowanceOrCharge( // Amount $baseAmount = $atDocumentLevel ? $totals->netAmount : // @phan-suppress-current-line PhanPossiblyUndeclaredProperty - $line->getNetAmount() ?? 0.0; // @phan-suppress-current-line PhanPossiblyNonClassMethodCall + $line->getNetAmountBeforeAllowancesCharges() ?? 0.0; // @phan-suppress-current-line PhanPossiblyNonClassMethodCall $this->addAmountNode( $xml, 'cbc:Amount', From 174ad97a9f363497851ee32b885e873028049d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= Date: Sat, 24 Jun 2023 11:07:31 +0200 Subject: [PATCH 2/3] Fixed allowance integration test - Updated peppol-allowance.xml --- tests/Integration/peppol-allowance.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Integration/peppol-allowance.xml b/tests/Integration/peppol-allowance.xml index afd415e..cbdefac 100644 --- a/tests/Integration/peppol-allowance.xml +++ b/tests/Integration/peppol-allowance.xml @@ -208,8 +208,8 @@ CG Cleaning 1 - 40.4 - 4040 + 41 + 4100 Description of item @@ -298,8 +298,8 @@ CG Charge 1 - 9.09 - 909 + 10 + 1000 Description of item From 2b297db27289954fe4158de27bbaf0088d3a015b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= Date: Sat, 24 Jun 2023 11:08:12 +0200 Subject: [PATCH 3/3] Fixed minor formatting issue - Updated UblWriter and InvoiceLine classes --- src/InvoiceLine.php | 8 ++++---- src/Writers/UblWriter.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/InvoiceLine.php b/src/InvoiceLine.php index 9e4119b..37af8f3 100644 --- a/src/InvoiceLine.php +++ b/src/InvoiceLine.php @@ -296,7 +296,7 @@ public function setBaseQuantity(float $baseQuantity): self { /** * Get total net amount (without VAT) before allowances/charges - * @return float|null Net amount before allowances/charges + * @return float|null Net amount before allowances/charges */ public function getNetAmountBeforeAllowancesCharges(): ?float { if ($this->price === null) { @@ -308,7 +308,7 @@ public function getNetAmountBeforeAllowancesCharges(): ?float { /** * Get allowances total amount - * @return float Allowances total amount + * @return float Allowances total amount */ public function getAllowancesAmount(): float { $allowancesAmount = 0; @@ -322,7 +322,7 @@ public function getAllowancesAmount(): float { /** * Get charges total amount - * @return float Charges total amount + * @return float Charges total amount */ public function getChargesAmount(): float { $chargesAmount = 0; @@ -337,7 +337,7 @@ public function getChargesAmount(): float { /** * Get total net amount (without VAT) * NOTE: inclusive of line level allowances and charges - * @return float|null Net amount + * @return float|null Net amount */ public function getNetAmount(): ?float { $netAmount = $this->getNetAmountBeforeAllowancesCharges(); diff --git a/src/Writers/UblWriter.php b/src/Writers/UblWriter.php index b6770ab..f7095c5 100644 --- a/src/Writers/UblWriter.php +++ b/src/Writers/UblWriter.php @@ -740,7 +740,7 @@ private function addAllowanceOrCharge( // Amount $baseAmount = $atDocumentLevel ? - $totals->netAmount : // @phan-suppress-current-line PhanPossiblyUndeclaredProperty + $totals->netAmount : // @phan-suppress-current-line PhanPossiblyUndeclaredProperty $line->getNetAmountBeforeAllowancesCharges() ?? 0.0; // @phan-suppress-current-line PhanPossiblyNonClassMethodCall $this->addAmountNode( $xml,