From 4f1964b6942bea7253102306a6a757e9b93b4f53 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 8 Aug 2024 13:41:10 +0200 Subject: [PATCH] Fixed 0% vatrate in bmd export for non-domestic invoices --- application/Invoice/InvoiceController.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/application/Invoice/InvoiceController.php b/application/Invoice/InvoiceController.php index 823c8802f..96b2a4b8a 100644 --- a/application/Invoice/InvoiceController.php +++ b/application/Invoice/InvoiceController.php @@ -654,6 +654,8 @@ class InvoiceController extends mfBaseController { $filter["!vatgroup_id"] = TT_VATGROUP_CREDIT; } + //$filter["invoice_number"] = "RN2024-X033707"; + //var_dump($filter);exit; if(!InvoiceModel::search($filter)) { $this->layout()->setFlash("Keine neuen Rechnungen seit letztem BMD-Export vorhanden."); @@ -664,10 +666,14 @@ class InvoiceController extends mfBaseController { die("wtf"); } - $vatrate = (($invoice->total == $invoice->total_gross) ? "0" : "20"); if($invoice->total_gross){ $vatrate = 20; } + if($invoice->total == $invoice->total_gross && $invoice->fibu_cost_area != "domestic") { + $vatrate = "0"; + } else { + $vatrate = "20"; + } $vat = $invoice->total_gross - $invoice->total; $vat *= -1; @@ -917,6 +923,11 @@ class InvoiceController extends mfBaseController { //var_dump($pdf_files);exit; $i = 0; + // Merge PDFs one after the other, otherwise the cmdline arguments could become too many for the shell to handle + + // Need to use a new output file name every time pdfunite runs + // Cannot use first input file as output + // So just swap 2 temp file names each round $first = true; $tmp_file1 = "$output_filepath.tmp1"; $tmp_file2 = "$output_filepath.tmp2";