basis filter added to reports

This commit is contained in:
Sevan Nerse
2021-09-20 10:06:55 +03:00
parent 69aeb32fae
commit 8bdb6e2e98
8 changed files with 62 additions and 5 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Listeners\Report;
use App\Abstracts\Listeners\Report as Listener;
use App\Events\Report\FilterShowing;
class AddBasis extends Listener
{
protected $classes = [
'App\Reports\IncomeSummary',
'App\Reports\ExpenseSummary',
'App\Reports\IncomeExpenseSummary',
'App\Reports\ProfitLoss',
'App\Reports\TaxSummary',
];
/**
* Handle filter showing event.
*
* @param $event
* @return void
*/
public function handleFilterShowing(FilterShowing $event)
{
if ($this->skipThisClass($event)) {
return;
}
$event->class->filters['basis'] = $this->getBasis();
$event->class->filters['keys']['basis'] = 'basis';
$event->class->filters['defaults']['basis'] = $event->class->getSetting('basis', 'accrual');
}
}