Call the corrected spent function [skip ci]

This commit is contained in:
James Cole 2015-05-20 06:47:53 +02:00
parent 54387c8fdf
commit 5ed09e3f38

View File

@ -247,7 +247,7 @@ class ReportHelper implements ReportHelperInterface
// no repetition(s) for this budget: // no repetition(s) for this budget:
if ($repetitions->count() == 0) { if ($repetitions->count() == 0) {
$spent = $repository->spentInPeriod($budget, $start, $end, $shared); $spent = $repository->spentInPeriodCorrected($budget, $start, $end, $shared);
$budgetLine = new BudgetLine; $budgetLine = new BudgetLine;
$budgetLine->setBudget($budget); $budgetLine->setBudget($budget);
$budgetLine->setOverspent($spent); $budgetLine->setOverspent($spent);
@ -262,7 +262,7 @@ class ReportHelper implements ReportHelperInterface
$budgetLine = new BudgetLine; $budgetLine = new BudgetLine;
$budgetLine->setBudget($budget); $budgetLine->setBudget($budget);
$budgetLine->setRepetition($repetition); $budgetLine->setRepetition($repetition);
$expenses = $repository->spentInPeriod($budget, $repetition->startdate, $repetition->enddate, $shared); $expenses = $repository->spentInPeriodCorrected($budget, $repetition->startdate, $repetition->enddate, $shared);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0; $left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses; $spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0; $overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
@ -311,7 +311,7 @@ class ReportHelper implements ReportHelperInterface
$repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface'); $repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$set = $repository->getCategories(); $set = $repository->getCategories();
foreach ($set as $category) { foreach ($set as $category) {
$spent = $repository->spentInPeriod($category, $start, $end, $shared); $spent = $repository->spentInPeriodCorrected($category, $start, $end, $shared);
$category->spent = $spent; $category->spent = $spent;
$object->addCategory($category); $object->addCategory($category);
$object->addTotal($spent); $object->addTotal($spent);