1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fix for UBL invoices

This commit is contained in:
Hillel Coren 2018-02-25 23:03:49 +02:00
parent 1bd99880bd
commit 7504cff2dd

View File

@ -57,22 +57,17 @@ class ConvertInvoiceToUbl extends Job
$ublInvoice->setInvoiceLines($invoiceLines); $ublInvoice->setInvoiceLines($invoiceLines);
if ($invoice->hasTaxes()) { $taxtotal = new TaxTotal();
$taxtotal = new TaxTotal(); $taxAmount1 = $taxAmount2 = 0;
$taxAmount1 = $taxAmount2 = 0;
if ($invoice->tax_name1 || floatval($invoice->tax_rate1)) { $taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1);
$taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1); if ($invoice->tax_name2 || floatval($invoice->tax_rate2)) {
} $taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
if ($invoice->tax_name2 || floatval($invoice->tax_rate2)) {
$taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
}
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2);
$ublInvoice->setTaxTotal($taxtotal);
} }
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2);
$ublInvoice->setTaxTotal($taxtotal);
$ublInvoice->setLegalMonetaryTotal((new LegalMonetaryTotal()) $ublInvoice->setLegalMonetaryTotal((new LegalMonetaryTotal())
//->setLineExtensionAmount() //->setLineExtensionAmount()
->setTaxExclusiveAmount($taxable) ->setTaxExclusiveAmount($taxable)
@ -118,22 +113,17 @@ class ConvertInvoiceToUbl extends Job
->setDescription($item->description)); ->setDescription($item->description));
//->setSellersItemIdentification("1ABCD")); //->setSellersItemIdentification("1ABCD"));
if ($item->hasTaxes()) { $taxtotal = new TaxTotal();
$taxtotal = new TaxTotal(); $itemTaxAmount1 = $itemTaxAmount2 = 0;
$itemTaxAmount1 = $itemTaxAmount2 = 0;
if ($item->tax_name1 || floatval($item->tax_rate1)) { $itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1);
$itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1); if ($item->tax_name2 || floatval($item->tax_rate2)) {
} $itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
if ($item->tax_name2 || floatval($item->tax_rate2)) {
$itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
}
$taxtotal->setTaxAmount($itemTaxAmount1 + $itemTaxAmount2);
$invoiceLine->setTaxTotal($taxtotal);
} }
$taxtotal->setTaxAmount($itemTaxAmount1 + $itemTaxAmount2);
$invoiceLine->setTaxTotal($taxtotal);
return $invoiceLine; return $invoiceLine;
} }