Merge pull request #2029 from sevannerse/master
previous quarter shortcut on the dashboard date filter fixed
This commit is contained in:
commit
4644e92c3f
@ -144,16 +144,24 @@ trait DateTime
|
|||||||
|
|
||||||
foreach ($financial_quarters as $quarter) {
|
foreach ($financial_quarters as $quarter) {
|
||||||
if ($today->lessThan($quarter->getStartDate()) || $today->greaterThan($quarter->getEndDate())) {
|
if ($today->lessThan($quarter->getStartDate()) || $today->greaterThan($quarter->getEndDate())) {
|
||||||
|
$previous_quarter = $quarter;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this_quarter = $quarter;
|
$this_quarter = $quarter;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this_quarter)) {
|
if (!isset($this_quarter)) {
|
||||||
$this_quarter = $financial_quarters[0];
|
$this_quarter = $financial_quarters[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($previous_quarter)) {
|
||||||
|
$previous_quarter = $financial_quarters[0];
|
||||||
|
}
|
||||||
|
|
||||||
$date_picker_shortcuts = [
|
$date_picker_shortcuts = [
|
||||||
trans('reports.this_year') => [
|
trans('reports.this_year') => [
|
||||||
'start' => $financial_year->getStartDate()->format('Y-m-d'),
|
'start' => $financial_year->getStartDate()->format('Y-m-d'),
|
||||||
@ -168,8 +176,8 @@ trait DateTime
|
|||||||
'end' => $this_quarter->getEndDate()->format('Y-m-d'),
|
'end' => $this_quarter->getEndDate()->format('Y-m-d'),
|
||||||
],
|
],
|
||||||
trans('reports.previous_quarter') => [
|
trans('reports.previous_quarter') => [
|
||||||
'start' => $this_quarter->getStartDate()->copy()->subQuarter()->format('Y-m-d'),
|
'start' => $previous_quarter->getStartDate()->format('Y-m-d'),
|
||||||
'end' => $this_quarter->getEndDate()->copy()->subQuarter()->format('Y-m-d'),
|
'end' => $previous_quarter->getEndDate()->format('Y-m-d'),
|
||||||
],
|
],
|
||||||
trans('reports.last_12_months') => [
|
trans('reports.last_12_months') => [
|
||||||
'start' => $today->copy()->subYear()->startOfDay()->format('Y-m-d'),
|
'start' => $today->copy()->subYear()->startOfDay()->format('Y-m-d'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user