Expanded report for categories.

This commit is contained in:
James Cole
2015-12-11 18:03:13 +01:00
parent d4690ce580
commit 18eba02026
5 changed files with 77 additions and 13 deletions

View File

@@ -325,6 +325,33 @@ class ReportHelper implements ReportHelperInterface
return $object;
}
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return CategoryCollection
*/
public function getCategoryReportForList(Carbon $start, Carbon $end, Collection $accounts)
{
$object = new CategoryCollection;
/**
* GET CATEGORIES:
*/
/** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$set = $repository->getCategories();
foreach ($set as $category) {
$spent = $repository->balanceInPeriodForList($category, $start, $end, $accounts);
$category->spent = $spent;
$object->addCategory($category);
$object->addTotal($spent);
}
return $object;
}
/**
* Get a full report on the users expenses during the period.
*

View File

@@ -91,6 +91,15 @@ interface ReportHelperInterface
*/
public function getCategoryReport(Carbon $start, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return CategoryCollection
*/
public function getCategoryReportForList(Carbon $start, Carbon $end, Collection $accounts);
/**
* Get a full report on the users expenses during the period.
*