Merge pull request #2257 from sevannerse/basis-default-filter-reports

Basis default filter reports
This commit is contained in:
Cüneyt Şentürk
2021-10-05 22:17:12 +03:00
committed by GitHub
9 changed files with 75 additions and 8 deletions

View File

@ -114,6 +114,14 @@ abstract class Report
return $model->pluck('name', 'id')->toArray();
}
public function getBasis()
{
return [
'cash' => trans('general.cash'),
'accrual' => trans('general.accrual'),
];
}
public function applyDateFilter($event)
{
$event->model->monthsOfYear($event->args['date_field']);
@ -127,6 +135,10 @@ abstract class Report
$search_year = 'year:' . $this->getSearchStringValue('year', '', $input);
$input = str_replace($search_year, '', $input);
// Remove basis as it's handled based on report itself
$search_basis = 'basis:' . $this->getSearchStringValue('basis', 'accrual', $input);
$input = str_replace($search_basis, '', $input);
$event->model->usingSearchString($input);
}