close #581: Decimals problem for bill and invoice
This commit is contained in:
parent
c412f2c4ab
commit
af95d9b552
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user