Quicklink fiscal year report feature. As per github issue #131.

The reason for instantiating the helper at the beginning of the static function routeBinder
is I am hoping that the object will only be created once.
This commit is contained in:
Graham Miller 2016-01-29 09:11:36 +10:00
parent 3d69dc786d
commit 41188a1bd6
3 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,7 @@ namespace FireflyIII\Support\Binder;
use Auth;
use Carbon\Carbon;
use FireflyIII\Helpers\FiscalHelper;
use Exception;
use Log;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@ -32,6 +33,8 @@ class Date implements BinderInterface
*/
public static function routeBinder($value, $route)
{
$fiscalHelper = new FiscalHelper;
switch ($value) {
default:
try {
@ -50,6 +53,10 @@ class Date implements BinderInterface
return Carbon::now()->startOfYear();
case 'currentYearEnd':
return Carbon::now()->endOfYear();
case 'currentFiscalYearStart':
return $fiscalHelper->startOfFiscalYear(Carbon::now());
case 'currentFiscalYearEnd':
return $fiscalHelper->endOfFiscalYear(Carbon::now());
}
}

View File

@ -488,6 +488,7 @@ return [
'quick_link_default_report' => 'Default financial report',
'report_this_month_quick' => 'Current 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',
'reports_can_bookmark' => 'Remember that reports can be bookmarked.',
'incomeVsExpenses' => 'Income vs. expenses',

View File

@ -108,6 +108,14 @@
accountList
]) }}">{{ 'report_this_year_quick'|_ }}</a>
</li>
<li>
<a href="{{ route('reports.report',
['default',
'currentFiscalYearStart',
'currentFiscalYearEnd',
accountList
]) }}">{{ 'report_this_fiscal_year_quick'|_ }}</a>
</li>
<li>
<a href="{{ route('reports.report',
['default',