/** * @param ARI $repository * * @return View * @internal param ReportHelperInterface $helper */ public function index(ARI $repository) { $start = Session::get('first'); $months = $this->helper->listOfMonths($start); $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; // does the user have shared accounts? $accounts = $repository->getAccounts(['Default account', 'Asset account']); // get id's for quick links: $accountIds = []; /** @var Account $account */ foreach ($accounts as $account) { $accountIds[] = $account->id; } $accountList = join(',', $accountIds); return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear')); }
/** * @param $reportType * @param Carbon $start * @param Carbon $end * @param Collection $accounts * * @return View */ private function defaultYear(string $reportType, Carbon $start, Carbon $end, Collection $accounts) { $incomeTopLength = 8; $expenseTopLength = 8; $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts); $incomes = $this->helper->getIncomeReport($start, $end, $accounts); $expenses = $this->helper->getExpenseReport($start, $end, $accounts); $tags = $this->helper->tagReport($start, $end, $accounts); $budgets = $this->budgetHelper->budgetYearOverview($start, $end, $accounts); Session::flash('gaEventCategory', 'report'); Session::flash('gaEventAction', 'year'); Session::flash('gaEventLabel', $start->format('Y')); // and some id's, joined: $accountIds = []; /** @var Account $account */ foreach ($accounts as $account) { $accountIds[] = $account->id; } $accountIds = join(',', $accountIds); return view('reports.default.year', compact('start', 'accountReport', 'incomes', 'reportType', 'accountIds', 'end', 'expenses', 'incomeTopLength', 'expenseTopLength', 'tags', 'budgets')); }
/** * @param $year * * @param bool $shared * * @return $this */ public function year($year, $shared = false) { $start = new Carbon('01-01-' . $year); $end = clone $start; $subTitle = trans('firefly.reportForYear', ['year' => $year]); $subTitleIcon = 'fa-bar-chart'; $incomeTopLength = 8; $expenseTopLength = 8; if ($shared == 'shared') { $shared = true; $subTitle = trans('firefly.reportForYearShared', ['year' => $year]); } $end->endOfYear(); $accounts = $this->helper->getAccountReport($start, $end, $shared); $incomes = $this->helper->getIncomeReport($start, $end, $shared); $expenses = $this->helper->getExpenseReport($start, $end, $shared); Session::flash('gaEventCategory', 'report'); Session::flash('gaEventAction', 'year'); Session::flash('gaEventLabel', $start->format('Y')); return view('reports.year', compact('start', 'shared', 'accounts', 'incomes', 'expenses', 'subTitle', 'subTitleIcon', 'incomeTopLength', 'expenseTopLength')); }
/** * @param $reportType * @param $start * @param $end * @param $accounts * * @return View */ public function defaultMultiYear($reportType, $start, $end, $accounts) { $incomeTopLength = 8; $expenseTopLength = 8; // list of users stuff: $budgets = app('FireflyIII\\Repositories\\Budget\\BudgetRepositoryInterface')->getActiveBudgets(); $categories = app('FireflyIII\\Repositories\\Category\\CategoryRepositoryInterface')->listCategories(); $accountReport = $this->helper->getAccountReport($start, $end, $accounts); // done (+2) $incomes = $this->helper->getIncomeReport($start, $end, $accounts); // done (+3) $expenses = $this->helper->getExpenseReport($start, $end, $accounts); // done (+1) // 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', 'reportType', 'accountReport', 'incomes', 'expenses', 'incomeTopLength', 'expenseTopLength')); }
/** * @param $report_type * @param Carbon $start * @param Carbon $end * @param Collection $accounts * * @return View */ public function defaultMonth($report_type, Carbon $start, Carbon $end, Collection $accounts) { $incomeTopLength = 8; $expenseTopLength = 8; // get report stuff! $accountReport = $this->helper->getAccountReport($start, $end, $accounts); $incomes = $this->helper->getIncomeReport($start, $end, $accounts); $expenses = $this->helper->getExpenseReport($start, $end, $accounts); $budgets = $this->helper->getBudgetReport($start, $end, $accounts); $categories = $this->helper->getCategoryReport($start, $end, $accounts); $balance = $this->helper->getBalanceReport($start, $end, $accounts); $bills = $this->helper->getBillReport($start, $end, $accounts); // and some id's, joined: $accountIds = []; /** @var Account $account */ foreach ($accounts as $account) { $accountIds[] = $account->id; } $accountIds = join(',', $accountIds); // continue! return view('reports.default.month', compact('start', 'end', 'report_type', 'accountReport', 'incomes', 'incomeTopLength', 'expenses', 'expenseTopLength', 'budgets', 'balance', 'categories', 'bills', 'accountIds', 'report_type')); }