Add discount per item for invoice
This commit is contained in:
@ -77,6 +77,8 @@ class Invoices extends Controller
|
||||
|
||||
$date_format = $this->getCompanyDateFormat();
|
||||
|
||||
$discount_location = $invoice->totals->contains($invoice->totals->where('code', 'discount')->first()) ? 'in_totals' : 'per_item';
|
||||
|
||||
// Get Invoice Totals
|
||||
foreach ($invoice->totals as $invoice_total) {
|
||||
$invoice->{$invoice_total->code} = $invoice_total->amount;
|
||||
@ -90,7 +92,22 @@ class Invoices extends Controller
|
||||
$invoice->grand_total = round($invoice->total - $invoice->paid, $currency->precision);
|
||||
}
|
||||
|
||||
return view('sales.invoices.show', compact('invoice', 'accounts', 'currencies', 'currency', 'account_currency_code', 'customers', 'categories', 'payment_methods', 'signed_url', 'date_format'));
|
||||
return view(
|
||||
'sales.invoices.show',
|
||||
compact(
|
||||
'invoice',
|
||||
'accounts',
|
||||
'currencies',
|
||||
'currency',
|
||||
'account_currency_code',
|
||||
'customers',
|
||||
'categories',
|
||||
'payment_methods',
|
||||
'signed_url',
|
||||
'date_format',
|
||||
'discount_location'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,12 +27,18 @@ class Defaults extends Controller
|
||||
|
||||
$payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
$discount_locations = [
|
||||
'in_totals' => trans('settings.default.discount_in_totals'),
|
||||
'per_item' => trans('settings.default.discount_per_item'),
|
||||
];
|
||||
|
||||
return view('settings.default.edit', compact(
|
||||
'setting',
|
||||
'accounts',
|
||||
'currencies',
|
||||
'taxes',
|
||||
'payment_methods'
|
||||
'payment_methods',
|
||||
'discount_locations'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user