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 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'));