diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.php new file mode 100644 index 0000000000..9e0e54a504 --- /dev/null +++ b/app/Generator/Report/Account/MonthReportGenerator.php @@ -0,0 +1,137 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Generator\Report\Account; + +use Carbon\Carbon; +use FireflyIII\Generator\Report\ReportGeneratorInterface; +use Illuminate\Support\Collection; + +/** + * Class MonthReportGenerator. + */ +class MonthReportGenerator implements ReportGeneratorInterface +{ + + /** @var Collection */ + private $accounts; + /** @var Carbon */ + private $end; + /** @var Collection */ + private $expense; + /** @var Carbon */ + private $start; + + /** + * @return string + * @throws \Throwable + */ + public function generate(): string + { + $accountIds = join(',', $this->accounts->pluck('id')->toArray()); + $expenseIds = join(',', $this->expense->pluck('id')->toArray()); + $reportType = 'account'; + + return view( + 'reports.account.report', + compact('accountIds', 'reportType','expenseIds') + )->with('start', $this->start)->with('end', $this->end)->render(); + } + + /** + * @param Collection $accounts + * + * @return ReportGeneratorInterface + */ + public function setAccounts(Collection $accounts): ReportGeneratorInterface + { + $this->accounts = $accounts; + + return $this; + } + + /** + * @param Collection $budgets + * + * @return ReportGeneratorInterface + */ + public function setBudgets(Collection $budgets): ReportGeneratorInterface + { + return $this; + } + + /** + * @param Collection $categories + * + * @return ReportGeneratorInterface + */ + public function setCategories(Collection $categories): ReportGeneratorInterface + { + return $this; + } + + /** + * @param Carbon $date + * + * @return ReportGeneratorInterface + */ + public function setEndDate(Carbon $date): ReportGeneratorInterface + { + $this->end = $date; + + return $this; + } + + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + $this->expense = $expense; + + return $this; + } + + /** + * @param Carbon $date + * + * @return ReportGeneratorInterface + */ + public function setStartDate(Carbon $date): ReportGeneratorInterface + { + $this->start = $date; + + return $this; + } + + /** + * @param Collection $tags + * + * @return ReportGeneratorInterface + */ + public function setTags(Collection $tags): ReportGeneratorInterface + { + return $this; + } +} diff --git a/app/Generator/Report/Account/MultiYearReportGenerator.php b/app/Generator/Report/Account/MultiYearReportGenerator.php new file mode 100644 index 0000000000..cd88b4ea75 --- /dev/null +++ b/app/Generator/Report/Account/MultiYearReportGenerator.php @@ -0,0 +1,31 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Generator\Report\Account; + +/** + * Class MultiYearReportGenerator. + */ +class MultiYearReportGenerator extends MonthReportGenerator +{ + // Doesn't do anything different. +} diff --git a/app/Generator/Report/Account/YearReportGenerator.php b/app/Generator/Report/Account/YearReportGenerator.php new file mode 100644 index 0000000000..3debf38d0c --- /dev/null +++ b/app/Generator/Report/Account/YearReportGenerator.php @@ -0,0 +1,31 @@ +. + */ +declare(strict_types=1); + +namespace FireflyIII\Generator\Report\Account; + +/** + * Class YearReportGenerator. + */ +class YearReportGenerator extends MonthReportGenerator +{ + // Doesn't do anything different. +} diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index f944874ea4..8d44f252b7 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -119,6 +119,16 @@ class MonthReportGenerator implements ReportGeneratorInterface return $this; } + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + return $this; + } + /** * @param Carbon $date * diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php index 1295061e6b..0c9bfa7c51 100644 --- a/app/Generator/Report/Budget/MonthReportGenerator.php +++ b/app/Generator/Report/Budget/MonthReportGenerator.php @@ -128,6 +128,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface return $this; } + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + return $this; + } + /** * @param Carbon $date * diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index 24370c6be0..ee9f045f51 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -146,6 +146,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface return $this; } + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + return $this; + } + /** * @param Carbon $date * diff --git a/app/Generator/Report/ReportGeneratorInterface.php b/app/Generator/Report/ReportGeneratorInterface.php index c3752b2739..15ed0d9d81 100644 --- a/app/Generator/Report/ReportGeneratorInterface.php +++ b/app/Generator/Report/ReportGeneratorInterface.php @@ -63,6 +63,13 @@ interface ReportGeneratorInterface */ public function setEndDate(Carbon $date): ReportGeneratorInterface; + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface; + /** * @param Carbon $date * diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php index 74c005b0ab..6e41f462e8 100644 --- a/app/Generator/Report/Standard/MonthReportGenerator.php +++ b/app/Generator/Report/Standard/MonthReportGenerator.php @@ -101,6 +101,16 @@ class MonthReportGenerator implements ReportGeneratorInterface return $this; } + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + return $this; + } + /** * @param Carbon $date * diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php index 418b05dd16..4873e1b5fe 100644 --- a/app/Generator/Report/Tag/MonthReportGenerator.php +++ b/app/Generator/Report/Tag/MonthReportGenerator.php @@ -141,6 +141,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface return $this; } + /** + * @param Collection $expense + * + * @return ReportGeneratorInterface + */ + public function setExpense(Collection $expense): ReportGeneratorInterface + { + return $this; + } + /** * @param Carbon $date * diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 9a6d131f8b..c1d7be7e41 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -74,6 +74,39 @@ class ReportController extends Controller * @param Carbon $end * * @return string + * @throws \FireflyIII\Exceptions\FireflyException + */ + public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) + { + if ($end < $start) { + return view('error')->with('message', trans('firefly.end_after_start_date')); + } + + if ($start < session('first')) { + $start = session('first'); + } + + View::share( + 'subTitle', trans( + 'firefly.report_default', ['start' => $start->formatLocalized($this->monthFormat), 'end' => $end->formatLocalized($this->monthFormat),] + ) + ); + + $generator = ReportGeneratorFactory::reportGenerator('Account', $start, $end); + $generator->setAccounts($accounts); + $generator->setExpense($expense); + $result = $generator->generate(); + + return $result; + } + + /** + * @param Collection $accounts + * @param Carbon $start + * @param Carbon $end + * + * @return string + * @throws \FireflyIII\Exceptions\FireflyException */ public function auditReport(Collection $accounts, Carbon $start, Carbon $end) { @@ -109,6 +142,7 @@ class ReportController extends Controller * @param Carbon $end * * @return string + * @throws \FireflyIII\Exceptions\FireflyException */ public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end) { @@ -145,6 +179,7 @@ class ReportController extends Controller * @param Carbon $end * * @return string + * @throws \FireflyIII\Exceptions\FireflyException */ public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end) { @@ -180,6 +215,7 @@ class ReportController extends Controller * @param Carbon $end * * @return string + * @throws \FireflyIII\Exceptions\FireflyException */ public function defaultReport(Collection $accounts, Carbon $start, Carbon $end) { @@ -230,6 +266,7 @@ class ReportController extends Controller * @param string $reportType * * @return mixed + * @throws \Throwable */ public function options(string $reportType) { @@ -246,6 +283,9 @@ class ReportController extends Controller case 'tag': $result = $this->tagReportOptions(); break; + case 'account': + $result = $this->accountReportOptions(); + break; } return Response::json(['html' => $result]); @@ -255,6 +295,7 @@ class ReportController extends Controller * @param ReportFormRequest $request * * @return RedirectResponse|\Illuminate\Routing\Redirector + * @throws \FireflyIII\Exceptions\FireflyException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function postIndex(ReportFormRequest $request) @@ -267,6 +308,7 @@ class ReportController extends Controller $categories = join(',', $request->getCategoryList()->pluck('id')->toArray()); $budgets = join(',', $request->getBudgetList()->pluck('id')->toArray()); $tags = join(',', $request->getTagList()->pluck('tag')->toArray()); + $expense = join(',', $request->getExpenseList()->pluck('id')->toArray()); $uri = route('reports.index'); if (0 === $request->getAccountList()->count()) { @@ -314,6 +356,9 @@ class ReportController extends Controller case 'tag': $uri = route('reports.report.tag', [$accounts, $tags, $start, $end]); break; + case 'account': + $uri = route('reports.report.account', [$accounts, $expense, $start, $end]); + break; } return redirect($uri); @@ -326,6 +371,7 @@ class ReportController extends Controller * @param Carbon $end * * @return string + * @throws \FireflyIII\Exceptions\FireflyException */ public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) { @@ -357,6 +403,30 @@ class ReportController extends Controller /** * @return string + * @throws \Throwable + */ + private function accountReportOptions(): string + { + /** @var AccountRepositoryInterface $repository */ + $repository = app(AccountRepositoryInterface::class); + $expense = $repository->getActiveAccountsByType([AccountType::EXPENSE]); + $revenue = $repository->getActiveAccountsByType([AccountType::REVENUE]); + $set = new Collection; + $names = $revenue->pluck('name')->toArray(); + foreach ($expense as $exp) { + if (in_array($exp->name, $names)) { + $set->push($exp); + } + } + + $result = view('reports.options.account', compact('set'))->render(); + + return $result; + } + + /** + * @return string + * @throws \Throwable */ private function budgetReportOptions(): string { @@ -370,6 +440,7 @@ class ReportController extends Controller /** * @return string + * @throws \Throwable */ private function categoryReportOptions(): string { @@ -383,6 +454,7 @@ class ReportController extends Controller /** * @return string + * @throws \Throwable */ private function noReportOptions(): string { @@ -391,6 +463,7 @@ class ReportController extends Controller /** * @return string + * @throws \Throwable */ private function tagReportOptions(): string { diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index 40eee6037b..187cf09f6d 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -45,6 +45,28 @@ class ReportFormRequest extends Request return auth()->check(); } + /** + * @return Collection + */ + public function getExpenseList(): Collection + { + // fixed + /** @var AccountRepositoryInterface $repository */ + $repository = app(AccountRepositoryInterface::class); + $set = $this->get('exp_rev'); + $collection = new Collection; + if (is_array($set)) { + foreach ($set as $accountId) { + $account = $repository->find(intval($accountId)); + if (null !== $account->id) { + $collection->push($account); + } + } + } + + return $collection; + } + /** * @return Collection */ @@ -178,7 +200,7 @@ class ReportFormRequest extends Request public function rules(): array { return [ - 'report_type' => 'in:audit,default,category,budget,tag', + 'report_type' => 'in:audit,default,category,budget,tag,account', ]; } } diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 424c2857cf..af7c54da60 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -676,6 +676,20 @@ Breadcrumbs::register( } ); +Breadcrumbs::register( + 'reports.report.account', + function (BreadCrumbGenerator $breadcrumbs, string $accountIds, string $expenseIds, Carbon $start, Carbon $end) { + $breadcrumbs->parent('reports.index'); + + $monthFormat = (string)trans('config.month_and_day'); + $startString = $start->formatLocalized($monthFormat); + $endString = $end->formatLocalized($monthFormat); + $title = (string)trans('firefly.report_account', ['start' => $startString, 'end' => $endString]); + + $breadcrumbs->push($title, route('reports.report.account', [$accountIds, $expenseIds, $start->format('Ymd'), $end->format('Ymd')])); + } +); + Breadcrumbs::register( 'reports.report.default', function (BreadCrumbGenerator $breadcrumbs, string $accountIds, Carbon $start, Carbon $end) { diff --git a/config/firefly.php b/config/firefly.php index 744d82cfc3..025619c595 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -180,6 +180,7 @@ return [ 'jobKey' => 'FireflyIII\Models\ExportJob', 'importJob' => 'FireflyIII\Models\ImportJob', 'accountList' => 'FireflyIII\Support\Binder\AccountList', + 'expenseList' => 'FireflyIII\Support\Binder\AccountList', 'budgetList' => 'FireflyIII\Support\Binder\BudgetList', 'journalList' => 'FireflyIII\Support\Binder\JournalList', 'categoryList' => 'FireflyIII\Support\Binder\CategoryList', diff --git a/public/js/ff/reports/index.js b/public/js/ff/reports/index.js index b95531e0df..d15de74232 100644 --- a/public/js/ff/reports/index.js +++ b/public/js/ff/reports/index.js @@ -124,10 +124,22 @@ function setOptionalFromCookies() { if ((readCookie('report-tags') !== null)) { arr = readCookie('report-tags').split(','); arr.forEach(function (val) { - $('#inputBudgets').find('option[value="' + val + '"]').prop('selected', true); + $('#inputTags').find('option[value="' + val + '"]').prop('selected', true); }); } $('#inputTags').multiselect(defaultMultiSelect); + + // and expense/revenue thing + if ((readCookie('report-exp-rev') !== null)) { + arr = readCookie('report-exp-rev').split(','); + arr.forEach(function (val) { + $('#inputExpRevAccounts').find('option[value="' + val + '"]').prop('selected', true); + }); + } + $('#inputExpRevAccounts').multiselect(defaultMultiSelect); + + + } function catchSubmit() { @@ -140,6 +152,7 @@ function catchSubmit() { var categories = $('#inputCategories').val(); var budgets = $('#inputBudgets').val(); var tags = $('#inputTags').val(); + var expRev = $('#inputExpRevAccounts').val(); // remember all // set cookie to remember choices. @@ -148,6 +161,7 @@ function catchSubmit() { createCookie('report-categories', categories, 365); createCookie('report-budgets', budgets, 365); createCookie('report-tags', tags, 365); + createCookie('report-exp-rev', expRev , 365); createCookie('report-start', moment(picker.startDate).format("YYYYMMDD"), 365); createCookie('report-end', moment(picker.endDate).format("YYYYMMDD"), 365); diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 6ac6cdf35c..78058c3f35 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -786,6 +786,7 @@ return [ 'report_default' => 'Default financial report between :start and :end', 'report_audit' => 'Transaction history overview between :start and :end', 'report_category' => 'Category report between :start and :end', + 'report_account' => 'Expense/revenue account report between :start and :end', 'report_budget' => 'Budget report between :start and :end', 'report_tag' => 'Tag report between :start and :end', 'quick_link_reports' => 'Quick links', @@ -821,6 +822,7 @@ return [ 'report_type_category' => 'Category report', 'report_type_budget' => 'Budget report', 'report_type_tag' => 'Tag report', + 'report_type_account' => 'Combined account report', 'more_info_help' => 'More information about these types of reports can be found in the help pages. Press the (?) icon in the top right corner.', 'report_included_accounts' => 'Included accounts', 'report_date_range' => 'Date range', @@ -873,49 +875,52 @@ return [ 'budget_chart_click' => 'Please click on a budget name in the table above to see a chart.', 'category_chart_click' => 'Please click on a category name in the table above to see a chart.', + 'in_out_accounts' => 'Earned and spent per combined account', + 'in_out_accounts_period' => 'Earned and spent, grouped by :period', + 'in_out_per_category' => 'Earned and spent per category', + 'out_per_budget' => 'Spent per budget', // charts: - 'chart' => 'Chart', - 'month' => 'Month', - 'budget' => 'Budget', - 'spent' => 'Spent', - 'spent_in_budget' => 'Spent in budget', - 'left_to_spend' => 'Left to spend', - 'earned' => 'Earned', - 'overspent' => 'Overspent', - 'left' => 'Left', - 'no_budget' => '(no budget)', - 'max-amount' => 'Maximum amount', - 'min-amount' => 'Minumum amount', - 'journal-amount' => 'Current bill entry', - 'name' => 'Name', - 'date' => 'Date', - 'paid' => 'Paid', - 'unpaid' => 'Unpaid', - 'day' => 'Day', - 'budgeted' => 'Budgeted', - 'period' => 'Period', - 'balance' => 'Balance', - 'sum' => 'Sum', - 'average' => 'Average', - 'balanceFor' => 'Balance for :name', + 'chart' => 'Chart', + 'month' => 'Month', + 'budget' => 'Budget', + 'spent' => 'Spent', + 'spent_in_budget' => 'Spent in budget', + 'left_to_spend' => 'Left to spend', + 'earned' => 'Earned', + 'overspent' => 'Overspent', + 'left' => 'Left', + 'max-amount' => 'Maximum amount', + 'min-amount' => 'Minumum amount', + 'journal-amount' => 'Current bill entry', + 'name' => 'Name', + 'date' => 'Date', + 'paid' => 'Paid', + 'unpaid' => 'Unpaid', + 'day' => 'Day', + 'budgeted' => 'Budgeted', + 'period' => 'Period', + 'balance' => 'Balance', + 'sum' => 'Sum', + 'average' => 'Average', + 'balanceFor' => 'Balance for :name', // piggy banks: - 'add_money_to_piggy' => 'Add money to piggy bank ":name"', - 'piggy_bank' => 'Piggy bank', - 'new_piggy_bank' => 'New piggy bank', - 'store_piggy_bank' => 'Store new piggy bank', - 'stored_piggy_bank' => 'Store new piggy bank ":name"', - 'account_status' => 'Account status', - 'left_for_piggy_banks' => 'Left for piggy banks', - 'sum_of_piggy_banks' => 'Sum of piggy banks', - 'saved_so_far' => 'Saved so far', - 'left_to_save' => 'Left to save', - 'suggested_amount' => 'Suggested monthly amount to save', - 'add_money_to_piggy_title' => 'Add money to piggy bank ":name"', - 'remove_money_from_piggy_title' => 'Remove money from piggy bank ":name"', - 'add' => 'Add', - 'no_money_for_piggy' => 'You have no money to put in this piggy bank.', + 'add_money_to_piggy' => 'Add money to piggy bank ":name"', + 'piggy_bank' => 'Piggy bank', + 'new_piggy_bank' => 'New piggy bank', + 'store_piggy_bank' => 'Store new piggy bank', + 'stored_piggy_bank' => 'Store new piggy bank ":name"', + 'account_status' => 'Account status', + 'left_for_piggy_banks' => 'Left for piggy banks', + 'sum_of_piggy_banks' => 'Sum of piggy banks', + 'saved_so_far' => 'Saved so far', + 'left_to_save' => 'Left to save', + 'suggested_amount' => 'Suggested monthly amount to save', + 'add_money_to_piggy_title' => 'Add money to piggy bank ":name"', + 'remove_money_from_piggy_title' => 'Remove money from piggy bank ":name"', + 'add' => 'Add', + 'no_money_for_piggy' => 'You have no money to put in this piggy bank.', 'remove' => 'Remove', 'max_amount_add' => 'The maximum amount you can add is', diff --git a/resources/views/reports/account/report.twig b/resources/views/reports/account/report.twig new file mode 100644 index 0000000000..8aaea0a1bc --- /dev/null +++ b/resources/views/reports/account/report.twig @@ -0,0 +1,438 @@ +{% extends "./layout/default" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, accountIds, expenseIds, start, end) }} +{% endblock %} + +{% block content %} + + {# in/out + In/out per per periode #} +
+
+
+
+

{{ 'in_out_accounts'|_ }}

+
+
+ {# loading indicator #} +
+ +
+
+
+
+ +
+
+
+

{{ 'in_out_accounts_period'|_ }}

+
+
+ {# loading indicator #} +
+ +
+
+
+
+
+ + {# chart #} +
+
+
+
+

{{ 'income_and_expenses'|_ }}

+
+
+ +
+
+
+
+ + {# in/out category + out per budget #} +
+
+
+
+

{{ 'in_out_per_category'|_ }}

+
+
+ {# loading indicator #} +
+ +
+
+
+
+ +
+
+
+

{{ 'out_per_budget'|_ }}

+
+
+ {# loading indicator #} +
+ +
+
+
+
+
+ + {# expenses top 10 + income top 10 #} +
+
+
+
+

{{ 'expenses'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})

+
+
+ {# loading indicator #} +
+ +
+
+
+
+ +
+
+
+

{{ 'income'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})

+
+
+ {# loading indicator #} +
+ +
+
+
+
+
+ {# +
+ {% if categories.count > 1 %} +
+
+
+

{{ 'income_per_category'|_ }}

+
+
+ + +
+
+
+
+
+
+

{{ 'expense_per_category'|_ }}

+
+
+ + +
+
+
+ {% endif %} +
+
+
+

{{ 'income_per_account'|_ }}

+
+
+ + +
+
+
+
+
+
+

{{ 'expense_per_account'|_ }}

+
+
+ + +
+
+
+
+ +
+
+
+
+

{{ 'income_and_expenses'|_ }}

+
+
+ +
+
+
+
+
+ {% if averageExpenses|length > 0 %} +
+
+
+

{{ 'average_spending_per_account'|_ }}

+
+
+ + + + + + + + + + + {% for row in averageExpenses %} + {% if loop.index > listLength %} + + {% else %} + + {% endif %} + + + + + + {% endfor %} + + + {% if averageExpenses|length > listLength %} + + + + {% endif %} + +
{{ 'account'|_ }}{{ 'spent_average'|_ }}{{ 'total'|_ }}{{ 'transaction_count'|_ }}
+ {{ row.name }} + + {{ row.average|formatAmount }} + + {{ row.sum|formatAmount }} + + {{ row.count }} +
+ {{ trans('firefly.show_full_list',{number:incomeTopLength}) }} +
+
+
+
+ {% endif %} + {% if topExpenses.count > 0 %} +
+ +
+
+

{{ 'expenses'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})

+
+
+ + + + + + + + + + + {% for row in topExpenses %} + {% if loop.index > listLength %} + + {% else %} + + {% endif %} + + + + + + {% endfor %} + + + {% if topExpenses|length > listLength %} + + + + {% endif %} + +
{{ 'description'|_ }}{{ 'date'|_ }}{{ 'account'|_ }}{{ 'amount'|_ }}
+ + {% if row.transaction_description|length > 0 %} + {{ row.transaction_description }} ({{ row.description }}) + {% else %} + {{ row.description }} + {% endif %} + + + {{ row.date.formatLocalized(monthAndDayFormat) }} + + + {{ row.opposing_account_name }} + + + {{ row.transaction_amount|formatAmount }} +
+ {{ trans('firefly.show_full_list',{number:incomeTopLength}) }} +
+
+
+
+ {% endif %} +
+
+ {% if averageIncome|length > 0 %} +
+
+
+

{{ 'average_income_per_account'|_ }}

+
+
+ + + + + + + + + + + {% for row in averageIncome %} + + + + + + + {% endfor %} + +
{{ 'account'|_ }}{{ 'income_average'|_ }}{{ 'total'|_ }}{{ 'transaction_count'|_ }}
+ {{ row.name }} + + {{ row.average|formatAmount }} + + {{ row.sum|formatAmount }} + + {{ row.count }} +
+
+
+
+ {% endif %} +
+ {% if topIncome.count > 0 %} +
+
+

{{ 'income'|_ }} ({{ trans('firefly.topX', {number: listLength}) }})

+
+
+ + + + + + + + + + + {% for row in topIncome %} + {% if loop.index > listLength %} + + {% else %} + + {% endif %} + + + + + + {% endfor %} + + + {% if topIncome.count > listLength %} + + + + {% endif %} + +
{{ 'description'|_ }}{{ 'date'|_ }}{{ 'account'|_ }}{{ 'amount'|_ }}
+ + {% if row.transaction_description|length > 0 %} + {{ row.transaction_description }} ({{ row.description }}) + {% else %} + {{ row.description }} + {% endif %} + + + {{ row.date.formatLocalized(monthAndDayFormat) }} + + + {{ row.opposing_account_name }} + + + {{ row.transaction_amount|formatAmount }} +
+ {{ trans('firefly.show_full_list',{number:incomeTopLength}) }} +
+
+
+ {% endif %} +
+
+ #} + +{% endblock %} + +{% block scripts %} + + + + + + + + + + + +{% endblock %} + +{% block styles %} + +{% endblock %} diff --git a/resources/views/reports/index.twig b/resources/views/reports/index.twig index d6247a2324..fd1bcd0b0c 100644 --- a/resources/views/reports/index.twig +++ b/resources/views/reports/index.twig @@ -29,6 +29,7 @@ + diff --git a/resources/views/reports/options/account.twig b/resources/views/reports/options/account.twig new file mode 100644 index 0000000000..34792dc3cf --- /dev/null +++ b/resources/views/reports/options/account.twig @@ -0,0 +1,10 @@ +
+ +
+ +
+
diff --git a/routes/web.php b/routes/web.php index 86b29cb942..099baa9b65 100755 --- a/routes/web.php +++ b/routes/web.php @@ -567,6 +567,7 @@ Route::group( Route::get('category/{accountList}/{categoryList}/{start_date}/{end_date}', ['uses' => 'ReportController@categoryReport', 'as' => 'report.category']); Route::get('budget/{accountList}/{budgetList}/{start_date}/{end_date}', ['uses' => 'ReportController@budgetReport', 'as' => 'report.budget']); Route::get('tag/{accountList}/{tagList}/{start_date}/{end_date}', ['uses' => 'ReportController@tagReport', 'as' => 'report.tag']); + Route::get('account/{accountList}/{expenseList}/{start_date}/{end_date}', ['uses' => 'ReportController@accountReport', 'as' => 'report.account']); Route::post('', ['uses' => 'ReportController@postIndex', 'as' => 'index.post']); }