closes #281
This commit is contained in:
parent
7897300cb8
commit
d2b0a816e3
@ -84,7 +84,9 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$payment_methods = Modules::getPaymentMethods();
|
$payment_methods = Modules::getPaymentMethods();
|
||||||
|
|
||||||
return view('expenses.bills.show', compact('bill', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories', 'payment_methods'));
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
return view('expenses.bills.show', compact('bill', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories', 'payment_methods', 'taxes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +102,7 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$items = Item::enabled()->pluck('name', 'id');
|
$items = Item::enabled()->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
return view('expenses.bills.create', compact('vendors', 'currencies', 'items', 'taxes'));
|
return view('expenses.bills.create', compact('vendors', 'currencies', 'items', 'taxes'));
|
||||||
}
|
}
|
||||||
@ -301,7 +303,7 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$items = Item::enabled()->pluck('name', 'id');
|
$items = Item::enabled()->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
return view('expenses.bills.edit', compact('bill', 'vendors', 'currencies', 'items', 'taxes'));
|
return view('expenses.bills.edit', compact('bill', 'vendors', 'currencies', 'items', 'taxes'));
|
||||||
}
|
}
|
||||||
@ -476,7 +478,9 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$logo = $this->getLogo($bill);
|
$logo = $this->getLogo($bill);
|
||||||
|
|
||||||
return view($bill->template_path, compact('bill', 'logo'));
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
return view($bill->template_path, compact('bill', 'logo', 'taxes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -492,7 +496,9 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$logo = $this->getLogo($bill);
|
$logo = $this->getLogo($bill);
|
||||||
|
|
||||||
$html = view($bill->template_path, compact('bill', 'logo'))->render();
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
$html = view($bill->template_path, compact('bill', 'logo', 'taxes'))->render();
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
|
@ -87,7 +87,9 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$payment_methods = Modules::getPaymentMethods();
|
$payment_methods = Modules::getPaymentMethods();
|
||||||
|
|
||||||
return view('incomes.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods'));
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
return view('incomes.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods', 'taxes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,7 +105,7 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$items = Item::enabled()->pluck('name', 'id');
|
$items = Item::enabled()->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
$number = $this->getNextInvoiceNumber();
|
$number = $this->getNextInvoiceNumber();
|
||||||
|
|
||||||
@ -322,7 +324,7 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$items = Item::enabled()->pluck('name', 'id');
|
$items = Item::enabled()->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
return view('incomes.invoices.edit', compact('invoice', 'customers', 'currencies', 'items', 'taxes'));
|
return view('incomes.invoices.edit', compact('invoice', 'customers', 'currencies', 'items', 'taxes'));
|
||||||
}
|
}
|
||||||
@ -511,7 +513,11 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$logo = $this->getLogo();
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
$html = view($invoice->template_path, compact('invoice', 'logo'))->render();
|
$taxes = collect(Tax::enabled()->get())->each(function ($item) {
|
||||||
|
$item->title = $item->name . ' (' . $item->rate . '%)';
|
||||||
|
})->pluck('title', 'name');
|
||||||
|
|
||||||
|
$html = view($invoice->template_path, compact('invoice', 'logo', 'taxes'))->render();
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
@ -567,7 +573,9 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$logo = $this->getLogo();
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
return view($invoice->template_path, compact('invoice', 'logo'));
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
return view($invoice->template_path, compact('invoice', 'logo', 'taxes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -583,7 +591,9 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$logo = $this->getLogo();
|
$logo = $this->getLogo();
|
||||||
|
|
||||||
$html = view($invoice->template_path, compact('invoice', 'logo'))->render();
|
$taxes = Tax::enabled()->get()->pluck('title', 'name');
|
||||||
|
|
||||||
|
$html = view($invoice->template_path, compact('invoice', 'logo', 'taxes'))->render();
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
|
@ -49,7 +49,7 @@ class Items extends Controller
|
|||||||
{
|
{
|
||||||
$categories = Category::enabled()->type('item')->pluck('name', 'id');
|
$categories = Category::enabled()->type('item')->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
return view('items.items.create', compact('categories', 'taxes'));
|
return view('items.items.create', compact('categories', 'taxes'));
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ class Items extends Controller
|
|||||||
{
|
{
|
||||||
$categories = Category::enabled()->type('item')->pluck('name', 'id');
|
$categories = Category::enabled()->type('item')->pluck('name', 'id');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
return view('items.items.edit', compact('item', 'categories', 'taxes'));
|
return view('items.items.edit', compact('item', 'categories', 'taxes'));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class Settings extends Controller
|
|||||||
|
|
||||||
$currencies = Currency::enabled()->pluck('name', 'code');
|
$currencies = Currency::enabled()->pluck('name', 'code');
|
||||||
|
|
||||||
$taxes = Tax::enabled()->pluck('name', 'id');
|
$taxes = Tax::enabled()->get()->pluck('title', 'id');
|
||||||
|
|
||||||
$payment_methods = Modules::getPaymentMethods();
|
$payment_methods = Modules::getPaymentMethods();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class Settings extends Controller
|
|||||||
'd F Y' => '31 December 2017',
|
'd F Y' => '31 December 2017',
|
||||||
'd m Y' => '31 12 2017',
|
'd m Y' => '31 12 2017',
|
||||||
'm d Y' => '12 31 2017',
|
'm d Y' => '12 31 2017',
|
||||||
'Y m d' => '2017 12 31'
|
'Y m d' => '2017 12 31',
|
||||||
];
|
];
|
||||||
|
|
||||||
$date_separators = [
|
$date_separators = [
|
||||||
@ -71,7 +71,12 @@ class Settings extends Controller
|
|||||||
'mail' => trans('settings.email.php'),
|
'mail' => trans('settings.email.php'),
|
||||||
'smtp' => trans('settings.email.smtp.name'),
|
'smtp' => trans('settings.email.smtp.name'),
|
||||||
'sendmail' => trans('settings.email.sendmail'),
|
'sendmail' => trans('settings.email.sendmail'),
|
||||||
'log' => trans('settings.email.log')
|
'log' => trans('settings.email.log'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$percent_positions = [
|
||||||
|
'before' => trans('settings.localisation.percent.before'),
|
||||||
|
'after' => trans('settings.localisation.percent.after'),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('settings.settings.edit', compact(
|
return view('settings.settings.edit', compact(
|
||||||
@ -83,7 +88,8 @@ class Settings extends Controller
|
|||||||
'payment_methods',
|
'payment_methods',
|
||||||
'date_formats',
|
'date_formats',
|
||||||
'date_separators',
|
'date_separators',
|
||||||
'email_protocols'
|
'email_protocols',
|
||||||
|
'percent_positions'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,13 @@ class Tax extends Model
|
|||||||
|
|
||||||
protected $table = 'taxes';
|
protected $table = 'taxes';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The accessors to append to the model's array form.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $appends = ['title'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attributes that should be mass-assignable.
|
* Attributes that should be mass-assignable.
|
||||||
*
|
*
|
||||||
@ -48,4 +55,24 @@ class Tax extends Model
|
|||||||
{
|
{
|
||||||
$this->attributes['rate'] = (double) $value;
|
$this->attributes['rate'] = (double) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name including rate.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitleAttribute()
|
||||||
|
{
|
||||||
|
$title = $this->name . ' (';
|
||||||
|
|
||||||
|
if (setting('general.percent_position', 'after') == 'after') {
|
||||||
|
$title .= $this->rate . '%';
|
||||||
|
} else {
|
||||||
|
$title .= '%' . $this->rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title .= ')';
|
||||||
|
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ class Settings extends Seeder
|
|||||||
'general.date_format' => 'd M Y',
|
'general.date_format' => 'd M Y',
|
||||||
'general.date_separator' => 'space',
|
'general.date_separator' => 'space',
|
||||||
'general.timezone' => 'Europe/London',
|
'general.timezone' => 'Europe/London',
|
||||||
|
'general.percent_position' => 'after',
|
||||||
'general.invoice_number_prefix' => 'INV-',
|
'general.invoice_number_prefix' => 'INV-',
|
||||||
'general.invoice_number_digit' => '5',
|
'general.invoice_number_digit' => '5',
|
||||||
'general.invoice_number_next' => '1',
|
'general.invoice_number_next' => '1',
|
||||||
|
@ -21,6 +21,11 @@ return [
|
|||||||
'space' => 'Space ( )',
|
'space' => 'Space ( )',
|
||||||
],
|
],
|
||||||
'timezone' => 'Time Zone',
|
'timezone' => 'Time Zone',
|
||||||
|
'percent' => [
|
||||||
|
'title' => 'Percent (%) Position',
|
||||||
|
'before' => 'Before Number',
|
||||||
|
'after' => 'After Number',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'invoice' => [
|
'invoice' => [
|
||||||
'tab' => 'Invoice',
|
'tab' => 'Invoice',
|
||||||
|
@ -114,10 +114,17 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach($bill->totals as $total)
|
@foreach($bill->totals as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
|
@if (($total->code == 'tax') && isset($taxes[$total->name]))
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ $taxes[$total->name] }}:</th>
|
||||||
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@else
|
||||||
|
<tr>
|
||||||
|
<th>{{ trans($total->name) }}:</th>
|
||||||
|
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
@if ($bill->paid)
|
@if ($bill->paid)
|
||||||
<tr class="text-success">
|
<tr class="text-success">
|
||||||
|
@ -119,10 +119,17 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($bill->totals as $total)
|
@foreach ($bill->totals as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
|
@if (($total->code == 'tax') && isset($taxes[$total->name]))
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ $taxes[$total->name] }}:</th>
|
||||||
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@else
|
||||||
|
<tr>
|
||||||
|
<th>{{ trans($total->name) }}:</th>
|
||||||
|
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
@if ($bill->paid)
|
@if ($bill->paid)
|
||||||
<tr class="text-success">
|
<tr class="text-success">
|
||||||
@ -131,7 +138,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ trans($total->name) }}:</th>
|
||||||
<td class="text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
|
<td class="text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
|
@ -114,10 +114,17 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
|
@if (($total->code == 'tax') && isset($taxes[$total->name]))
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ $taxes[$total->name] }}:</th>
|
||||||
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@else
|
||||||
|
<tr>
|
||||||
|
<th>{{ trans($total->name) }}:</th>
|
||||||
|
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
@if ($invoice->paid)
|
@if ($invoice->paid)
|
||||||
<tr class="text-success">
|
<tr class="text-success">
|
||||||
@ -126,7 +133,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ trans($total->name) }}:</th>
|
||||||
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
|
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
|
@ -121,10 +121,17 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
|
@if (($total->code == 'tax') && isset($taxes[$total->name]))
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ $taxes[$total->name] }}:</th>
|
||||||
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@else
|
||||||
|
<tr>
|
||||||
|
<th>{{ trans($total->name) }}:</th>
|
||||||
|
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
@if ($invoice->paid)
|
@if ($invoice->paid)
|
||||||
<tr class="text-success">
|
<tr class="text-success">
|
||||||
@ -133,7 +140,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ trans($total->name) }}:</th>
|
||||||
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
|
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
{{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, null, []) }}
|
{{ Form::selectGroup('date_separator', trans('settings.localisation.date.separator'), 'minus', $date_separators, null, []) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }}
|
{{ Form::selectGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, null, []) }}
|
||||||
|
|
||||||
|
{{ Form::selectGroup('percent_position', trans('settings.localisation.percent.title'), 'percent', $percent_positions, null, []) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane tab-margin" id="invoice">
|
<div class="tab-pane tab-margin" id="invoice">
|
||||||
@ -164,6 +166,10 @@
|
|||||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.localisation.timezone')]) }}"
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.localisation.timezone')]) }}"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#percent_position").select2({
|
||||||
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.localisation.percent.title')]) }}"
|
||||||
|
});
|
||||||
|
|
||||||
$("#default_account").select2({
|
$("#default_account").select2({
|
||||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.default.account')]) }}"
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans('settings.default.account')]) }}"
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user