feat : ajout d'un écran pour le récap congés et RTT
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

This commit is contained in:
2026-04-14 15:08:45 +02:00
parent 11331da6a1
commit 0897154460
23 changed files with 743 additions and 161 deletions

View File

@@ -140,7 +140,7 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
* previousYearRemainingDays: float
* }
*/
public function computeYearSummary(Employee $employee, int $targetYear, float $paidLeaveDays = 0.0): ?array
public function computeYearSummary(Employee $employee, int $targetYear, float $paidLeaveDays = 0.0, ?DateTimeImmutable $asOfDate = null): ?array
{
$firstYear = max($this->resolveFirstComputationYear($employee), $targetYear - 1);
if ($targetYear < $firstYear) {
@@ -196,8 +196,9 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
$carrySaturdays = 0.0;
}
$accrualCalculationEnd = $this->resolveAccrualCalculationEndDate($leavePolicy['ruleCode'], $year, $to, $employee);
$takenCalculationEnd = $this->resolveTakenCalculationEndDate($to, $employee);
$effectiveAsOfDate = ($year === $targetYear) ? $asOfDate : null;
$accrualCalculationEnd = $this->resolveAccrualCalculationEndDate($leavePolicy['ruleCode'], $year, $to, $employee, $effectiveAsOfDate);
$takenCalculationEnd = $this->resolveTakenCalculationEndDate($to, $employee, $effectiveAsOfDate);
$suspensions = $this->suspensionDaysCalculator->applyFirstMonthGrace(
$this->resolveSuspensionsForPeriod($employee, $effectiveFrom, $to)
);
@@ -489,19 +490,20 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
string $ruleCode,
int $year,
DateTimeImmutable $periodEnd,
Employee $employee
Employee $employee,
?DateTimeImmutable $asOfDate = null
): ?DateTimeImmutable {
$today = new DateTimeImmutable('today');
$reference = $asOfDate ?? new DateTimeImmutable('today');
$currentYear = LeaveRuleCode::FORFAIT_218->value === $ruleCode
? (int) $today->format('Y')
: $this->resolveCurrentLeaveYear($today);
? (int) $reference->format('Y')
: $this->resolveCurrentLeaveYear($reference);
if ($year < $currentYear) {
$end = $periodEnd;
} elseif ($year > $currentYear) {
$end = null;
} else {
$lastDayPreviousMonth = $today
$lastDayPreviousMonth = $reference
->modify('first day of this month')
->modify('-1 day')
->setTime(0, 0)
@@ -523,10 +525,15 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
private function resolveTakenCalculationEndDate(
DateTimeImmutable $periodEnd,
Employee $employee
Employee $employee,
?DateTimeImmutable $asOfDate = null
): ?DateTimeImmutable {
$end = $periodEnd;
if ($asOfDate instanceof DateTimeImmutable && $asOfDate < $end) {
$end = $asOfDate;
}
// Cap at contract end date if the employee has left.
$contractEndRaw = $employee->getCurrentContractEndDate();
if (null !== $end && null !== $contractEndRaw && '' !== trim($contractEndRaw)) {