M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-22 12:06:13 +01:00
parent 17cfcf44b2
commit e5d6ff68b2
2 changed files with 195 additions and 271 deletions
@@ -134,20 +134,21 @@ class ExecSummaryController extends Controller
return null;
}
$range = null;
if ($period === 'custom') {
return [(clone $from)->modify('first day of this month')->format('Ymd'), (clone $from)->modify('last day of this month')->format('Ymd')];
$range = [(clone $from)->modify('first day of this month')->format('Ymd'), (clone $from)->modify('last day of this month')->format('Ymd')];
} else {
$to = self::monthDate($request->input('TOREPORTDATE'));
if ($to !== null) {
$range = match ($period) {
'year', 'quarter' => [(clone $from)->modify('first day of January')->format('Ymd'), (clone $to)->modify('last day of December')->format('Ymd')],
'monthly' => [(clone $from)->modify('first day of this month')->format('Ymd'), (clone $to)->modify('last day of this month')->format('Ymd')],
default => null,
};
}
}
$to = self::monthDate($request->input('TOREPORTDATE'));
if ($to === null) {
return null;
}
return match ($period) {
'year', 'quarter' => [(clone $from)->modify('first day of January')->format('Ymd'), (clone $to)->modify('last day of December')->format('Ymd')],
'monthly' => [(clone $from)->modify('first day of this month')->format('Ymd'), (clone $to)->modify('last day of this month')->format('Ymd')],
default => null,
};
return $range;
}
private static function monthDate(mixed $value): ?\DateTime