close #451 Finished: Format amount fields with respect to currency
This commit is contained in:
parent
3589a0b5fc
commit
a3a2cf55fe
@ -71,9 +71,11 @@ class Bills extends Controller
|
||||
$_currencies = Currency::enabled()->pluck('rate', 'code')->toArray();
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$default_amount = $item->amount;
|
||||
$default_amount = (double) $item->amount;
|
||||
|
||||
if ($bill->currency_code != $item->currency_code) {
|
||||
if ($bill->currency_code == $item->currency_code) {
|
||||
$amount = $default_amount;
|
||||
} else {
|
||||
$default_amount_model = new BillPayment();
|
||||
|
||||
$default_amount_model->default_currency_code = $bill->currency_code;
|
||||
@ -82,7 +84,6 @@ class Bills extends Controller
|
||||
$default_amount_model->currency_rate = $_currencies[$item->currency_code];
|
||||
|
||||
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
|
||||
}
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
@ -92,6 +93,7 @@ class Bills extends Controller
|
||||
$convert_amount->currency_rate = $_currencies[$bill->currency_code];
|
||||
|
||||
$amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
@ -88,7 +88,9 @@ class BillPayments extends Controller
|
||||
|
||||
$default_amount = (double) $request['amount'];
|
||||
|
||||
if ($bill->currency_code != $request['currency_code']) {
|
||||
if ($bill->currency_code == $request['currency_code']) {
|
||||
$amount = $default_amount;
|
||||
} else {
|
||||
$default_amount_model = new BillPayment();
|
||||
|
||||
$default_amount_model->default_currency_code = $bill->currency_code;
|
||||
@ -97,7 +99,6 @@ class BillPayments extends Controller
|
||||
$default_amount_model->currency_rate = $currencies[$request['currency_code']];
|
||||
|
||||
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
|
||||
}
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
@ -107,6 +108,7 @@ class BillPayments extends Controller
|
||||
$convert_amount->currency_rate = $currencies[$bill->currency_code];
|
||||
|
||||
$amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
if ($bill->payments()->count()) {
|
||||
$total_amount -= $this->getPaid($bill);
|
||||
@ -134,7 +136,6 @@ class BillPayments extends Controller
|
||||
$error_amount_model->currency_rate = $currencies[$bill->currency_code];
|
||||
|
||||
$error_amount = (double) $error_amount_model->getDivideConvertedAmount();
|
||||
}
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
@ -144,6 +145,7 @@ class BillPayments extends Controller
|
||||
$convert_amount->currency_rate = $currencies[$request['currency_code']];
|
||||
|
||||
$error_amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$message = trans('messages.error.over_payment', ['amount' => money($error_amount, $request['currency_code'], true)]);
|
||||
|
||||
@ -215,9 +217,11 @@ class BillPayments extends Controller
|
||||
$_currencies = Currency::enabled()->pluck('rate', 'code')->toArray();
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$default_amount = $item->amount;
|
||||
$default_amount = (double) $item->amount;
|
||||
|
||||
if ($bill->currency_code != $item->currency_code) {
|
||||
if ($bill->currency_code == $item->currency_code) {
|
||||
$amount = $default_amount;
|
||||
} else {
|
||||
$default_amount_model = new BillPayment();
|
||||
|
||||
$default_amount_model->default_currency_code = $bill->currency_code;
|
||||
@ -226,7 +230,6 @@ class BillPayments extends Controller
|
||||
$default_amount_model->currency_rate = $_currencies[$item->currency_code];
|
||||
|
||||
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
|
||||
}
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
@ -236,6 +239,7 @@ class BillPayments extends Controller
|
||||
$convert_amount->currency_rate = $_currencies[$bill->currency_code];
|
||||
|
||||
$amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user