This commit is contained in:
James Cole 2019-09-20 16:17:57 +02:00
parent 845ae94252
commit 17c943fcf1
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 4 additions and 2 deletions

View File

@ -206,6 +206,7 @@ class BudgetLimitController extends Controller
$array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']); $array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);
// left per day formatted. // left per day formatted.
$array['amount'] = round($limit['amount'], $limit->transactionCurrency->decimal_places);
$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); $array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']);
return response()->json($array); return response()->json($array);

View File

@ -404,7 +404,8 @@ class BudgetController extends Controller
'currency_symbol' => $noBudgetEntry['currency_symbol'], 'currency_symbol' => $noBudgetEntry['currency_symbol'],
'currency_decimal_places' => $noBudgetEntry['currency_decimal_places'], 'currency_decimal_places' => $noBudgetEntry['currency_decimal_places'],
]; ];
$report['sums'][$noBudgetEntry['currency_id']]['spent'] = bcadd($report['sums'][$noBudgetEntry['currency_id']]['spent'], $noBudgetEntry['sum']); $report['sums'][$noBudgetEntry['currency_id']]['spent']
= bcadd($report['sums'][$noBudgetEntry['currency_id']]['spent'] ?? '0', $noBudgetEntry['sum']);
} }
// make percentages based on total amount. // make percentages based on total amount.