diff --git a/app/Http/Controllers/Modals/BillPayments.php b/app/Http/Controllers/Modals/BillPayments.php index 0446ea9bf..f66e08444 100644 --- a/app/Http/Controllers/Modals/BillPayments.php +++ b/app/Http/Controllers/Modals/BillPayments.php @@ -39,10 +39,10 @@ class BillPayments extends Controller $currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray(); - $currency = Currency::where('code', setting('general.default_currency'))->first(); - $account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first(); + $currency = Currency::where('code', $account_currency_code)->first(); + $payment_methods = Modules::getPaymentMethods(); $bill->paid = $this->getPaid($bill); @@ -52,7 +52,9 @@ class BillPayments extends Controller $bill->{$bill_total->code} = $bill_total->amount; } - $bill->grand_total = $bill->total; + $total = money($bill->total, $currency->code, true)->format(); + + $bill->grand_total = money($total, $currency->code)->getAmount(); if (!empty($paid)) { $bill->grand_total = $bill->total - $paid; diff --git a/app/Http/Controllers/Modals/InvoicePayments.php b/app/Http/Controllers/Modals/InvoicePayments.php index 737dd13a6..6bd543a12 100644 --- a/app/Http/Controllers/Modals/InvoicePayments.php +++ b/app/Http/Controllers/Modals/InvoicePayments.php @@ -52,7 +52,9 @@ class InvoicePayments extends Controller $invoice->{$invoice_total->code} = $invoice_total->amount; } - $invoice->grand_total = $invoice->total; + $total = money($invoice->total, $currency->code, true)->format(); + + $invoice->grand_total = money($total, $currency->code)->getAmount(); if (!empty($paid)) { $invoice->grand_total = $invoice->total - $paid; @@ -147,7 +149,7 @@ class InvoicePayments extends Controller $error_amount = (double) $convert_amount->getDynamicConvertedAmount(); } - $message = trans('messages.error.over_payment', ['amount' => money($error_amount, $request['currency_code'],true)]); + $message = trans('messages.error.over_payment', ['amount' => money($error_amount, $request['currency_code'], true)]); return response()->json([ 'success' => false,