First attempts at building a multi-year report.

This commit is contained in:
James Cole
2015-12-13 17:31:25 +01:00
parent d7746b3649
commit 80edd47d36
2 changed files with 117 additions and 1 deletions

View File

@@ -151,6 +151,24 @@ class ReportController extends Controller
);
}
public function defaultMultiYear($report_type, $start, $end, $accounts)
{
// list of users stuff:
$budgets = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface')->getActiveBudgets();
$categories = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface')->getCategories();
// and some id's, joined:
$accountIds = [];
/** @var Account $account */
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
$accountIds = join(';', $accountIds);
return view('reports.default.multi-year', compact('budgets', 'accounts', 'categories','start','end','accountIds','report_type'));
}
/**
* @param $report_type
* @param Carbon $start
@@ -172,7 +190,7 @@ class ReportController extends Controller
// more than one year date difference means year report.
if ($start->diffInMonths($end) > 12) {
return view('error')->with('message', 'No report yet for this time period.');
// return $this->defaultMultiYear($report_type, $start, $end, $accounts);
return $this->defaultMultiYear($report_type, $start, $end, $accounts);
}
// more than two months date difference means year report.
if ($start->diffInMonths($end) > 1) {