From a6e546bcdc7252afb0bf6872e6202fca348af96c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 24 Mar 2017 13:29:38 +0300 Subject: [PATCH] Fix for inclusive tax rates --- app/Http/Controllers/InvoiceController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 51b2a9e9bb71..640a6503f27c 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -286,12 +286,14 @@ class InvoiceController extends BaseController } // Check for any taxes which have been deleted + $taxRateOptions = $account->present()->taxRateOptions; if ($invoice->exists) { foreach ($invoice->getTaxes() as $key => $rate) { - if (isset($options[$key])) { + $key = '0 ' . $key; + if (isset($taxRateOptions[$key])) { continue; } - $options['0 ' . $key] = $rate['name'] . ' ' . $rate['rate'] . '%'; + $taxRateOptions[$key] = $rate['name'] . ' ' . $rate['rate'] . '%'; } } @@ -299,7 +301,7 @@ class InvoiceController extends BaseController 'data' => Input::old('data'), 'account' => Auth::user()->account->load('country'), 'products' => Product::scope()->with('default_tax_rate')->orderBy('product_key')->get(), - 'taxRateOptions' => $account->present()->taxRateOptions, + 'taxRateOptions' => $taxRateOptions, 'defaultTax' => $account->default_tax_rate, 'currencies' => Cache::get('currencies'), 'sizes' => Cache::get('sizes'),