mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add this year / last year
This commit is contained in:
parent
420fd1ef66
commit
fa487e7f92
@ -734,6 +734,19 @@ class BaseExport
|
||||
if(now()->lt($fin_year_start))
|
||||
$fin_year_start->subYearNoOverflow();
|
||||
|
||||
$this->start_date = $fin_year_start->format('Y-m-d');
|
||||
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
||||
return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC');
|
||||
case 'last_year':
|
||||
|
||||
$first_month_of_year = $this->company->getSetting('first_month_of_year') ?? 1;
|
||||
$fin_year_start = now()->createFromDate(now()->year, $first_month_of_year, 1);
|
||||
|
||||
$fin_year_start->subYearNoOverflow();
|
||||
|
||||
if(now()->subYear()->lt($fin_year_start))
|
||||
$fin_year_start->subYearNoOverflow();
|
||||
|
||||
$this->start_date = $fin_year_start->format('Y-m-d');
|
||||
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
||||
return $query->whereBetween($this->date_key, [now()->startOfYear(), now()])->orderBy($this->date_key, 'ASC');
|
||||
|
Loading…
x
Reference in New Issue
Block a user