diff --git a/app/Http/Controllers/Purchases/Bills.php b/app/Http/Controllers/Purchases/Bills.php index f13c22f7d..eeaf03c03 100644 --- a/app/Http/Controllers/Purchases/Bills.php +++ b/app/Http/Controllers/Purchases/Bills.php @@ -47,19 +47,17 @@ class Bills extends Controller */ public function show(Document $bill) { - $currency = Currency::where('code', $bill->currency_code)->first(); - // Get Bill Totals foreach ($bill->totals_sorted as $bill_total) { $bill->{$bill_total->code} = $bill_total->amount; } - $total = money($bill->total, $currency->code, true)->format(); + $total = money($bill->total, $bill->currency_code, true)->format(); - $bill->grand_total = money($total, $currency->code)->getAmount(); + $bill->grand_total = money($total, $bill->currency_code)->getAmount(); if (!empty($bill->paid)) { - $bill->grand_total = round($bill->total - $bill->paid, $currency->precision); + $bill->grand_total = round($bill->total - $bill->paid, config('money.' . $bill->currency_code . '.precision')); } return view('purchases.bills.show', compact('bill')); diff --git a/app/Http/Controllers/Sales/Invoices.php b/app/Http/Controllers/Sales/Invoices.php index e49e2930b..310b16ebd 100644 --- a/app/Http/Controllers/Sales/Invoices.php +++ b/app/Http/Controllers/Sales/Invoices.php @@ -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'));