Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f96fd64767 | ||
| 523d4f296b | |||
|
|
3994be6556 | ||
| f46eeaa893 | |||
|
|
eb703272c7 | ||
| 6629eb98cb |
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.22'
|
||||
app.version: '0.1.25'
|
||||
|
||||
@@ -203,8 +203,9 @@ Tous les filtres checkbox sont cochés par défaut à l'ouverture du drawer.
|
||||
- la prise sur `en cours d'acquisition` est autorisée (usage anticipé)
|
||||
- `en cours d'acquisition` peut devenir négatif si la prise dépasse le généré (ex: `2.08 - 3 = -0.92`), puis se reconstitue avec les acquisitions suivantes
|
||||
- date d'arret de calcul:
|
||||
- les compteurs sont calculés jusqu'au dernier jour du mois précédent (le mois en cours est exclu)
|
||||
- exemple: au `04/03/2026`, l'arret de calcul est le `28/02/2026` (ou `29/02` en année bissextile)
|
||||
- les compteurs sont calculés en prévisionnel jusqu'à la fin de l'exercice
|
||||
- les absences futures déjà posées sur l'exercice sont déduites du `reste à prendre`
|
||||
- exemple: au `11/03/2026`, l'exercice `2026` est calculé jusqu'au `31/05/2026`
|
||||
- hors périmètre phase 1: `INTERIM` (retour non supporté)
|
||||
- onglet `RTT`:
|
||||
- endpoint de synthèse: `GET /api/employees/{id}/rtt-summary?year=YYYY`
|
||||
|
||||
@@ -349,14 +349,25 @@ final readonly class LeaveBalanceComputationService
|
||||
}
|
||||
|
||||
for ($cursor = $rangeStart; $cursor <= $rangeEnd; $cursor = $cursor->modify('+1 day')) {
|
||||
$dayOfWeek = (int) $cursor->format('N');
|
||||
|
||||
if ($splitSaturdays) {
|
||||
if (7 === $dayOfWeek) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if ($dayOfWeek >= 6) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
[$am, $pm] = $this->resolveSegmentsForDate($absence, $cursor->format('Y-m-d'));
|
||||
$dayAmount = ($am ? 0.5 : 0.0) + ($pm ? 0.5 : 0.0);
|
||||
if ($dayAmount <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isSaturday = $splitSaturdays && '6' === $cursor->format('N');
|
||||
if ($isSaturday) {
|
||||
if ($splitSaturdays && 6 === $dayOfWeek) {
|
||||
$takenSaturdays += $dayAmount;
|
||||
} else {
|
||||
$takenDays += $dayAmount;
|
||||
|
||||
@@ -163,12 +163,12 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
|
||||
$effectiveFrom = $this->resolveEffectivePeriodStart($employee, $from, $to);
|
||||
$hasShiftedStart = $effectiveFrom > $from;
|
||||
if ($hasShiftedStart) {
|
||||
if ($hasShiftedStart && null === $openingBalance) {
|
||||
$carryDays = 0.0;
|
||||
$carrySaturdays = 0.0;
|
||||
}
|
||||
|
||||
$calculationEnd = $this->resolveCalculationEndDate($leavePolicy['ruleCode'], $year, $to, $employee);
|
||||
$calculationEnd = $this->resolveCalculationEndDate($to, $employee);
|
||||
$generatedDays = $leavePolicy['accrualPerMonth'] > 0.0
|
||||
? $this->computeAccruedDaysFromStart(
|
||||
$leavePolicy['acquiredDays'],
|
||||
@@ -354,27 +354,10 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
}
|
||||
|
||||
private function resolveCalculationEndDate(
|
||||
string $ruleCode,
|
||||
int $year,
|
||||
DateTimeImmutable $periodEnd,
|
||||
Employee $employee
|
||||
): ?DateTimeImmutable {
|
||||
$today = new DateTimeImmutable('today');
|
||||
$currentYear = LeaveRuleCode::FORFAIT_218->value === $ruleCode
|
||||
? (int) $today->format('Y')
|
||||
: $this->resolveCurrentLeaveYear($today);
|
||||
|
||||
if ($year < $currentYear) {
|
||||
$end = $periodEnd;
|
||||
} elseif ($year > $currentYear) {
|
||||
$end = null;
|
||||
} else {
|
||||
$lastDayPreviousMonth = $today
|
||||
->modify('first day of this month')
|
||||
->modify('-1 day')
|
||||
;
|
||||
$end = $lastDayPreviousMonth < $periodEnd ? $lastDayPreviousMonth : $periodEnd;
|
||||
}
|
||||
$end = $periodEnd;
|
||||
|
||||
// Cap at contract end date if the employee has left.
|
||||
$contractEndRaw = $employee->getCurrentContractEndDate();
|
||||
@@ -632,14 +615,27 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
}
|
||||
|
||||
for ($cursor = $rangeStart; $cursor <= $rangeEnd; $cursor = $cursor->modify('+1 day')) {
|
||||
$dayOfWeek = (int) $cursor->format('N');
|
||||
|
||||
if ($splitSaturdays) {
|
||||
// Mode CDI/CDD : dimanche ignoré, samedi compté séparément.
|
||||
if (7 === $dayOfWeek) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// Mode forfait : seuls les jours ouvrés (lun-ven) comptent.
|
||||
if ($dayOfWeek >= 6) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
[$am, $pm] = $this->resolveSegmentsForDate($absence, $cursor->format('Y-m-d'));
|
||||
$dayAmount = ($am ? 0.5 : 0.0) + ($pm ? 0.5 : 0.0);
|
||||
if ($dayAmount <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$isSaturday = $splitSaturdays && '6' === $cursor->format('N');
|
||||
if ($isSaturday && $splitSaturdays) {
|
||||
if ($splitSaturdays && 6 === $dayOfWeek) {
|
||||
$takenSaturdays += $dayAmount;
|
||||
} else {
|
||||
$takenDays += $dayAmount;
|
||||
|
||||
Reference in New Issue
Block a user