First attempt at including expense report.

This commit is contained in:
James Cole
2015-12-11 16:36:40 +01:00
parent 67fe35d564
commit ad01891a67
5 changed files with 118 additions and 10 deletions

View File

@@ -473,4 +473,25 @@ class ReportHelper implements ReportHelperInterface
return $object;
}
/**
* Get a full report on the users expenses during the period for a list of accounts.
*
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return Expense
*/
public function getExpenseReportForList($start, $end, Collection $accounts)
{
$object = new Expense;
$set = $this->query->expenseInPeriodCorrectedForList($start, $end, $accounts);
foreach ($set as $entry) {
$object->addToTotal($entry->amount_positive);
$object->addOrCreateExpense($entry);
}
return $object;
}
}