From f4e571fee576d5e303b6eaf49c9a66349e875ac3 Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Mon, 3 Jul 2023 19:31:54 +0200 Subject: [PATCH] Fixes for the ZUGFeRD implementation --- app/Services/Invoice/EInvoice/ZugferdEInvoice.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Services/Invoice/EInvoice/ZugferdEInvoice.php b/app/Services/Invoice/EInvoice/ZugferdEInvoice.php index b340c85b24a2..e5a8e8953e48 100644 --- a/app/Services/Invoice/EInvoice/ZugferdEInvoice.php +++ b/app/Services/Invoice/EInvoice/ZugferdEInvoice.php @@ -98,7 +98,9 @@ class ZugferdEInvoice extends AbstractService if (!empty($item->notes)){ $xrechnung->setDocumentPositionProductDetails($item->product_key, $item->notes); } - $xrechnung->setDocumentPositionProductDetails($item->product_key); + else { + $xrechnung->setDocumentPositionProductDetails($item->product_key); + } } else { if (!empty($item->notes)){ @@ -161,7 +163,7 @@ class ZugferdEInvoice extends AbstractService if ($this->invoice->isPartial()) { - $xrechnung->setDocumentSummation($this->invoice->amount, $this->invoice->balance, $invoicing_data->getSubTotal(), $invoicing_data->getTotalSurcharges(), $invoicing_data->getTotalDiscount(), $invoicing_data->getSubTotal(), $invoicing_data->getItemTotalTaxes(), null, $this->invoice->partial); + $xrechnung->setDocumentSummation($this->invoice->amount, $this->invoice->balance, $invoicing_data->getSubTotal(), $invoicing_data->getTotalSurcharges(), $invoicing_data->getTotalDiscount(), $invoicing_data->getSubTotal(), $invoicing_data->getItemTotalTaxes(), null, (float) $this->invoice->partial); } else { $xrechnung->setDocumentSummation($this->invoice->amount, $this->invoice->balance, $invoicing_data->getSubTotal(), $invoicing_data->getTotalSurcharges(), $invoicing_data->getTotalDiscount(), $invoicing_data->getSubTotal(), $invoicing_data->getItemTotalTaxes(), null, 0.0); } @@ -236,7 +238,8 @@ class ZugferdEInvoice extends AbstractService } return $tax_type; } - private function addtoTaxMap(string $tax_type, float $net_amount, float $tax_rate){ + private function addtoTaxMap(string $tax_type, float $net_amount, float $tax_rate): void + { $hash = hash("md5", $tax_type."-".$tax_rate); if (array_key_exists($hash, $this->tax_map)){ $this->tax_map[$hash]["net_amount"] += $net_amount;