Fix issue with budget chart.

This commit is contained in:
James Cole
2018-01-17 10:17:49 +01:00
parent 13df973873
commit 70da38193f

View File

@@ -107,10 +107,14 @@ class BudgetController extends Controller
while ($end >= $current) {
$currentEnd = app('navigation')->endOfPeriod($current, $step);
if ($step === '1Y') {
$currentEnd->subDay();
}
$spent = $this->repository->spentInPeriod($budgetCollection, new Collection, $current, $currentEnd);
$label = app('navigation')->periodShow($current, $step);
$chartData[$label] = floatval(bcmul($spent,'-1'));
$current = app('navigation')->addPeriod($current, $step, 1);
$chartData[$label] = floatval(bcmul($spent, '-1'));
$current = clone $currentEnd;
$current->addDay();
}
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);