diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php index 2360783fc..130ae0420 100644 --- a/app/Http/Controllers/Expenses/Bills.php +++ b/app/Http/Controllers/Expenses/Bills.php @@ -84,9 +84,7 @@ class Bills extends Controller $payment_methods = Modules::getPaymentMethods(); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - return view('expenses.bills.show', compact('bill', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories', 'payment_methods', 'taxes')); + return view('expenses.bills.show', compact('bill', 'accounts', 'currencies', 'account_currency_code', 'vendors', 'categories', 'payment_methods')); } /** @@ -148,6 +146,8 @@ class Bills extends Controller $tax_total = 0; $sub_total = 0; + $discount_total = 0; + $discount = $request['discount']; $bill_item = []; $bill_item['company_id'] = $request['company_id']; @@ -177,6 +177,11 @@ class Bills extends Controller $tax_id = $item['tax_id']; $tax = (($item['price'] * $item['quantity']) / 100) * $tax_object->rate; + + // Apply discount to tax + if ($discount) { + $tax = $tax - ($tax * ($discount / 100)); + } } $bill_item['item_id'] = $item['item_id']; @@ -210,12 +215,21 @@ class Bills extends Controller } } - $request['amount'] += $sub_total + $tax_total; + $s_total = $sub_total; + + // Apply discount to total + if ($discount) { + $s_discount = $s_total * ($discount / 100); + $discount_total += $s_discount; + $s_total = $s_total - $s_discount; + } + + $request['amount'] = $s_total + $tax_total; $bill->update($request->input()); // Add bill totals - $this->addTotals($bill, $request, $taxes, $sub_total, $tax_total); + $this->addTotals($bill, $request, $taxes, $sub_total, $discount_total, $tax_total); // Add bill history BillHistory::create([ @@ -336,6 +350,8 @@ class Bills extends Controller $taxes = []; $tax_total = 0; $sub_total = 0; + $discount_total = 0; + $discount = $request['discount']; $bill_item = []; $bill_item['company_id'] = $request['company_id']; @@ -363,6 +379,11 @@ class Bills extends Controller $tax_id = $item['tax_id']; $tax = (($item['price'] * $item['quantity']) / 100) * $tax_object->rate; + + // Apply discount to tax + if ($discount) { + $tax = $tax - ($tax * ($discount / 100)); + } } $bill_item['item_id'] = $item['item_id']; @@ -392,7 +413,16 @@ class Bills extends Controller } } - $request['amount'] = $sub_total + $tax_total; + $s_total = $sub_total; + + // Apply discount to total + if ($discount) { + $s_discount = $s_total * ($discount / 100); + $discount_total += $s_discount; + $s_total = $s_total - $s_discount; + } + + $request['amount'] = $s_total + $tax_total; $bill->update($request->input()); @@ -407,7 +437,8 @@ class Bills extends Controller BillTotal::where('bill_id', $bill->id)->delete(); // Add bill totals - $this->addTotals($bill, $request, $taxes, $sub_total, $tax_total); + $bill->totals()->delete(); + $this->addTotals($bill, $request, $taxes, $sub_total, $discount_total, $tax_total); // Fire the event to make it extendible event(new BillUpdated($bill)); @@ -478,9 +509,7 @@ class Bills extends Controller $logo = $this->getLogo($bill); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - return view($bill->template_path, compact('bill', 'logo', 'taxes')); + return view($bill->template_path, compact('bill', 'logo')); } /** @@ -496,9 +525,7 @@ class Bills extends Controller $logo = $this->getLogo($bill); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - $html = view($bill->template_path, compact('bill', 'logo', 'taxes'))->render(); + $html = view($bill->template_path, compact('bill', 'logo'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($html); @@ -646,11 +673,11 @@ class Bills extends Controller return $bill; } - protected function addTotals($bill, $request, $taxes, $sub_total, $tax_total) + protected function addTotals($bill, $request, $taxes, $sub_total, $discount_total, $tax_total) { $sort_order = 1; - // Added bill total sub total + // Added bill sub total BillTotal::create([ 'company_id' => $request['company_id'], 'bill_id' => $bill->id, @@ -662,7 +689,24 @@ class Bills extends Controller $sort_order++; - // Added bill total taxes + // Added bill discount + if ($discount_total) { + BillTotal::create([ + 'company_id' => $request['company_id'], + 'bill_id' => $bill->id, + 'code' => 'discount', + 'name' => 'bills.discount', + 'amount' => $discount_total, + 'sort_order' => $sort_order, + ]); + + // This is for total + $sub_total = $sub_total - $discount_total; + } + + $sort_order++; + + // Added bill taxes if ($taxes) { foreach ($taxes as $tax) { BillTotal::create([ @@ -678,7 +722,7 @@ class Bills extends Controller } } - // Added bill total total + // Added bill total BillTotal::create([ 'company_id' => $request['company_id'], 'bill_id' => $bill->id, diff --git a/app/Http/Controllers/Incomes/Invoices.php b/app/Http/Controllers/Incomes/Invoices.php index 8e0917d2c..c222f7eed 100644 --- a/app/Http/Controllers/Incomes/Invoices.php +++ b/app/Http/Controllers/Incomes/Invoices.php @@ -87,9 +87,7 @@ class Invoices extends Controller $payment_methods = Modules::getPaymentMethods(); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - return view('incomes.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods', 'taxes')); + return view('incomes.invoices.show', compact('invoice', 'accounts', 'currencies', 'account_currency_code', 'customers', 'categories', 'payment_methods')); } /** @@ -153,6 +151,8 @@ class Invoices extends Controller $tax_total = 0; $sub_total = 0; + $discount_total = 0; + $discount = $request['discount']; $invoice_item = []; $invoice_item['company_id'] = $request['company_id']; @@ -192,6 +192,11 @@ class Invoices extends Controller $tax_id = $item['tax_id']; $tax = (($item['price'] * $item['quantity']) / 100) * $tax_object->rate; + + // Apply discount to tax + if ($discount) { + $tax = $tax - ($tax * ($discount / 100)); + } } $invoice_item['item_id'] = $item['item_id']; @@ -225,12 +230,21 @@ class Invoices extends Controller } } - $request['amount'] = $sub_total + $tax_total; + $s_total = $sub_total; + + // Apply discount to total + if ($discount) { + $s_discount = $s_total * ($discount / 100); + $discount_total += $s_discount; + $s_total = $s_total - $s_discount; + } + + $request['amount'] = $s_total + $tax_total; $invoice->update($request->input()); // Add invoice totals - $this->addTotals($invoice, $request, $taxes, $sub_total, $tax_total); + $this->addTotals($invoice, $request, $taxes, $sub_total, $discount_total, $tax_total); // Add invoice history InvoiceHistory::create([ @@ -357,6 +371,8 @@ class Invoices extends Controller $taxes = []; $tax_total = 0; $sub_total = 0; + $discount_total = 0; + $discount = $request['discount']; $invoice_item = []; $invoice_item['company_id'] = $request['company_id']; @@ -384,6 +400,11 @@ class Invoices extends Controller $tax_id = $item['tax_id']; $tax = (($item['price'] * $item['quantity']) / 100) * $tax_object->rate; + + // Apply discount to tax + if ($discount) { + $tax = $tax - ($tax * ($discount / 100)); + } } $invoice_item['item_id'] = $item['item_id']; @@ -413,7 +434,16 @@ class Invoices extends Controller } } - $request['amount'] = $sub_total + $tax_total; + $s_total = $sub_total; + + // Apply discount to total + if ($discount) { + $s_discount = $s_total * ($discount / 100); + $discount_total += $s_discount; + $s_total = $s_total - $s_discount; + } + + $request['amount'] = $s_total + $tax_total; $invoice->update($request->input()); @@ -428,7 +458,8 @@ class Invoices extends Controller InvoiceTotal::where('invoice_id', $invoice->id)->delete(); // Add invoice totals - $this->addTotals($invoice, $request, $taxes, $sub_total, $tax_total); + $invoice->totals()->delete(); + $this->addTotals($invoice, $request, $taxes, $sub_total, $discount_total, $tax_total); // Fire the event to make it extendible event(new InvoiceUpdated($invoice)); @@ -513,11 +544,7 @@ class Invoices extends Controller $logo = $this->getLogo(); - $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(); + $html = view($invoice->template_path, compact('invoice', 'logo'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($html); @@ -573,9 +600,7 @@ class Invoices extends Controller $logo = $this->getLogo(); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - return view($invoice->template_path, compact('invoice', 'logo', 'taxes')); + return view($invoice->template_path, compact('invoice', 'logo')); } /** @@ -591,9 +616,7 @@ class Invoices extends Controller $logo = $this->getLogo(); - $taxes = Tax::enabled()->get()->pluck('title', 'name'); - - $html = view($invoice->template_path, compact('invoice', 'logo', 'taxes'))->render(); + $html = view($invoice->template_path, compact('invoice', 'logo'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($html); @@ -783,11 +806,11 @@ class Invoices extends Controller return $invoice; } - protected function addTotals($invoice, $request, $taxes, $sub_total, $tax_total) + protected function addTotals($invoice, $request, $taxes, $sub_total, $discount_total, $tax_total) { $sort_order = 1; - // Added invoice total sub total + // Added invoice sub total InvoiceTotal::create([ 'company_id' => $request['company_id'], 'invoice_id' => $invoice->id, @@ -799,7 +822,24 @@ class Invoices extends Controller $sort_order++; - // Added invoice total taxes + // Added invoice discount + if ($discount_total) { + InvoiceTotal::create([ + 'company_id' => $request['company_id'], + 'invoice_id' => $invoice->id, + 'code' => 'discount', + 'name' => 'invoices.discount', + 'amount' => $discount_total, + 'sort_order' => $sort_order, + ]); + + // This is for total + $sub_total = $sub_total - $discount_total; + } + + $sort_order++; + + // Added invoice taxes if ($taxes) { foreach ($taxes as $tax) { InvoiceTotal::create([ @@ -815,7 +855,7 @@ class Invoices extends Controller } } - // Added invoice total total + // Added invoice total InvoiceTotal::create([ 'company_id' => $request['company_id'], 'invoice_id' => $invoice->id, diff --git a/app/Http/Controllers/Items/Items.php b/app/Http/Controllers/Items/Items.php index 96b27f396..63aa35074 100644 --- a/app/Http/Controllers/Items/Items.php +++ b/app/Http/Controllers/Items/Items.php @@ -246,6 +246,7 @@ class Items extends Controller { $input_items = request('item'); $currency_code = request('currency_code'); + $discount = request('discount'); if (empty($currency_code)) { $currency_code = setting('general.default_currency'); @@ -273,6 +274,12 @@ class Items extends Controller } $sub_total += $item_sub_total; + + // Apply discount to tax + if ($discount) { + $item_tax_total = $item_tax_total - ($item_tax_total * ($discount / 100)); + } + $tax_total += $item_tax_total; $total = $item_sub_total + $item_tax_total; @@ -287,6 +294,11 @@ class Items extends Controller $json->tax_total = money($tax_total, $currency_code, true)->format(); + // Apply discount to total + if ($discount) { + $sub_total = $sub_total - ($sub_total * ($discount / 100)); + } + $grand_total = $sub_total + $tax_total; $json->grand_total = money($grand_total, $currency_code, true)->format(); diff --git a/app/Models/Expense/Bill.php b/app/Models/Expense/Bill.php index 578bd5f62..832c59ba1 100644 --- a/app/Models/Expense/Bill.php +++ b/app/Models/Expense/Bill.php @@ -15,6 +15,13 @@ class Bill extends Model protected $table = 'bills'; + /** + * The accessors to append to the model's array form. + * + * @var array + */ + protected $appends = ['attachment', 'discount']; + protected $dates = ['deleted_at', 'billed_at', 'due_at']; /** @@ -155,4 +162,26 @@ class Bill extends Model return $this->getMedia('attachment')->last(); } + + /** + * Get the discount percentage. + * + * @return string + */ + public function getDiscountAttribute() + { + $discount = 0; + + foreach ($this->totals as $total) { + if ($total->code != 'discount') { + continue; + } + + $discount = number_format((($total->amount * 100) / $this->amount), 0); + + break; + } + + return $discount; + } } diff --git a/app/Models/Expense/BillTotal.php b/app/Models/Expense/BillTotal.php index 10127f3bb..62ba24114 100644 --- a/app/Models/Expense/BillTotal.php +++ b/app/Models/Expense/BillTotal.php @@ -3,6 +3,7 @@ namespace App\Models\Expense; use App\Models\Model; +use App\Models\Setting\Tax; use App\Traits\DateTime; class BillTotal extends Model @@ -33,4 +34,45 @@ class BillTotal extends Model { $this->attributes['amount'] = (double) $value; } + + /** + * Get the formatted name. + * + * @return string + */ + public function getNameAttribute($value) + { + $name = $value; + + $percent = 0; + + // Discount + if ($this->code == 'discount') { + $name = trans($name); + $percent = $this->bill->discount; + } + + // Tax + if ($this->code == 'tax') { + $rate = Tax::where('name', $name)->value('rate'); + + if (!empty($rate)) { + $percent = $rate; + } + } + + if (!empty($percent)) { + $name .= ' ('; + + if (setting('general.percent_position', 'after') == 'after') { + $name .= $percent . '%'; + } else { + $name .= '%' . $percent; + } + + $name .= ')'; + } + + return $name; + } } diff --git a/app/Models/Income/Invoice.php b/app/Models/Income/Invoice.php index bab404484..9554fb7a6 100644 --- a/app/Models/Income/Invoice.php +++ b/app/Models/Income/Invoice.php @@ -21,7 +21,7 @@ class Invoice extends Model * * @var array */ - protected $appends = ['attachment']; + protected $appends = ['attachment', 'discount']; protected $dates = ['deleted_at', 'invoiced_at', 'due_at']; @@ -164,4 +164,26 @@ class Invoice extends Model return $this->getMedia('attachment')->last(); } + + /** + * Get the discount percentage. + * + * @return string + */ + public function getDiscountAttribute() + { + $discount = 0; + + foreach ($this->totals as $total) { + if ($total->code != 'discount') { + continue; + } + + $discount = number_format((($total->amount * 100) / $this->amount), 0); + + break; + } + + return $discount; + } } diff --git a/app/Models/Income/InvoiceTotal.php b/app/Models/Income/InvoiceTotal.php index e97e984fa..88345a38e 100644 --- a/app/Models/Income/InvoiceTotal.php +++ b/app/Models/Income/InvoiceTotal.php @@ -3,6 +3,7 @@ namespace App\Models\Income; use App\Models\Model; +use App\Models\Setting\Tax; use App\Traits\DateTime; class InvoiceTotal extends Model @@ -33,4 +34,45 @@ class InvoiceTotal extends Model { $this->attributes['amount'] = (double) $value; } + + /** + * Get the formatted name. + * + * @return string + */ + public function getNameAttribute($value) + { + $name = $value; + + $percent = 0; + + // Discount + if ($this->code == 'discount') { + $name = trans($name); + $percent = $this->invoice->discount; + } + + // Tax + if ($this->code == 'tax') { + $rate = Tax::where('name', $name)->value('rate'); + + if (!empty($rate)) { + $percent = $rate; + } + } + + if (!empty($percent)) { + $name .= ' ('; + + if (setting('general.percent_position', 'after') == 'after') { + $name .= $percent . '%'; + } else { + $name .= '%' . $percent; + } + + $name .= ')'; + } + + return $name; + } } diff --git a/public/css/app.css b/public/css/app.css index 67f89e918..966652125 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -562,4 +562,11 @@ span.picture, span.attachment { .form-group.col-md-6 input.fake-input.form-control{ min-width: 150px; +} + +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + /* display: none; <- Crashes Chrome on hover */ + -webkit-appearance: none; + margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ } \ No newline at end of file diff --git a/resources/lang/en-GB/bills.php b/resources/lang/en-GB/bills.php index 407cfc8e5..20790a8ec 100644 --- a/resources/lang/en-GB/bills.php +++ b/resources/lang/en-GB/bills.php @@ -12,6 +12,7 @@ return [ 'quantity' => 'Quantity', 'price' => 'Price', 'sub_total' => 'Subtotal', + 'discount' => 'Discount', 'tax_total' => 'Tax Total', 'total' => 'Total', diff --git a/resources/lang/en-GB/invoices.php b/resources/lang/en-GB/invoices.php index d1a62106d..d68e508aa 100644 --- a/resources/lang/en-GB/invoices.php +++ b/resources/lang/en-GB/invoices.php @@ -12,6 +12,7 @@ return [ 'quantity' => 'Quantity', 'price' => 'Price', 'sub_total' => 'Subtotal', + 'discount' => 'Discount', 'tax_total' => 'Tax Total', 'total' => 'Total', diff --git a/resources/views/expenses/bills/bill.blade.php b/resources/views/expenses/bills/bill.blade.php index d36efcb0a..1cc02c139 100644 --- a/resources/views/expenses/bills/bill.blade.php +++ b/resources/views/expenses/bills/bill.blade.php @@ -114,17 +114,10 @@ @foreach($bill->totals as $total) @if ($total->code != 'total') - @if (($total->code == 'tax') && isset($taxes[$total->name])) - - {{ $taxes[$total->name] }}: - @money($total->amount, $bill->currency_code, true) - - @else - - {{ trans($total->name) }}: - @money($total->amount, $bill->currency_code, true) - - @endif + + {{ trans($total->name) }}: + @money($total->amount, $bill->currency_code, true) + @else @if ($bill->paid) diff --git a/resources/views/expenses/bills/create.blade.php b/resources/views/expenses/bills/create.blade.php index d2e51de41..fb7de3f00 100644 --- a/resources/views/expenses/bills/create.blade.php +++ b/resources/views/expenses/bills/create.blade.php @@ -76,6 +76,15 @@ {{ trans('bills.sub_total') }} 0 + + {{ trans('bills.discount') }} + +
+
+ {!! Form::number('discount', null, ['class' => 'form-control text-right']) !!} +
+ + {{ trans_choice('general.taxes', 1) }} 0 @@ -255,7 +264,7 @@ url: '{{ url("items/items/totalItem") }}', type: 'POST', dataType: 'JSON', - data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), + data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, success: function(data) { if (data) { diff --git a/resources/views/expenses/bills/edit.blade.php b/resources/views/expenses/bills/edit.blade.php index 5af16682b..a1d7bcc0a 100644 --- a/resources/views/expenses/bills/edit.blade.php +++ b/resources/views/expenses/bills/edit.blade.php @@ -92,6 +92,15 @@ {{ trans('bills.sub_total') }} 0 + + {{ trans('bills.discount') }} + +
+
+ {!! Form::number('discount', $bill->discount, ['class' => 'form-control text-right']) !!} +
+ + {{ trans_choice('general.taxes', 1) }} 0 @@ -300,7 +309,7 @@ url: '{{ url("items/items/totalItem") }}', type: 'POST', dataType: 'JSON', - data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), + data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, success: function(data) { if (data) { diff --git a/resources/views/expenses/bills/show.blade.php b/resources/views/expenses/bills/show.blade.php index ecbc1d84e..a2e028f00 100644 --- a/resources/views/expenses/bills/show.blade.php +++ b/resources/views/expenses/bills/show.blade.php @@ -119,17 +119,10 @@ @foreach ($bill->totals as $total) @if ($total->code != 'total') - @if (($total->code == 'tax') && isset($taxes[$total->name])) - - {{ $taxes[$total->name] }}: - @money($total->amount, $bill->currency_code, true) - - @else - - {{ trans($total->name) }}: - @money($total->amount, $bill->currency_code, true) - - @endif + + {{ trans($total->name) }}: + @money($total->amount, $bill->currency_code, true) + @else @if ($bill->paid) diff --git a/resources/views/incomes/invoices/create.blade.php b/resources/views/incomes/invoices/create.blade.php index 45cdfad4a..0e0a9f46a 100644 --- a/resources/views/incomes/invoices/create.blade.php +++ b/resources/views/incomes/invoices/create.blade.php @@ -76,6 +76,15 @@ {{ trans('invoices.sub_total') }} 0 + + {{ trans('invoices.discount') }} + +
+
+ {!! Form::number('discount', null, ['class' => 'form-control text-right']) !!} +
+ + {{ trans_choice('general.taxes', 1) }} 0 @@ -256,7 +265,7 @@ url: '{{ url("items/items/totalItem") }}', type: 'POST', dataType: 'JSON', - data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), + data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, success: function(data) { if (data) { diff --git a/resources/views/incomes/invoices/edit.blade.php b/resources/views/incomes/invoices/edit.blade.php index 01c28854c..3abdb1f72 100644 --- a/resources/views/incomes/invoices/edit.blade.php +++ b/resources/views/incomes/invoices/edit.blade.php @@ -91,6 +91,15 @@ {{ trans('invoices.sub_total') }} 0 + + {{ trans('invoices.discount') }} + +
+
+ {!! Form::number('discount', $invoice->discount, ['class' => 'form-control text-right']) !!} +
+ + {{ trans_choice('general.taxes', 1) }} 0 @@ -299,7 +308,7 @@ url: '{{ url("items/items/totalItem") }}', type: 'POST', dataType: 'JSON', - data: $('#currency_code, #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), + data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'), headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, success: function(data) { if (data) { diff --git a/resources/views/incomes/invoices/invoice.blade.php b/resources/views/incomes/invoices/invoice.blade.php index 4cef5201b..91860a10a 100644 --- a/resources/views/incomes/invoices/invoice.blade.php +++ b/resources/views/incomes/invoices/invoice.blade.php @@ -114,17 +114,10 @@ @foreach ($invoice->totals as $total) @if ($total->code != 'total') - @if (($total->code == 'tax') && isset($taxes[$total->name])) - - {{ $taxes[$total->name] }}: - @money($total->amount, $invoice->currency_code, true) - - @else - - {{ trans($total->name) }}: - @money($total->amount, $invoice->currency_code, true) - - @endif + + {{ trans($total->name) }}: + @money($total->amount, $invoice->currency_code, true) + @else @if ($invoice->paid) diff --git a/resources/views/incomes/invoices/show.blade.php b/resources/views/incomes/invoices/show.blade.php index 052a34fc4..39104d4fe 100644 --- a/resources/views/incomes/invoices/show.blade.php +++ b/resources/views/incomes/invoices/show.blade.php @@ -121,17 +121,10 @@ @foreach ($invoice->totals as $total) @if ($total->code != 'total') - @if (($total->code == 'tax') && isset($taxes[$total->name])) - - {{ $taxes[$total->name] }}: - @money($total->amount, $invoice->currency_code, true) - - @else - - {{ trans($total->name) }}: - @money($total->amount, $invoice->currency_code, true) - - @endif + + {{ trans($total->name) }}: + @money($total->amount, $invoice->currency_code, true) + @else @if ($invoice->paid) diff --git a/resources/views/partials/form/number_group.blade.php b/resources/views/partials/form/number_group.blade.php new file mode 100644 index 000000000..de65ab61e --- /dev/null +++ b/resources/views/partials/form/number_group.blade.php @@ -0,0 +1,8 @@ +
+ {!! Form::label($name, $text, ['class' => 'control-label']) !!} +
+
+ {!! Form::number($name, $value, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.enter', ['field' => $text])], $attributes)) !!} +
+ {!! $errors->first($name, '

:message

') !!} +