Merge pull request #8599 from LarsK1/v5-develop

More fixes for the ZUGFeRD implementation
This commit is contained in:
David Bomba 2023-07-04 15:51:22 +10:00 committed by GitHub
commit f4c0cc21f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 884 additions and 781 deletions

View File

@ -98,7 +98,9 @@ class ZugferdEInvoice extends AbstractService
if (!empty($item->notes)){ if (!empty($item->notes)){
$xrechnung->setDocumentPositionProductDetails($item->product_key, $item->notes); $xrechnung->setDocumentPositionProductDetails($item->product_key, $item->notes);
} }
$xrechnung->setDocumentPositionProductDetails($item->product_key); else {
$xrechnung->setDocumentPositionProductDetails($item->product_key);
}
} }
else { else {
if (!empty($item->notes)){ if (!empty($item->notes)){
@ -159,13 +161,7 @@ class ZugferdEInvoice extends AbstractService
} }
} }
$xrechnung->setDocumentSummation($this->invoice->amount, $this->invoice->balance, $invoicing_data->getSubTotal(), $invoicing_data->getTotalSurcharges(), $invoicing_data->getTotalDiscount(), $invoicing_data->getSubTotal(), $invoicing_data->getItemTotalTaxes(), 0.0, $this->invoice->amount-$this->invoice->balance);
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);
} 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);
}
foreach ($this->tax_map as $item){ foreach ($this->tax_map as $item){
$xrechnung->addDocumentTax($item["tax_type"], "VAT", $item["net_amount"], $item["tax_rate"]*$item["net_amount"], $item["tax_rate"]*100); $xrechnung->addDocumentTax($item["tax_type"], "VAT", $item["net_amount"], $item["tax_rate"]*$item["net_amount"], $item["tax_rate"]*100);
@ -236,7 +232,8 @@ class ZugferdEInvoice extends AbstractService
} }
return $tax_type; 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); $hash = hash("md5", $tax_type."-".$tax_rate);
if (array_key_exists($hash, $this->tax_map)){ if (array_key_exists($hash, $this->tax_map)){
$this->tax_map[$hash]["net_amount"] += $net_amount; $this->tax_map[$hash]["net_amount"] += $net_amount;

1650
composer.lock generated

File diff suppressed because it is too large Load Diff