/** * @param string $year * @param string $month * * @param bool $shared * * @return \Illuminate\View\View */ public function month($year = '2014', $month = '1', $shared = false) { $start = new Carbon($year . '-' . $month . '-01'); $subTitle = trans('firefly.reportForMonth', ['month' => $start->formatLocalized($this->monthFormat)]); $subTitleIcon = 'fa-calendar'; $end = clone $start; $incomeTopLength = 8; $expenseTopLength = 8; if ($shared == 'shared') { $shared = true; $subTitle = trans('firefly.reportForMonthShared', ['month' => $start->formatLocalized($this->monthFormat)]); } $end->endOfMonth(); $accounts = $this->helper->getAccountReport($start, $end, $shared); $incomes = $this->helper->getIncomeReport($start, $end, $shared); $expenses = $this->helper->getExpenseReport($start, $end, $shared); $budgets = $this->helper->getBudgetReport($start, $end, $shared); $categories = $this->helper->getCategoryReport($start, $end, $shared); $balance = $this->helper->getBalanceReport($start, $end, $shared); $bills = $this->helper->getBillReport($start, $end); Session::flash('gaEventCategory', 'report'); Session::flash('gaEventAction', 'month'); Session::flash('gaEventLabel', $start->format('F Y')); return view('reports.month', compact('start', 'shared', 'subTitle', 'subTitleIcon', 'accounts', 'incomes', 'incomeTopLength', 'expenses', 'expenseTopLength', 'budgets', 'balance', 'categories', 'bills')); }
/** * @param $reportType * @param Carbon $start * @param Carbon $end * @param Collection $accounts * * @return View */ public function defaultMonth($reportType, Carbon $start, Carbon $end, Collection $accounts) { $incomeTopLength = 8; $expenseTopLength = 8; // get report stuff! $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts); $incomes = $this->helper->getIncomeReport($start, $end, $accounts); $expenses = $this->helper->getExpenseReport($start, $end, $accounts); $budgets = $this->budgetHelper->getBudgetReport($start, $end, $accounts); $categories = $this->helper->getCategoryReport($start, $end, $accounts); $balance = $this->balanceHelper->getBalanceReport($start, $end, $accounts); $bills = $this->helper->getBillReport($start, $end, $accounts); // and some id's, joined: $accountIds = join(',', $accounts->pluck('id')->toArray()); // continue! return view('reports.default.month', compact('start', 'end', 'reportType', 'accountReport', 'incomes', 'incomeTopLength', 'expenses', 'expenseTopLength', 'budgets', 'balance', 'categories', 'bills', 'accountIds', 'reportType')); }
/** * @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')); }