Fix for quotes

This commit is contained in:
Hillel Coren 2016-04-11 11:44:53 +03:00
parent b296c55911
commit d4915074b6
2 changed files with 18 additions and 1 deletions

View File

@ -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(),

View File

@ -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();