========================================================================================== SUIVI #1218 — diag pénalités × restant à facturer 2026-08-06T02:46:49+00:00 DB: mysql / hectareenvol LECTURE SEULE. Volumes = base connectée. ========================================================================================== 1. SCHÉMA penalites + satellites ------------------------------------------------------------------------------------------ Table penalites — colonnes : id, marche_id, programme_id, type, description, date_constat, montant_ht, taux_tva, montant_ttc, statut, date_deduction, facture_id, depot_facture_id, date_imputation, commentaire, created_at, updated_at - marche_id : OK - programme_id : OK - type : OK - description : OK - date_constat : OK - montant_ht : OK - taux_tva : OK - montant_ttc : OK - statut : OK - date_deduction : OK - facture_id : OK - depot_facture_id : OK - date_imputation : OK - commentaire : OK Table facture_penalites — colonnes : id, depot_facture_id, penalite_id, created_at, updated_at Table avenants — colonnes clés : id, marche_id, motif, montant_ht, statut 2. STATUTS / TYPES — valeurs + répartition + cumuls HT/TTC ------------------------------------------------------------------------------------------ Statut (code stocké) | n | Σ HT | Σ TTC acceptee | 8 | 185644.40 | 222773.28 notifiee | 2 | 2162.70 | 2595.24 Référentiel code (migration + PenaliteController) : notifiee, contestee, acceptee, deduite, annulee Libellé UI « Acceptée » = code stocké « acceptee ». Type | n | Σ HT retard | 6 | 152276.40 sinistre | 3 | 34162.70 autre | 1 | 1368.00 Total lignes pénalités : 10 3. AVENANTS « PÉNALITÉ » — risque double comptage ------------------------------------------------------------------------------------------ Avenants dont motif ~ PENALIT* : 0 Suspects double comptage (proche) : 0 4. PÉNALITÉS ACCEPTÉES SANS AVENANT « PÉNALITÉ » (cas sain) ------------------------------------------------------------------------------------------ Marchés avec ≥1 pénalité acceptee : 4 Dont SANS avenant motif~PENALIT : 4 M#24 — 1 ligne(s) acceptee — Σ HT 1368.00 M#63 — 5 ligne(s) acceptee — Σ HT 149064.04 M#65 — 1 ligne(s) acceptee — Σ HT 3212.36 M#104 — 1 ligne(s) acceptee — Σ HT 32000.00 5. « IMPUTÉE SUR » — volumes depot_facture_id ------------------------------------------------------------------------------------------ Imputées (depot_facture_id NOT NULL) : 0 Non imputées (NULL) : 10 Lignes pivot facture_penalites : 0 acceptee vide=8 imputé=0 notifiee vide=2 imputé=0 6. SIMULATION restant à facturer (affichage, AUCUNE écriture) ------------------------------------------------------------------------------------------ Formule frise actuelle (MarcheCouvertureKpiService) : restant = total_marche_ht − facturé − provisionné(RG+finitions) − capté(CP+CIE+OPC) pénalités = carte séparée (horsFrise), Σ notifiee+acceptee — NON soustraites du restant. Simulation cible Robin : restant′ = restant − Σ acceptee (sans toucher total marché). Si avenant PENALITES déjà dans total → soustraire acceptee = DOUBLE COMPTAGE. M# total_ht facture* reste_col pen_acc reste_sim av_pen? 24 154000.00 1368.00 152632.00 1368.00 151264.00 non 63 2991301.45 2918496.23 72805.22 149064.04 -76258.82 non 65 55280.00 37724.30 17555.70 3212.36 14343.34 non 104 355020.00 354870.84 149.16 32000.00 -31850.84 non * facture approx = montant_total_ht − reste_a_regler_ht (colonne Marche::recalculer), distinct du restant frise (qui retranche aussi RG/CP/OPC/CIE/finitions). 7. ANOMALIES ------------------------------------------------------------------------------------------ Montants HT < 0 : 0 Statuts hors référentiel : (aucun) Pénalités orphelines (marche inexistant) : 0 Imputées avec statut inattendu (hors notifiee/acceptee/deduite) : 0 ========================================================================================== FIN diag #1218 — aucune écriture. ==========================================================================================