Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed9df4e178 | ||
| 625b4af5ba | |||
|
|
2ec3044cb3 | ||
| f024a6a8de | |||
|
|
a60294a8f7 | ||
| dd7f9ef8a0 | |||
| cfa7d25521 |
@@ -30,6 +30,10 @@ services:
|
||||
arguments:
|
||||
$rttStartDate: '%env(RTT_START_DATE)%'
|
||||
|
||||
App\State\EmployeeRttSummaryProvider:
|
||||
arguments:
|
||||
$rttStartDate: '%env(RTT_START_DATE)%'
|
||||
|
||||
App\Repository\Contract\AbsenceReadRepositoryInterface: '@App\Repository\AbsenceRepository'
|
||||
App\Repository\Contract\EmployeeContractPeriodReadRepositoryInterface: '@App\Repository\EmployeeContractPeriodRepository'
|
||||
App\Repository\Contract\EmployeeScopedRepositoryInterface: '@App\Repository\EmployeeRepository'
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.44'
|
||||
app.version: '0.1.47'
|
||||
|
||||
@@ -148,7 +148,7 @@ Documents complementaires:
|
||||
- Validation: même logique que les heures classiques (`isValid`, `isSiteValid`, bulk)
|
||||
- Vue semaine:
|
||||
- jour/nuit/atelier par jour + indicateurs repas/dîner/nuitée
|
||||
- panier de nuit (PN): affiché par jour si nightMinutes > dayMinutes, et total hebdo dans la colonne Jour/Nuit sem.
|
||||
- panier de nuit (PN): affiché par jour si (nightMinutes > dayMinutes) OU (nightMinutes >= 240, soit au moins 4h de travail entre 21h et 6h), et total hebdo dans la colonne Jour/Nuit sem.
|
||||
- totaux hebdo: jour, nuit, atelier, total, compteurs petit déj/déjeuner/dîner/nuitée
|
||||
- pas de calcul d'heures supplémentaires pour les conducteurs
|
||||
- Le flag `isDriver` est sur `EmployeeContractPeriod` (un employé peut changer de statut chauffeur selon la période)
|
||||
@@ -325,7 +325,7 @@ Tous les filtres checkbox sont cochés par défaut à l'ouverture du drawer.
|
||||
| Base | Contract.name | Via EmployeeContractResolver pour le mois |
|
||||
| Jour de présence Cadre | WorkHour | Uniquement FORFAIT (PRESENCE). Somme isPresentMorning (0.5) + isPresentAfternoon (0.5) |
|
||||
| Heures de nuit | WorkHour | Non-chauffeurs: calcul intervalles nuit (00:00-06:00, 21:00-24:00). Chauffeurs: somme nightHoursMinutes |
|
||||
| Panier de nuit | WorkHour | Nombre de jours où nightMinutes > dayMinutes |
|
||||
| Panier de nuit | WorkHour | Nombre de jours où (nightMinutes > dayMinutes) OU (nightMinutes >= 240, soit 4h entre 21h-6h) |
|
||||
| Heures payés | EmployeeRttPayment | Somme base25Minutes + base50Minutes du mois, convertie en heures |
|
||||
| Congés - Nombre | Absence code 'C' | Jours (demi-journées = 0.5) |
|
||||
| Congés - Date | Absence code 'C' | Dates formatées dd/mm |
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Report N-1 row (RTT rollover carry, June only) -->
|
||||
<tr v-if="showCarryRow">
|
||||
<tr v-if="showCarryRow" class="bg-tertiary-500">
|
||||
<td class="px-5 py-[10px] font-bold text-primary-500 border border-primary-500">Report</td>
|
||||
<td class="px-4 py-[10px] text-center text-neutral-500 border border-primary-500 border-r-2">-</td>
|
||||
<td class="px-4 py-[10px] text-center font-bold text-primary-500 border border-primary-500">{{ formatMinutes(summary!.carryBase25Minutes) }}</td>
|
||||
@@ -77,7 +77,7 @@
|
||||
</tr>
|
||||
|
||||
<!-- Report mois précédent (cumulated balance from previous months, July+) -->
|
||||
<tr v-if="showMonthReportRow">
|
||||
<tr v-if="showMonthReportRow" class="bg-tertiary-500">
|
||||
<td class="px-5 py-[10px] font-bold text-primary-500 border border-primary-500">Report</td>
|
||||
<td class="px-4 py-[10px] text-center text-neutral-500 border border-primary-500 border-r-2">-</td>
|
||||
<td class="px-4 py-[10px] text-center font-bold text-primary-500 border border-primary-500">{{ formatMinutes(monthReport.base25) }}</td>
|
||||
@@ -332,10 +332,19 @@ const carryMonth = computed(() => {
|
||||
})
|
||||
|
||||
const showCarryRow = computed(() => {
|
||||
return (
|
||||
currentMonth.value === carryMonth.value &&
|
||||
(props.summary?.carryFromPreviousYearMinutes ?? 0) > 0
|
||||
)
|
||||
if (currentMonth.value !== carryMonth.value) return false
|
||||
if ((props.summary?.carryFromPreviousYearMinutes ?? 0) === 0) return false
|
||||
|
||||
// On the first exercise, hide carry if carry month is before rttStartDate
|
||||
if (props.summary?.rttStartDate) {
|
||||
const startDate = new Date(props.summary.rttStartDate)
|
||||
const viewYear = currentMonth.value >= 6 ? props.summary.year - 1 : props.summary.year
|
||||
const viewDate = new Date(viewYear, currentMonth.value - 1, 1)
|
||||
const startMonthDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1)
|
||||
if (viewDate < startMonthDate) return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
// --- Month report row (cumulated balance from previous months) ---
|
||||
@@ -390,6 +399,18 @@ const monthReport = computed(() => {
|
||||
const showMonthReportRow = computed(() => {
|
||||
// Not on the carry month — carry row handles that
|
||||
if (currentMonth.value === carryMonth.value) return false
|
||||
|
||||
// On the first exercise (containing rttStartDate), hide report for months before the start date
|
||||
if (props.summary?.rttStartDate) {
|
||||
const startDate = new Date(props.summary.rttStartDate)
|
||||
const startYear = startDate.getFullYear()
|
||||
const startMonth = startDate.getMonth() + 1
|
||||
const viewYear = currentMonth.value >= 6 ? props.summary.year - 1 : props.summary.year
|
||||
const viewDate = new Date(viewYear, currentMonth.value - 1, 1)
|
||||
const startMonthDate = new Date(startYear, startMonth - 1, 1)
|
||||
if (viewDate < startMonthDate) return false
|
||||
}
|
||||
|
||||
const r = monthReport.value
|
||||
return r.total !== 0
|
||||
})
|
||||
|
||||
@@ -32,4 +32,5 @@ export type EmployeeRttSummary = {
|
||||
availableMinutes: number
|
||||
weeks: EmployeeRttWeekSummary[]
|
||||
monthPayments: RttMonthPayment[]
|
||||
rttStartDate: string | null
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ final class EmployeeRttSummary
|
||||
public int $currentYearRecoveryMinutes = 0;
|
||||
public int $availableMinutes = 0;
|
||||
public int $totalPaidMinutes = 0;
|
||||
public ?string $rttStartDate = null;
|
||||
|
||||
/** @var list<RttMonthPayment> */
|
||||
public array $monthPayments = [];
|
||||
|
||||
@@ -26,6 +26,8 @@ use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
|
||||
final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
||||
{
|
||||
private ?string $rttStartDate;
|
||||
|
||||
public function __construct(
|
||||
private Security $security,
|
||||
private RequestStack $requestStack,
|
||||
@@ -34,7 +36,10 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
||||
private EmployeeRttBalanceRepository $rttBalanceRepository,
|
||||
private EmployeeRttPaymentRepository $rttPaymentRepository,
|
||||
private RttRecoveryComputationService $rttRecoveryService,
|
||||
) {}
|
||||
string $rttStartDate = '',
|
||||
) {
|
||||
$this->rttStartDate = '' !== $rttStartDate ? $rttStartDate : null;
|
||||
}
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): EmployeeRttSummary
|
||||
{
|
||||
@@ -93,7 +98,15 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
||||
$summary->carryBonus50Minutes = $carry->bonus50Minutes;
|
||||
$summary->currentYearRecoveryMinutes = array_sum(array_map(static fn ($d) => $d->totalMinutes, $currentByWeekStart));
|
||||
$summary->availableMinutes = $summary->carryFromPreviousYearMinutes + $summary->currentYearRecoveryMinutes;
|
||||
$summary->weeks = array_map(
|
||||
|
||||
// Pass rttStartDate only if it falls within this exercise
|
||||
if (null !== $this->rttStartDate) {
|
||||
$startDate = new DateTimeImmutable($this->rttStartDate);
|
||||
if ($startDate >= $periodFrom && $startDate <= $periodTo) {
|
||||
$summary->rttStartDate = $this->rttStartDate;
|
||||
}
|
||||
}
|
||||
$summary->weeks = array_map(
|
||||
static function (array $week) use ($currentByWeekStart) {
|
||||
$detail = $currentByWeekStart[$week['start']->format('Y-m-d')] ?? new WeekRecoveryDetail();
|
||||
|
||||
|
||||
@@ -102,13 +102,13 @@ class LeaveRecapPrintProvider implements ProviderInterface
|
||||
|
||||
if (null !== $yearSummary) {
|
||||
if ($isForfait) {
|
||||
$cpN1Remaining = $yearSummary['previousYearRemainingDays'];
|
||||
$cpN = (string) $yearSummary['acquiredDays'];
|
||||
$cpN1Remaining = round($yearSummary['previousYearRemainingDays'], 2);
|
||||
$cpN = (string) round($yearSummary['acquiredDays'], 2);
|
||||
$acquiredSaturdays = '-';
|
||||
} else {
|
||||
$cpN1Remaining = $yearSummary['remainingDays'];
|
||||
$cpN = (string) $yearSummary['accruingDays'];
|
||||
$acquiredSaturdays = (string) $yearSummary['remainingSaturdays'];
|
||||
$cpN1Remaining = round($yearSummary['remainingDays'], 2);
|
||||
$cpN = (string) round($yearSummary['accruingDays'], 2);
|
||||
$acquiredSaturdays = (string) round($yearSummary['remainingSaturdays'], 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$nightMinutesTotal += $wh->getNightHoursMinutes() ?? 0;
|
||||
$dayMin = $wh->getDayHoursMinutes() ?? 0;
|
||||
$nightMin = $wh->getNightHoursMinutes() ?? 0;
|
||||
if ($nightMin > $dayMin && $nightMin > 0) {
|
||||
if (($nightMin > $dayMin && $nightMin > 0) || $nightMin >= 240) {
|
||||
++$nightBasketCount;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
} else {
|
||||
$metrics = $this->computeNightMinutes($wh);
|
||||
$nightMinutesTotal += $metrics['nightMinutes'];
|
||||
if ($metrics['nightMinutes'] > $metrics['dayMinutes'] && $metrics['nightMinutes'] > 0) {
|
||||
if (($metrics['nightMinutes'] > $metrics['dayMinutes'] && $metrics['nightMinutes'] > 0) || $metrics['nightMinutes'] >= 240) {
|
||||
++$nightBasketCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ final readonly class WorkHourWeeklySummaryProvider implements ProviderInterface
|
||||
$present = min(1.0, $morning + $afternoon + $creditedPresence);
|
||||
}
|
||||
|
||||
$hasNightBasket = $nightMinutes > $dayMinutes && $nightMinutes > 0;
|
||||
$hasNightBasket = ($nightMinutes > $dayMinutes && $nightMinutes > 0) || $nightMinutes >= 240;
|
||||
if ($hasNightBasket) {
|
||||
++$weeklyNightBasketCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user