feat(leave) : prorate forfait work-target days in employee header
The header hardcoded '218 jours' and '218 - presence restants', wrong for a
forfait entered mid-year. Expose forfaitWorkTargetDays = businessDays(period) -
acquiredDays (218 full year, prorated otherwise) and show
'Forfait - {target} jours ({presence} présence · {target-presence} restants)'.
Grégory: 155 jours (11 présence · 144 restants).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -133,6 +133,14 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
$summary->previousYearPaidDays = $paidLeaveDays;
|
||||
|
||||
[$periodFrom, $periodTo] = $this->resolvePeriodBounds($employee, $year, $phase);
|
||||
|
||||
// Forfait : jours à travailler sur l'exercice = jours ouvrés de la période − congés acquis.
|
||||
// Année pleine → 218 (252 − 34) ; entrée en cours d'année → prorata (ex. 168 − 13 ≈ 155).
|
||||
if (LeaveRuleCode::FORFAIT_218->value === $summary->ruleCode) {
|
||||
$businessDaysInPeriod = $this->countBusinessDays($periodFrom, $periodTo, $this->buildRawPublicHolidayMap($periodFrom, $periodTo));
|
||||
$summary->forfaitWorkTargetDays = $businessDaysInPeriod - $summary->acquiredDays;
|
||||
}
|
||||
|
||||
// Forfait-only: leaves taken from N-1 stock do NOT decrement presence days.
|
||||
// For non-forfait, previousYearTakenDays is always 0, so the budget has no effect.
|
||||
$n1AbsencesBudget = $yearSummary['previousYearTakenDays'];
|
||||
|
||||
Reference in New Issue
Block a user