bill/invoice show page currency enhancement

This commit is contained in:
Cüneyt Şentürk
2021-01-21 16:11:44 +03:00
parent f0293f0c1f
commit 76eab1900e
2 changed files with 6 additions and 10 deletions

View File

@ -47,19 +47,17 @@ class Invoices extends Controller
*/
public function show(Document $invoice)
{
$currency = Currency::where('code', $invoice->currency_code)->first();
// Get Invoice Totals
foreach ($invoice->totals_sorted as $invoice_total) {
$invoice->{$invoice_total->code} = $invoice_total->amount;
}
$total = money($invoice->total, $currency->code, true)->format();
$total = money($invoice->total, $invoice->currency_code, true)->format();
$invoice->grand_total = money($total, $currency->code)->getAmount();
$invoice->grand_total = money($total, $invoice->currency_code)->getAmount();
if (!empty($invoice->paid)) {
$invoice->grand_total = round($invoice->total - $invoice->paid, $currency->precision);
$invoice->grand_total = round($invoice->total - $invoice->paid, config('money.' . $invoice->currency_code . '.precision'));
}
return view('sales.invoices.show', compact('invoice'));