From cf307a00e1d8624386a01fc81879a5e1cd6fcad2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 Feb 2019 06:10:52 +0100 Subject: [PATCH] Code for #2037 --- app/Support/Binder/Date.php | 20 ++++++++++++++------ resources/lang/en_US/firefly.php | 2 ++ resources/views/v1/reports/index.twig | 7 ++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index 5105c208ce..07462f9998 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -47,12 +47,20 @@ class Date implements BinderInterface $fiscalHelper = app(FiscalHelperInterface::class); $magicWords = [ - 'currentMonthStart' => Carbon::now()->startOfMonth(), - 'currentMonthEnd' => Carbon::now()->endOfMonth(), - 'currentYearStart' => Carbon::now()->startOfYear(), - 'currentYearEnd' => Carbon::now()->endOfYear(), - 'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(Carbon::now()), - 'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(Carbon::now()), + 'currentMonthStart' => Carbon::now()->startOfMonth(), + 'currentMonthEnd' => Carbon::now()->endOfMonth(), + 'currentYearStart' => Carbon::now()->startOfYear(), + 'currentYearEnd' => Carbon::now()->endOfYear(), + + 'previousMonthStart' => Carbon::now()->startOfMonth()->subDay()->startOfMonth(), + 'previousMonthEnd' => Carbon::now()->startOfMonth()->subDay()->endOfMonth(), + 'previousYearStart' => Carbon::now()->startOfYear()->subDay()->startOfYear(), + 'previousYearEnd' => Carbon::now()->startOfYear()->subDay()->endOfYear(), + + 'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(Carbon::now()), + 'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(Carbon::now()), + 'previousFiscalYearStart' => $fiscalHelper->startOfFiscalYear(Carbon::now())->subYear(), + 'previousFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(Carbon::now())->subYear(), ]; if (isset($magicWords[$value])) { return $magicWords[$value]; diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 3152883c63..fb4b9b2cbf 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -953,9 +953,11 @@ return [ 'report_budget' => 'Budget report between :start and :end', 'report_tag' => 'Tag report between :start and :end', 'quick_link_reports' => 'Quick links', + 'quick_link_examples' => 'These are just some example links to get you started. Check out the help pages under the (?)-button for information on all reports and the magic words you can use.', 'quick_link_default_report' => 'Default financial report', 'quick_link_audit_report' => 'Transaction history overview', 'report_this_month_quick' => 'Current month, all accounts', + 'report_last_month_quick' => 'Last month, all accounts', 'report_this_year_quick' => 'Current year, all accounts', 'report_this_fiscal_year_quick' => 'Current fiscal year, all accounts', 'report_all_time_quick' => 'All-time, all accounts', diff --git a/resources/views/v1/reports/index.twig b/resources/views/v1/reports/index.twig index b89aea175f..34dd4ca639 100644 --- a/resources/views/v1/reports/index.twig +++ b/resources/views/v1/reports/index.twig @@ -118,7 +118,9 @@

{{ 'quick_link_reports'|_ }}

- +

+ {{ 'quick_link_examples'|_ }} +

{{ ('quick_link_default_report')|_ }}