Updated various files for #506

This commit is contained in:
James Cole
2016-12-30 13:45:02 +01:00
parent 9ec3febbfa
commit ac86e75233
22 changed files with 63 additions and 70 deletions

View File

@@ -128,7 +128,7 @@ class AccountController extends Controller
$endBalance = $endBalances[$id] ?? '0';
$diff = bcsub($endBalance, $startBalance);
if (bccomp($diff, '0') !== 0) {
$chartData[$account->name] = round($diff, 2);
$chartData[$account->name] = $diff;
}
}
arsort($chartData);
@@ -391,7 +391,7 @@ class AccountController extends Controller
$diff = bcsub($endBalance, $startBalance);
$diff = bcmul($diff, '-1');
if (bccomp($diff, '0') !== 0) {
$chartData[$account->name] = round($diff, 2);
$chartData[$account->name] = $diff;
}
}
@@ -475,11 +475,11 @@ class AccountController extends Controller
];
$currentStart = clone $start;
$range = Steam::balanceInRange($account, $start, clone $end);
$previous = round(array_values($range)[0], 2);
$previous = array_values($range)[0];
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = $currentStart->formatLocalized(strval(trans('config.month_and_day')));
$balance = isset($range[$format]) ? round($range[$format], 2) : $previous;
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
$previous = $balance;
$currentStart->addDay();
$currentSet['entries'][$label] = $balance;

View File

@@ -231,9 +231,9 @@ class BudgetController extends Controller
$current = clone $start;
while ($current < $end) {
$currentStart = Navigation::startOfPeriod($current, $range);
$currentEnd = Navigation::endOfPeriod($current, $range);
$budgetLimits = $repository->getBudgetLimits($budget, $currentStart, $currentEnd);
$currentStart = Navigation::startOfPeriod($current, $range);
$currentEnd = Navigation::endOfPeriod($current, $range);
$budgetLimits = $repository->getBudgetLimits($budget, $currentStart, $currentEnd);
$index = $currentStart->format($key);
$budgeted[$index] = $budgetLimits->sum('amount');
$currentEnd->addDay();
@@ -258,7 +258,7 @@ class BudgetController extends Controller
$label = $periods[$period];
$spent = isset($entries[$budget->id]['entries'][$period]) ? $entries[$budget->id]['entries'][$period] : '0';
$limit = isset($budgeted[$period]) ? $budgeted[$period] : 0;
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 2);
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
$chartData[1]['entries'][$label] = $limit;
}

View File

@@ -245,8 +245,8 @@ class BudgetReportController extends Controller
$currentExpenses = $expenses[$budget->id] ?? '0';
$sumOfExpenses[$budget->id] = $sumOfExpenses[$budget->id] ?? '0';
$sumOfExpenses[$budget->id] = bcadd($currentExpenses, $sumOfExpenses[$budget->id]);
$chartData[$budget->id]['entries'][$label] = round(bcmul($currentExpenses, '-1'), 2);
$chartData[$budget->id . '-sum']['entries'][$label] = round(bcmul($sumOfExpenses[$budget->id], '-1'), 2);
$chartData[$budget->id]['entries'][$label] = bcmul($currentExpenses, '-1');
$chartData[$budget->id . '-sum']['entries'][$label] = bcmul($sumOfExpenses[$budget->id], '-1');
if (count($budgetLimits) > 0) {
$budgetLimitId = $budgetLimits->first()->id;