close #451 Finished: Format amount fields with respect to currency
This commit is contained in:
@ -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,17 +84,17 @@ class Bills extends Controller
|
||||
$default_amount_model->currency_rate = $_currencies[$item->currency_code];
|
||||
|
||||
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
$convert_amount->default_currency_code = $item->currency_code;
|
||||
$convert_amount->amount = $default_amount;
|
||||
$convert_amount->currency_code = $bill->currency_code;
|
||||
$convert_amount->currency_rate = $_currencies[$bill->currency_code];
|
||||
|
||||
$amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
}
|
||||
|
||||
$convert_amount = new BillPayment();
|
||||
|
||||
$convert_amount->default_currency_code = $item->currency_code;
|
||||
$convert_amount->amount = $default_amount;
|
||||
$convert_amount->currency_code = $bill->currency_code;
|
||||
$convert_amount->currency_rate = $_currencies[$bill->currency_code];
|
||||
|
||||
$amount = (double) $convert_amount->getDynamicConvertedAmount();
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user