mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 22:35:03 +00:00
Cleaned up report controller.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Helpers\Report;
|
namespace FireflyIII\Helpers\Report;
|
||||||
|
|
||||||
|
use App;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
@@ -40,17 +41,20 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
* This method gets some kind of list for a monthly overview.
|
* This method gets some kind of list for a monthly overview.
|
||||||
*
|
*
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
|
* @param bool $showSharedReports
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getBudgetsForMonth(Carbon $date)
|
public function getBudgetsForMonth(Carbon $date, $showSharedReports = false)
|
||||||
{
|
{
|
||||||
|
/** @var \FireflyIII\Helpers\Report\ReportQueryInterface $query */
|
||||||
|
$query = App::make('FireflyIII\Helpers\Report\ReportQueryInterface');
|
||||||
|
|
||||||
$start = clone $date;
|
$start = clone $date;
|
||||||
$start->startOfMonth();
|
$start->startOfMonth();
|
||||||
$end = clone $date;
|
$end = clone $date;
|
||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
// all budgets
|
$set = Auth::user()->budgets()->orderBy('budgets.name', 'ASC')
|
||||||
$set = Auth::user()->budgets()
|
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
'budget_limits', function (JoinClause $join) use ($date) {
|
'budget_limits', function (JoinClause $join) use ($date) {
|
||||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
||||||
@@ -58,22 +62,24 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
)
|
)
|
||||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
->get(['budgets.*', 'budget_limits.amount as amount']);
|
||||||
|
|
||||||
|
$budgets = Steam::makeArray($set);
|
||||||
|
$amountSet = $query->journalsByBudget($start, $end, $showSharedReports);
|
||||||
|
$amounts = Steam::makeArray($amountSet);
|
||||||
|
$budgets = Steam::mergeArrays($budgets, $amounts);
|
||||||
|
$budgets[0]['spent'] = isset($budgets[0]['spent']) ? $budgets[0]['spent'] : 0.0;
|
||||||
|
$budgets[0]['amount'] = isset($budgets[0]['amount']) ? $budgets[0]['amount'] : 0.0;
|
||||||
|
$budgets[0]['name'] = 'No budget';
|
||||||
|
|
||||||
$budgets = $this->_helper->makeArray($set);
|
// find transactions to shared asset accounts, which are without a budget by default:
|
||||||
$amountSet = $this->_queries->journalsByBudget($start, $end);
|
// which is only relevant when shared asset accounts are hidden.
|
||||||
$amounts = $this->_helper->makeArray($amountSet);
|
if ($showSharedReports === false) {
|
||||||
$combined = $this->_helper->mergeArrays($budgets, $amounts);
|
$transfers = $query->sharedExpenses($start, $end);
|
||||||
$combined[0]['spent'] = isset($combined[0]['spent']) ? $combined[0]['spent'] : 0.0;
|
foreach ($transfers as $transfer) {
|
||||||
$combined[0]['amount'] = isset($combined[0]['amount']) ? $combined[0]['amount'] : 0.0;
|
$budgets[0]['spent'] += floatval($transfer->amount) * -1;
|
||||||
$combined[0]['name'] = 'No budget';
|
}
|
||||||
|
|
||||||
// find transactions to shared expense accounts, which are without a budget by default:
|
|
||||||
$transfers = $this->_queries->sharedExpenses($start, $end);
|
|
||||||
foreach ($transfers as $transfer) {
|
|
||||||
$combined[0]['spent'] += floatval($transfer->amount) * -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $combined;
|
return $budgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -342,29 +342,6 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
public function journalsByExpenseAccount(Carbon $start, Carbon $end, $showSharedReports = false)
|
public function journalsByExpenseAccount(Carbon $start, Carbon $end, $showSharedReports = false)
|
||||||
{
|
{
|
||||||
$query = $this->queryJournalsWithTransactions($start, $end);
|
$query = $this->queryJournalsWithTransactions($start, $end);
|
||||||
$query = TransactionJournal::leftJoin(
|
|
||||||
'transactions as t_from', function (JoinClause $join) {
|
|
||||||
$join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0);
|
|
||||||
}
|
|
||||||
)->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')
|
|
||||||
->leftJoin(
|
|
||||||
'account_meta as acm_from', function (JoinClause $join) {
|
|
||||||
$join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->leftJoin(
|
|
||||||
'transactions as t_to', function (JoinClause $join) {
|
|
||||||
$join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')
|
|
||||||
->leftJoin(
|
|
||||||
'account_meta as acm_to', function (JoinClause $join) {
|
|
||||||
$join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
|
|
||||||
|
|
||||||
if ($showSharedReports === false) {
|
if ($showSharedReports === false) {
|
||||||
// get all withdrawals not from a shared accounts
|
// get all withdrawals not from a shared accounts
|
||||||
// and all transfers to a shared account
|
// and all transfers to a shared account
|
||||||
|
@@ -1,18 +1,16 @@
|
|||||||
<?php namespace FireflyIII\Http\Controllers;
|
<?php namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\Preference;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
use View;
|
use View;
|
||||||
use FireflyIII\Models\Preference;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ReportController
|
* Class ReportController
|
||||||
@@ -22,11 +20,20 @@ use FireflyIII\Models\Preference;
|
|||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** @var ReportHelperInterface */
|
||||||
|
protected $helper;
|
||||||
|
/** @var ReportQueryInterface */
|
||||||
|
protected $query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param ReportHelperInterface $helper
|
||||||
|
* @param ReportQueryInterface $query
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(ReportHelperInterface $helper, ReportQueryInterface $query)
|
||||||
{
|
{
|
||||||
|
$this->query = $query;
|
||||||
|
$this->helper = $helper;
|
||||||
|
|
||||||
View::share('title', 'Reports');
|
View::share('title', 'Reports');
|
||||||
View::share('mainTitleIcon', 'fa-line-chart');
|
View::share('mainTitleIcon', 'fa-line-chart');
|
||||||
|
|
||||||
@@ -38,7 +45,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function budget($year = '2014', $month = '1', ReportQueryInterface $query)
|
public function budget($year = '2014', $month = '1')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new Carbon($year . '-' . $month . '-01');
|
new Carbon($year . '-' . $month . '-01');
|
||||||
@@ -52,7 +59,7 @@ class ReportController extends Controller
|
|||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
$start->subDay();
|
$start->subDay();
|
||||||
|
|
||||||
// shared accounts preference:
|
/** @var Preference $pref */
|
||||||
$pref = Preferences::get('showSharedReports', false);
|
$pref = Preferences::get('showSharedReports', false);
|
||||||
$showSharedReports = $pref->data;
|
$showSharedReports = $pref->data;
|
||||||
|
|
||||||
@@ -61,13 +68,13 @@ class ReportController extends Controller
|
|||||||
$subTitle = 'Budget report for ' . $date->format('F Y');
|
$subTitle = 'Budget report for ' . $date->format('F Y');
|
||||||
$subTitleIcon = 'fa-calendar';
|
$subTitleIcon = 'fa-calendar';
|
||||||
$dayEarly = $dayEarly->subDay();
|
$dayEarly = $dayEarly->subDay();
|
||||||
$accounts = $query->getAllAccounts($start, $end, $showSharedReports);
|
$accounts = $this->query->getAllAccounts($start, $end, $showSharedReports);
|
||||||
$start->addDay();
|
$start->addDay();
|
||||||
|
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($start, $end, $query) {
|
function (Account $account) use ($start, $end) {
|
||||||
$budgets = $query->getBudgetSummary($account, $start, $end);
|
$budgets = $this->query->getBudgetSummary($account, $start, $end);
|
||||||
$balancedAmount = $query->balancedTransactionsSum($account, $start, $end);
|
$balancedAmount = $this->query->balancedTransactionsSum($account, $start, $end);
|
||||||
$array = [];
|
$array = [];
|
||||||
$hide = true;
|
$hide = true;
|
||||||
foreach ($budgets as $budget) {
|
foreach ($budgets as $budget) {
|
||||||
@@ -85,35 +92,10 @@ class ReportController extends Controller
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$start = clone $date;
|
|
||||||
$start->startOfMonth();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start getBudgetsForMonth DONE
|
* Start getBudgetsForMonth DONE
|
||||||
*/
|
*/
|
||||||
$set = Auth::user()->budgets()->orderBy('budgets.name', 'ASC')
|
$budgets = $this->helper->getBudgetsForMonth($date, $showSharedReports);
|
||||||
->leftJoin(
|
|
||||||
'budget_limits', function (JoinClause $join) use ($date) {
|
|
||||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
|
||||||
$budgets = Steam::makeArray($set);
|
|
||||||
$amountSet = $query->journalsByBudget($start, $end, $showSharedReports);
|
|
||||||
$amounts = Steam::makeArray($amountSet);
|
|
||||||
$budgets = Steam::mergeArrays($budgets, $amounts);
|
|
||||||
$budgets[0]['spent'] = isset($budgets[0]['spent']) ? $budgets[0]['spent'] : 0.0;
|
|
||||||
$budgets[0]['amount'] = isset($budgets[0]['amount']) ? $budgets[0]['amount'] : 0.0;
|
|
||||||
$budgets[0]['name'] = 'No budget';
|
|
||||||
|
|
||||||
// find transactions to shared asset accounts, which are without a budget by default:
|
|
||||||
// which is only relevant when shared asset accounts are hidden.
|
|
||||||
if ($showSharedReports === false) {
|
|
||||||
$transfers = $query->sharedExpenses($start, $end);
|
|
||||||
foreach ($transfers as $transfer) {
|
|
||||||
$budgets[0]['spent'] += floatval($transfer->amount) * -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End getBudgetsForMonth DONE
|
* End getBudgetsForMonth DONE
|
||||||
@@ -128,11 +110,11 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function index(ReportHelperInterface $helper)
|
public function index()
|
||||||
{
|
{
|
||||||
$start = Session::get('first');
|
$start = Session::get('first');
|
||||||
$months = $helper->listOfMonths($start);
|
$months = $this->helper->listOfMonths($start);
|
||||||
$years = $helper->listOfYears($start);
|
$years = $this->helper->listOfYears($start);
|
||||||
$title = 'Reports';
|
$title = 'Reports';
|
||||||
$mainTitleIcon = 'fa-line-chart';
|
$mainTitleIcon = 'fa-line-chart';
|
||||||
|
|
||||||
@@ -146,7 +128,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function modalBalancedTransfers(Account $account, $year = '2014', $month = '1', ReportQueryInterface $query)
|
public function modalBalancedTransfers(Account $account, $year = '2014', $month = '1')
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -158,7 +140,7 @@ class ReportController extends Controller
|
|||||||
$end = clone $start;
|
$end = clone $start;
|
||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
|
|
||||||
$journals = $query->balancedTransactionsList($account, $start, $end);
|
$journals = $this->query->balancedTransactionsList($account, $start, $end);
|
||||||
|
|
||||||
return view('reports.modal-journal-list', compact('journals'));
|
return view('reports.modal-journal-list', compact('journals'));
|
||||||
|
|
||||||
@@ -173,7 +155,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function modalLeftUnbalanced(Account $account, $year = '2014', $month = '1', ReportQueryInterface $query)
|
public function modalLeftUnbalanced(Account $account, $year = '2014', $month = '1')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new Carbon($year . '-' . $month . '-01');
|
new Carbon($year . '-' . $month . '-01');
|
||||||
@@ -183,7 +165,7 @@ class ReportController extends Controller
|
|||||||
$start = new Carbon($year . '-' . $month . '-01');
|
$start = new Carbon($year . '-' . $month . '-01');
|
||||||
$end = clone $start;
|
$end = clone $start;
|
||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
$set = $query->getTransactionsWithoutBudget($account, $start, $end);
|
$set = $this->query->getTransactionsWithoutBudget($account, $start, $end);
|
||||||
|
|
||||||
$journals = $set->filter(
|
$journals = $set->filter(
|
||||||
function (TransactionJournal $journal) {
|
function (TransactionJournal $journal) {
|
||||||
@@ -204,7 +186,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function modalNoBudget(Account $account, $year = '2014', $month = '1', ReportQueryInterface $query)
|
public function modalNoBudget(Account $account, $year = '2014', $month = '1')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new Carbon($year . '-' . $month . '-01');
|
new Carbon($year . '-' . $month . '-01');
|
||||||
@@ -214,7 +196,7 @@ class ReportController extends Controller
|
|||||||
$start = new Carbon($year . '-' . $month . '-01');
|
$start = new Carbon($year . '-' . $month . '-01');
|
||||||
$end = clone $start;
|
$end = clone $start;
|
||||||
$end->endOfMonth();
|
$end->endOfMonth();
|
||||||
$journals = $query->getTransactionsWithoutBudget($account, $start, $end);
|
$journals = $this->query->getTransactionsWithoutBudget($account, $start, $end);
|
||||||
|
|
||||||
return view('reports.modal-journal-list', compact('journals'));
|
return view('reports.modal-journal-list', compact('journals'));
|
||||||
|
|
||||||
@@ -226,7 +208,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function month($year = '2014', $month = '1', ReportQueryInterface $query)
|
public function month($year = '2014', $month = '1')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new Carbon($year . '-' . $month . '-01');
|
new Carbon($year . '-' . $month . '-01');
|
||||||
@@ -237,7 +219,7 @@ class ReportController extends Controller
|
|||||||
$subTitle = 'Report for ' . $date->format('F Y');
|
$subTitle = 'Report for ' . $date->format('F Y');
|
||||||
$subTitleIcon = 'fa-calendar';
|
$subTitleIcon = 'fa-calendar';
|
||||||
$displaySum = true; // to show sums in report.
|
$displaySum = true; // to show sums in report.
|
||||||
|
/** @var Preference $pref */
|
||||||
$pref = Preferences::get('showSharedReports', false);
|
$pref = Preferences::get('showSharedReports', false);
|
||||||
$showSharedReports = $pref->data;
|
$showSharedReports = $pref->data;
|
||||||
|
|
||||||
@@ -256,14 +238,14 @@ class ReportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Start getIncomeForMonth DONE
|
* Start getIncomeForMonth DONE
|
||||||
*/
|
*/
|
||||||
$income = $query->incomeByPeriod($start, $end, $showSharedReports);
|
$income = $this->query->incomeByPeriod($start, $end, $showSharedReports);
|
||||||
/**
|
/**
|
||||||
* End getIncomeForMonth DONE
|
* End getIncomeForMonth DONE
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Start getExpenseGroupedForMonth DONE
|
* Start getExpenseGroupedForMonth DONE
|
||||||
*/
|
*/
|
||||||
$set = $query->journalsByExpenseAccount($start, $end, $showSharedReports);
|
$set = $this->query->journalsByExpenseAccount($start, $end, $showSharedReports);
|
||||||
$expenses = Steam::makeArray($set);
|
$expenses = Steam::makeArray($set);
|
||||||
$expenses = Steam::sortArray($expenses);
|
$expenses = Steam::sortArray($expenses);
|
||||||
$expenses = Steam::limitArray($expenses, 10);
|
$expenses = Steam::limitArray($expenses, 10);
|
||||||
@@ -273,28 +255,7 @@ class ReportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Start getBudgetsForMonth DONE
|
* Start getBudgetsForMonth DONE
|
||||||
*/
|
*/
|
||||||
$set = Auth::user()->budgets()
|
$budgets = $this->helper->getBudgetsForMonth($date, $showSharedReports);
|
||||||
->leftJoin(
|
|
||||||
'budget_limits', function (JoinClause $join) use ($date) {
|
|
||||||
$join->on('budget_limits.budget_id', '=', 'budgets.id')->where('budget_limits.startdate', '=', $date->format('Y-m-d'));
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->get(['budgets.*', 'budget_limits.amount as amount']);
|
|
||||||
$budgets = Steam::makeArray($set);
|
|
||||||
$amountSet = $query->journalsByBudget($start, $end, $showSharedReports);
|
|
||||||
$amounts = Steam::makeArray($amountSet);
|
|
||||||
$budgets = Steam::mergeArrays($budgets, $amounts);
|
|
||||||
$budgets[0]['spent'] = isset($budgets[0]['spent']) ? $budgets[0]['spent'] : 0.0;
|
|
||||||
$budgets[0]['amount'] = isset($budgets[0]['amount']) ? $budgets[0]['amount'] : 0.0;
|
|
||||||
$budgets[0]['name'] = 'No budget';
|
|
||||||
|
|
||||||
// find transactions to shared expense accounts, which are without a budget by default:
|
|
||||||
if ($showSharedReports === false) {
|
|
||||||
$transfers = $query->sharedExpenses($start, $end);
|
|
||||||
foreach ($transfers as $transfer) {
|
|
||||||
$budgets[0]['spent'] += floatval($transfer->amount) * -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End getBudgetsForMonth DONE
|
* End getBudgetsForMonth DONE
|
||||||
@@ -303,12 +264,12 @@ class ReportController extends Controller
|
|||||||
* Start getCategoriesForMonth DONE
|
* Start getCategoriesForMonth DONE
|
||||||
*/
|
*/
|
||||||
// all categories.
|
// all categories.
|
||||||
$result = $query->journalsByCategory($start, $end);
|
$result = $this->query->journalsByCategory($start, $end);
|
||||||
$categories = Steam::makeArray($result);
|
$categories = Steam::makeArray($result);
|
||||||
|
|
||||||
// all transfers
|
// all transfers
|
||||||
if ($showSharedReports === false) {
|
if ($showSharedReports === false) {
|
||||||
$result = $query->sharedExpensesByCategory($start, $end);
|
$result = $this->query->sharedExpensesByCategory($start, $end);
|
||||||
$transfers = Steam::makeArray($result);
|
$transfers = Steam::makeArray($result);
|
||||||
$merged = Steam::mergeArrays($categories, $transfers);
|
$merged = Steam::mergeArrays($categories, $transfers);
|
||||||
} else {
|
} else {
|
||||||
@@ -326,7 +287,7 @@ class ReportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Start getAccountsForMonth
|
* Start getAccountsForMonth
|
||||||
*/
|
*/
|
||||||
$list = $query->accountList($showSharedReports);
|
$list = $this->query->accountList($showSharedReports);
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($list as $account) {
|
foreach ($list as $account) {
|
||||||
@@ -360,7 +321,7 @@ class ReportController extends Controller
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function year($year, ReportHelperInterface $helper, ReportQueryInterface $query)
|
public function year($year)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new Carbon('01-01-' . $year);
|
new Carbon('01-01-' . $year);
|
||||||
@@ -377,9 +338,9 @@ class ReportController extends Controller
|
|||||||
$subTitle = $year;
|
$subTitle = $year;
|
||||||
$subTitleIcon = 'fa-bar-chart';
|
$subTitleIcon = 'fa-bar-chart';
|
||||||
$mainTitleIcon = 'fa-line-chart';
|
$mainTitleIcon = 'fa-line-chart';
|
||||||
$balances = $helper->yearBalanceReport($date, $showSharedReports);
|
$balances = $this->helper->yearBalanceReport($date, $showSharedReports);
|
||||||
$groupedIncomes = $query->journalsByRevenueAccount($date, $end, $showSharedReports);
|
$groupedIncomes = $this->query->journalsByRevenueAccount($date, $end, $showSharedReports);
|
||||||
$groupedExpenses = $query->journalsByExpenseAccount($date, $end, $showSharedReports);
|
$groupedExpenses = $this->query->journalsByExpenseAccount($date, $end, $showSharedReports);
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'reports.year', compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
|
'reports.year', compact('date', 'groupedIncomes', 'groupedExpenses', 'year', 'balances', 'title', 'subTitle', 'subTitleIcon', 'mainTitleIcon')
|
||||||
|
Reference in New Issue
Block a user