diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 0c2dc3a8a5ba..20fdd484ba80 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -111,10 +111,27 @@ class QuoteController extends BaseController private static function getViewModel() { + // Tax rate $options + $account = Auth::user()->account; + $rates = TaxRate::scope()->orderBy('name')->get(); + $options = []; + $defaultTax = false; + + foreach ($rates as $rate) { + $options[$rate->rate . ' ' . $rate->name] = $rate->name . ' ' . ($rate->rate+0) . '%'; + + // load default invoice tax + if ($rate->id == $account->default_tax_rate_id) { + $defaultTax = $rate; + } + } + return [ 'entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), + 'taxRateOptions' => $options, + 'defaultTax' => $defaultTax, 'countries' => Cache::get('countries'), 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index d37ab982cb2f..247b1a6038f8 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -815,7 +815,7 @@ @endif if(model.invoice().expenses() && !model.invoice().public_id()){ - model.expense_currency_id({{ $expenseCurrencyId }}); + model.expense_currency_id({{ isset($expenseCurrencyId) ? $expenseCurrencyId : 0 }}); // move the blank invoice line item to the end var blank = model.invoice().invoice_items.pop();