Retour RH: vue jour par date, RTT mi-semaine, récap salaire & exports, panier de nuit (#21)
Auto Tag Develop / tag (push) Successful in 11s
Auto Tag Develop / tag (push) Successful in 11s
## Correctifs RH (branche fix/retour-rh) ### Vue Jour (Heures) - Mode saisie/présence, libellé de contrat et sauvegarde résolus **à la date affichée** (et non au contrat courant). Corrige les salariés passés 39h/35h → Forfait. ### RTT — heures supplémentaires - Proratisation du **plafond 25%/50%** pour les embauches en milieu de semaine (la bande +25% se décale au lieu de rester bloquée à 43h). Témoin Dylan : 4h à 25% + 3h à 50%. ### Récap salaire (PDF mensuel) - Forfait : congés imputés **N-1** non affichés et comptés en présence. - Colonne « Heures payés » **scindée 25% / 50%** (en-tête fusionné). - **Exclusion des salariés sans contrat** sur le mois (ex. Marine, contrat terminé). ### Exports heures annuelles (par salarié + tous) - **Tous les jours sous contrat** affichés, même vides/non saisis (corrige les lignes manquantes). - Samedis/dimanches en **gris plus foncé**. ### Panier de nuit - **Ne s'applique pas aux conducteurs** (vue semaine + récap salaire). ## Tests - 11 tests ajoutés. Suite verte hors un test legacy pré-existant dépendant de la date (`EmployeeRttSummaryProviderTest::testNoQueryParamsKeepsLegacyYearDefaulting`, non modifié par cette branche). ## À noter (hors scope) - L'export heures annuelles *tous salariés* peut dépasser `memory_limit=256M` (Dompdf) — limitation **pré-existante**, non corrigée ici. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #21 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #21.
This commit is contained in:
@@ -25,13 +25,23 @@ final class WorkHourDayContext
|
||||
/**
|
||||
* @var list<array{
|
||||
* employeeId:int,
|
||||
* hasContractAtDate:bool,
|
||||
* absenceLabel:?string,
|
||||
* absenceColor:?string,
|
||||
* absenceHalf:?string,
|
||||
* absentMorning:bool,
|
||||
* absentAfternoon:bool,
|
||||
* creditedMinutes:int,
|
||||
* creditedPresenceUnits:float
|
||||
* creditedPresenceUnits:float,
|
||||
* isDriverContract:bool,
|
||||
* hasFormation:bool,
|
||||
* formationLabel:?string,
|
||||
* virtualHolidayMinutes:int,
|
||||
* contractNature:?string,
|
||||
* trackingMode:?string,
|
||||
* weeklyHours:?int,
|
||||
* contractType:?string,
|
||||
* contractName:?string
|
||||
* }>
|
||||
*/
|
||||
public array $rows = [];
|
||||
|
||||
@@ -21,6 +21,10 @@ final class DayContextRow
|
||||
public ?string $formationLabel = null,
|
||||
public int $virtualHolidayMinutes = 0,
|
||||
public ?string $contractNature = null,
|
||||
public ?string $trackingMode = null,
|
||||
public ?int $weeklyHours = null,
|
||||
public ?string $contractType = null,
|
||||
public ?string $contractName = null,
|
||||
) {}
|
||||
|
||||
public function setFormation(string $label): void
|
||||
@@ -79,7 +83,11 @@ final class DayContextRow
|
||||
* hasFormation:bool,
|
||||
* formationLabel:?string,
|
||||
* virtualHolidayMinutes:int,
|
||||
* contractNature:?string
|
||||
* contractNature:?string,
|
||||
* trackingMode:?string,
|
||||
* weeklyHours:?int,
|
||||
* contractType:?string,
|
||||
* contractName:?string
|
||||
* }
|
||||
*/
|
||||
public function toArray(): array
|
||||
@@ -99,6 +107,10 @@ final class DayContextRow
|
||||
'formationLabel' => $this->formationLabel,
|
||||
'virtualHolidayMinutes' => $this->virtualHolidayMinutes,
|
||||
'contractNature' => $this->contractNature,
|
||||
'trackingMode' => $this->trackingMode,
|
||||
'weeklyHours' => $this->weeklyHours,
|
||||
'contractType' => $this->contractType,
|
||||
'contractName' => $this->contractName,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -236,13 +236,19 @@ final readonly class RttRecoveryComputationService
|
||||
? $this->computeWeeklyCustomReferenceMinutes($weekDays, $employeeContractsByDate)
|
||||
: $this->computeWeeklyOvertimeReferenceMinutes($weekDays, $employeeContractsByDate);
|
||||
$overtime25StartMinutes = $this->computeWeeklyOvertime25StartMinutes($weekDays, $employeeContractsByDate);
|
||||
// Plafond séparant 25 %/50 % : seuil de départ proraté + largeur de la bande +25 %
|
||||
// (4h pour un 39h, 8h pour un 35h). Il se décale ainsi avec une embauche en milieu
|
||||
// de semaine au lieu de rester bloqué à 43h, ce qui ouvre la tranche 50 %.
|
||||
$overtime50StartMinutes = $overtime25StartMinutes + $this->resolveOvertime25BandWidthMinutes($weekAnchorContract);
|
||||
$weeklyOvertimeTotalMinutes = $isWeekPresenceTracking
|
||||
? 0
|
||||
: $weeklyTotalMinutes - $overtimeReferenceMinutes;
|
||||
|
||||
$base25 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : max(0, min($weeklyTotalMinutes, 43 * 60) - $overtime25StartMinutes);
|
||||
[$rawBase25, $rawBase50] = $this->computeOvertimeBaseMinutes($weeklyTotalMinutes, $overtime25StartMinutes, $overtime50StartMinutes);
|
||||
|
||||
$base25 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : $rawBase25;
|
||||
$bonus25 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : (int) round($base25 * 0.25);
|
||||
$base50 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : max(0, $weeklyTotalMinutes - 43 * 60);
|
||||
$base50 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : $rawBase50;
|
||||
$bonus50 = ($isWeekPresenceTracking || $disableOvertimeBonuses || $isCustomContract) ? 0 : (int) round($base50 * 0.5);
|
||||
|
||||
if ($isWeekPresenceTracking || $disableOvertimeBonuses) {
|
||||
@@ -452,18 +458,31 @@ final readonly class RttRecoveryComputationService
|
||||
return $total;
|
||||
}
|
||||
|
||||
private function computeOvertime25BonusMinutes(int $weeklyTotalMinutes, int $startMinutes): int
|
||||
/**
|
||||
* Largeur (en minutes) de la tranche +25 % pour le contrat d'ancrage de la semaine :
|
||||
* 4h pour un 39h (39→43), 8h pour un 35h (35→43). Ajoutée au seuil de départ proraté
|
||||
* pour obtenir le plafond 25 %/50 %.
|
||||
*/
|
||||
private function resolveOvertime25BandWidthMinutes(?Contract $contract): int
|
||||
{
|
||||
$trancheMinutes = max(0, min($weeklyTotalMinutes, 43 * 60) - $startMinutes);
|
||||
$hours = $contract?->getWeeklyHours();
|
||||
$startHours = (null !== $hours && $hours >= 39) ? 39 : 35;
|
||||
|
||||
return (int) round($trancheMinutes * 0.25);
|
||||
return (43 - $startHours) * 60;
|
||||
}
|
||||
|
||||
private function computeOvertime50BonusMinutes(int $weeklyTotalMinutes): int
|
||||
/**
|
||||
* Répartit les heures supplémentaires hebdomadaires entre les bases 25 % et 50 %.
|
||||
* La tranche 25 % court du seuil de départ au plafond ; au-delà du plafond, c'est du 50 %.
|
||||
*
|
||||
* @return array{int, int} [base25Minutes, base50Minutes]
|
||||
*/
|
||||
private function computeOvertimeBaseMinutes(int $weeklyTotalMinutes, int $overtime25StartMinutes, int $overtime50StartMinutes): array
|
||||
{
|
||||
$trancheMinutes = max(0, $weeklyTotalMinutes - (43 * 60));
|
||||
$base25 = max(0, min($weeklyTotalMinutes, $overtime50StartMinutes) - $overtime25StartMinutes);
|
||||
$base50 = max(0, $weeklyTotalMinutes - $overtime50StartMinutes);
|
||||
|
||||
return (int) round($trancheMinutes * 0.5);
|
||||
return [$base25, $base50];
|
||||
}
|
||||
|
||||
private function hasDisabledOvertimeBonuses(?Contract $contract, ContractNature $contractNature): bool
|
||||
|
||||
@@ -264,10 +264,9 @@ class YearlyHoursExportBuilder
|
||||
$isoDay = (int) new DateTimeImmutable($date)->format('N');
|
||||
$isWeekend = $isoDay >= 6;
|
||||
|
||||
if (!$hasData && !$isWeekend && !$isHoliday) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Tous les jours contractés sont affichés, même vides ou non saisis (lignes
|
||||
// « manquantes » signalées par la RH). Seuls les jours hors contrat (avant
|
||||
// embauche, après départ, suspension) sont omis.
|
||||
if (!$hasData && null === $contract) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -411,6 +411,35 @@ final readonly class EmployeeLeaveSummaryProvider implements ProviderInterface
|
||||
return null !== $balance ? $balance->getPaidLeaveDays() : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Budget N-1 = nombre de jours de congé pris imputés sur le stock de l'année précédente,
|
||||
* pour l'exercice de l'année donnée. Reproduit exactement la dérivation de provide()
|
||||
* (phase courante + recalcul avec les jours payés) afin que les consommateurs externes
|
||||
* (ex. récap salaire) voient le même budget que la fiche employé. 0 si non supporté.
|
||||
*/
|
||||
public function resolvePreviousYearTakenDays(Employee $employee, int $year): float
|
||||
{
|
||||
$phase = $this->resolveCurrentPhase($employee);
|
||||
if (null === $phase) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
$summary = $this->computeYearSummary($employee, $year, 0.0, null, $phase);
|
||||
if (null === $summary) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
$paidLeaveDays = $this->resolvePaidLeaveDays($employee, $summary['ruleCode'], $year);
|
||||
if ($paidLeaveDays > 0.0) {
|
||||
$summary = $this->computeYearSummary($employee, $year, $paidLeaveDays, null, $phase);
|
||||
if (null === $summary) {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
return (float) $summary['previousYearTakenDays'];
|
||||
}
|
||||
|
||||
private function resolveEffectivePeriodStart(
|
||||
Employee $employee,
|
||||
DateTimeImmutable $from,
|
||||
|
||||
@@ -19,6 +19,7 @@ use App\Repository\ObservationRepository;
|
||||
use App\Repository\WorkHourRepository;
|
||||
use App\Service\Contracts\EmployeeContractResolver;
|
||||
use App\Service\PublicHolidayServiceInterface;
|
||||
use App\Service\WorkHours\AbsenceSegmentsResolver;
|
||||
use DateInterval;
|
||||
use DateTimeImmutable;
|
||||
use Dompdf\Dompdf;
|
||||
@@ -42,6 +43,8 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
private ObservationRepository $observationRepository,
|
||||
private EmployeeContractResolver $contractResolver,
|
||||
private PublicHolidayServiceInterface $publicHolidayService,
|
||||
private EmployeeLeaveSummaryProvider $leaveSummaryProvider,
|
||||
private AbsenceSegmentsResolver $absenceSegmentsResolver,
|
||||
) {}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): Response
|
||||
@@ -59,12 +62,25 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$from = DateTimeImmutable::createFromFormat('Y-m-d', $month.'-01');
|
||||
$to = $from->modify('last day of this month');
|
||||
|
||||
$employees = $this->employeeRepository->findForPrintBySiteIds([]);
|
||||
// N'inclure que les employés ayant un contrat couvrant tout ou partie du mois.
|
||||
// Sans ce filtre, un salarié dont le contrat est terminé (ex. parti en février)
|
||||
// apparaît à tort sur le récap des mois suivants.
|
||||
$employees = array_values(array_filter(
|
||||
$this->employeeRepository->findForPrintBySiteIds([]),
|
||||
fn (Employee $employee): bool => $this->hasContractInRange($employee, $from, $to)
|
||||
));
|
||||
$workHours = $this->workHourRepository->findByDateRangeAndEmployees($from, $to, $employees);
|
||||
$absences = $this->absenceRepository->findForPrint($from, $to, $employees);
|
||||
|
||||
$year = (int) $from->format('Y');
|
||||
$monthNumber = (int) $from->format('n');
|
||||
|
||||
// Congés depuis le début de l'exercice forfait (année civile) jusqu'à la fin du mois :
|
||||
// nécessaires pour consommer chronologiquement le budget N-1 d'un forfait (un congé
|
||||
// imputé N-1 ne doit ni s'afficher ni manquer en présence sur le récap).
|
||||
$yearStart = new DateTimeImmutable(sprintf('%d-01-01', $year));
|
||||
$ytdAbsences = $this->absenceRepository->findForPrint($yearStart, $to, $employees);
|
||||
$ytdAbsenceMap = $this->buildAbsenceMap($ytdAbsences);
|
||||
$rttPayments = $this->rttPaymentRepository->findByYearAndMonth($year, $monthNumber);
|
||||
|
||||
$bonuses = $this->bonusRepository->findByMonth($from, $to);
|
||||
@@ -83,7 +99,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$mileageMap = $this->buildMileageMap($mileages);
|
||||
$observationMap = $this->buildObservationMap($observations);
|
||||
|
||||
$siteGroups = $this->aggregateBySite($employees, $days, $contractMap, $driverMap, $workHourMap, $absenceMap, $rttPaymentMap, $bonusMap, $mileageMap, $observationMap, $holidayMap);
|
||||
$siteGroups = $this->aggregateBySite($employees, $days, $contractMap, $driverMap, $workHourMap, $absenceMap, $rttPaymentMap, $bonusMap, $mileageMap, $observationMap, $holidayMap, $ytdAbsenceMap, $year, $from, $to);
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isRemoteEnabled', true);
|
||||
@@ -110,6 +126,22 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
]);
|
||||
}
|
||||
|
||||
private function hasContractInRange(Employee $employee, DateTimeImmutable $from, DateTimeImmutable $to): bool
|
||||
{
|
||||
$fromDay = $from->format('Y-m-d');
|
||||
$toDay = $to->format('Y-m-d');
|
||||
|
||||
foreach ($employee->getContractPeriods() as $period) {
|
||||
$start = $period->getStartDate()->format('Y-m-d');
|
||||
$end = $period->getEndDate()?->format('Y-m-d');
|
||||
if ($start <= $toDay && (null === $end || $end >= $fromDay)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
@@ -164,6 +196,9 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
/**
|
||||
* @return array<int, int>
|
||||
*/
|
||||
/**
|
||||
* @return array<int, array{m25: int, m50: int}>
|
||||
*/
|
||||
private function buildRttPaymentMap(array $rttPayments): array
|
||||
{
|
||||
$map = [];
|
||||
@@ -172,7 +207,9 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
if (!$employeeId) {
|
||||
continue;
|
||||
}
|
||||
$map[$employeeId] = ($map[$employeeId] ?? 0) + $payment->getBase25Minutes() + $payment->getBase50Minutes();
|
||||
$map[$employeeId] ??= ['m25' => 0, 'm50' => 0];
|
||||
$map[$employeeId]['m25'] += $payment->getBase25Minutes();
|
||||
$map[$employeeId]['m50'] += $payment->getBase50Minutes();
|
||||
}
|
||||
|
||||
return $map;
|
||||
@@ -264,6 +301,10 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
array $mileageMap,
|
||||
array $observationMap,
|
||||
array $holidayMap,
|
||||
array $ytdAbsenceMap,
|
||||
int $year,
|
||||
DateTimeImmutable $monthFrom,
|
||||
DateTimeImmutable $monthTo,
|
||||
): array {
|
||||
$siteGroups = [];
|
||||
|
||||
@@ -281,11 +322,15 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$driverMap[$employeeId] ?? [],
|
||||
$workHourMap[$employeeId] ?? [],
|
||||
$absenceMap[$employeeId] ?? [],
|
||||
$rttPaymentMap[$employeeId] ?? 0,
|
||||
$rttPaymentMap[$employeeId] ?? ['m25' => 0, 'm50' => 0],
|
||||
$bonusMap[$employeeId] ?? 0.0,
|
||||
$mileageMap[$employeeId] ?? 0.0,
|
||||
$observationMap[$employeeId] ?? '',
|
||||
$holidayMap,
|
||||
$ytdAbsenceMap[$employeeId] ?? [],
|
||||
$year,
|
||||
$monthFrom,
|
||||
$monthTo,
|
||||
);
|
||||
|
||||
if (!isset($siteGroups[$siteId])) {
|
||||
@@ -310,11 +355,15 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
array $driverByDate,
|
||||
array $workHoursByDate,
|
||||
array $absences,
|
||||
int $rttPaidMinutes,
|
||||
array $rttPaid,
|
||||
float $bonusAmount,
|
||||
float $mileageKm,
|
||||
string $observation,
|
||||
array $holidayMap,
|
||||
array $ytdAbsences,
|
||||
int $year,
|
||||
DateTimeImmutable $monthFrom,
|
||||
DateTimeImmutable $monthTo,
|
||||
): array {
|
||||
$contractName = null;
|
||||
$presenceDays = 0.0;
|
||||
@@ -356,9 +405,8 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$dayMin = $wh->getDayHoursMinutes() ?? 0;
|
||||
$nightMin = $wh->getNightHoursMinutes() ?? 0;
|
||||
$workshopMin = $wh->getWorkshopHoursMinutes() ?? 0;
|
||||
if (($nightMin > $dayMin && $nightMin > 0) || $nightMin >= 240) {
|
||||
++$nightBasketCount;
|
||||
}
|
||||
// Le panier de nuit ne s'applique pas aux conducteurs (primes repas/nuitée
|
||||
// dédiées). Aucun panier de nuit crédité ici.
|
||||
|
||||
if ($wh->getHasBreakfast()) {
|
||||
++$driverBreakfast;
|
||||
@@ -415,11 +463,26 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$conges = $this->countAbsencesByCode($absences, ['C']);
|
||||
// Forfait : un congé imputé sur le stock N-1 ne doit pas s'afficher dans le récap
|
||||
// et doit compter comme jour de présence. On consomme le budget N-1 chronologiquement
|
||||
// sur tous les congés de l'exercice (année civile) jusqu'à la fin du mois imprimé.
|
||||
$n1Budget = $isForfait ? $this->leaveSummaryProvider->resolvePreviousYearTakenDays($employee, $year) : 0.0;
|
||||
if ($isForfait && $n1Budget > 0.0) {
|
||||
$ytdConges = array_values(array_filter(
|
||||
$ytdAbsences,
|
||||
static fn (Absence $a): bool => 'C' === $a->getType()?->getCode()
|
||||
));
|
||||
$split = $this->splitForfaitCongesByN1($ytdConges, $n1Budget, $monthFrom, $monthTo);
|
||||
$conges = ['count' => $split['count'], 'dates' => $split['dates']];
|
||||
$presenceDays += $split['n1PresenceDays'];
|
||||
} else {
|
||||
$conges = $this->countAbsencesByCode($absences, ['C']);
|
||||
}
|
||||
$maladie = $this->countAbsencesByCode($absences, ['M', 'AT']);
|
||||
|
||||
$nightHours = round($nightMinutesTotal / 60, 2);
|
||||
$paidHours = round($rttPaidMinutes / 60, 2);
|
||||
$paid25Hours = round(($rttPaid['m25'] ?? 0) / 60, 2);
|
||||
$paid50Hours = round(($rttPaid['m50'] ?? 0) / 60, 2);
|
||||
$sundayHours = round($sundayMinutesTotal / 60, 2);
|
||||
$holidayHours = round($holidayMinutesTotal / 60, 2);
|
||||
|
||||
@@ -431,7 +494,8 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
'mileageKm' => $mileageKm,
|
||||
'nightHours' => $nightHours,
|
||||
'nightBasketCount' => $nightBasketCount,
|
||||
'paidHours' => $paidHours,
|
||||
'paid25Hours' => $paid25Hours,
|
||||
'paid50Hours' => $paid50Hours,
|
||||
'sundayHours' => $sundayHours,
|
||||
'holidayHours' => $holidayHours,
|
||||
'bonusAmount' => $bonusAmount,
|
||||
@@ -574,6 +638,73 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
return max(0, $end - $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Répartit les congés ('C') d'un forfait entre N-1 (budget consommé chronologiquement,
|
||||
* non affiché et compté en présence) et N (affiché en congé). Seuls les jours tombant
|
||||
* dans le mois imprimé alimentent le retour ; les congés des mois antérieurs ne servent
|
||||
* qu'à consommer le budget N-1.
|
||||
*
|
||||
* @param list<Absence> $ytdConges congés depuis le début d'exercice jusqu'à la fin du mois
|
||||
*
|
||||
* @return array{count: float, dates: string, n1PresenceDays: float}
|
||||
*/
|
||||
private function splitForfaitCongesByN1(
|
||||
array $ytdConges,
|
||||
float $n1Budget,
|
||||
DateTimeImmutable $monthFrom,
|
||||
DateTimeImmutable $monthTo
|
||||
): array {
|
||||
usort($ytdConges, static fn (Absence $a, Absence $b): int => $a->getStartDate() <=> $b->getStartDate());
|
||||
|
||||
$remaining = $n1Budget;
|
||||
$count = 0.0;
|
||||
$n1PresenceDays = 0.0;
|
||||
$dayKeys = [];
|
||||
|
||||
foreach ($ytdConges as $absence) {
|
||||
$start = DateTimeImmutable::createFromInterface($absence->getStartDate())->setTime(0, 0);
|
||||
$end = DateTimeImmutable::createFromInterface($absence->getEndDate())->setTime(0, 0);
|
||||
|
||||
for ($day = $start; $day <= $end; $day = $day->modify('+1 day')) {
|
||||
if ((int) $day->format('N') >= 6) {
|
||||
continue; // week-ends ignorés
|
||||
}
|
||||
[$am, $pm] = $this->absenceSegmentsResolver->resolveForDate($absence, $day->format('Y-m-d'));
|
||||
$amount = ($am ? 0.5 : 0.0) + ($pm ? 0.5 : 0.0);
|
||||
if ($amount <= 0.0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$covered = 0.0;
|
||||
if ($remaining > 0.0) {
|
||||
$covered = min($remaining, $amount);
|
||||
$remaining -= $covered;
|
||||
}
|
||||
$displayed = $amount - $covered;
|
||||
|
||||
// Seul le mois imprimé alimente le récap ; les mois antérieurs ne font que consommer.
|
||||
if ($day < $monthFrom || $day > $monthTo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$n1PresenceDays += $covered;
|
||||
if ($displayed > 0.0) {
|
||||
$count += $displayed;
|
||||
$dayKeys[] = $day->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sort($dayKeys);
|
||||
$dayKeys = array_unique($dayKeys);
|
||||
|
||||
return [
|
||||
'count' => $count,
|
||||
'dates' => implode(', ', $this->mergeDaysIntoPeriods($dayKeys)),
|
||||
'n1PresenceDays' => $n1PresenceDays,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<Absence> $absences
|
||||
* @param list<string> $codes
|
||||
|
||||
@@ -68,6 +68,10 @@ final readonly class WorkHourDayContextProvider implements ProviderInterface
|
||||
isDriverContract: $this->contractResolver->resolveIsDriverForEmployeeAndDate($employee, $workDate),
|
||||
virtualHolidayMinutes: $this->holidayVirtualHoursResolver->resolveVirtualCredit($contract, $workDate, false, $workDaysMinutes),
|
||||
contractNature: $contractNature,
|
||||
trackingMode: $contract?->getTrackingMode(),
|
||||
weeklyHours: $contract?->getWeeklyHours(),
|
||||
contractType: $contract?->getType()->value,
|
||||
contractName: $contract?->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,10 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
$present = min(1.0, $morning + $afternoon + $creditedPresence);
|
||||
}
|
||||
|
||||
$hasNightBasket = ($nightMinutes > $dayMinutes && $nightMinutes > 0) || $nightMinutes >= 240;
|
||||
// Le panier de nuit ne s'applique pas aux conducteurs (ils ont leurs propres
|
||||
// primes repas/nuitée). Réservé aux non-conducteurs.
|
||||
$hasNightBasket = !$isDateDriver
|
||||
&& (($nightMinutes > $dayMinutes && $nightMinutes > 0) || $nightMinutes >= 240);
|
||||
if ($hasNightBasket) {
|
||||
++$weeklyNightBasketCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user