Badge sur les taux TVA non officiels, écart positif en vert

- Un point ambre discret (pas de texte -- la colonne TVA ne fait que
  3,5% de large, à peine assez pour "12,64 %" lui-même) marque tout
  taux TVA qui ne tombe sur aucun des 5 taux officiels français (0,
  2,1, 5,5, 10, 20 %, ±0,05 point comme dans les scripts de migration).
  Infobulle pour le détail.
- Écart positif (répartition > Montant HT) passe au vert
  (--figli-positive), au lieu du rouge uniforme précédent -- même
  logique que la colonne Montant HT, qui distingue déjà positif/négatif.
This commit is contained in:
2026-09-07 14:45:06 +02:00
parent 0baa03855b
commit 6576b35c07
3 changed files with 44 additions and 5 deletions
@@ -292,12 +292,21 @@ html.gin--dark-mode #figli-home-app {
font-weight: 700;
}
/* Écart is called out by the Écart column itself (bold red, see
.figli-ecart below) -- no separate row-level treatment needed. */
/* Écart is called out by the Écart column itself (bold, red or green
depending on sign -- see below) -- no separate row-level treatment
needed. Répartition > Montant HT (positive écart) means the accounts
were credited more than what's actually owed for this line, the same
"more money than expected" sense .figli-montant-positif already
marks green elsewhere; the reverse (negative) stays the usual
red/error color. */
#figli-home-app td.figli-ecart {
color: var(--figli-error);
font-weight: 700;
}
#figli-home-app td.figli-ecart-positif {
color: var(--figli-positive);
font-weight: 700;
}
/* Signalé rows: a thick amber accent bar on the left edge. */
#figli-home-app tr.figli-flag-row td:first-child {
@@ -467,6 +476,20 @@ html.gin--dark-mode #figli-home-app {
#figli-home-app .amount.figli-tva-col {
width: 3.5%;
}
/* Non-official TVA rate marker -- a plain dot rather than a text badge
(e.g. "non officiel"): the column is only ~3.5% wide, barely enough
for "12,64 %" itself, so anything wider than a few px would overflow
into the next column. Tooltip (title attribute in the twig template)
carries the actual explanation. */
#figli-home-app .figli-tva-badge {
display: inline-block;
width: 6px;
height: 6px;
margin-left: 3px;
border-radius: 50%;
background: var(--figli-warning);
vertical-align: middle;
}
#figli-home-app .amount.compte-col {
width: 4.3%;
white-space: nowrap;
@@ -26,6 +26,12 @@
// stores a plain rate (10), which style: 'percent' would otherwise
// silently read as 1000%.
const PCT = new Intl.NumberFormat('fr-FR', { minimumFractionDigits: 0, maximumFractionDigits: 2 });
// Mirrors the $taux_officiels select in figli_compta_ledger_form_alter()
// and the $official list in figli_compta_ledger_update_8007()/_8008() --
// same 0.05-point tolerance as those migration scripts, for the same
// "rounding through 2-decimal HT/TTC storage" reason.
const OFFICIAL_TVA_RATES = [0, 2.1, 5.5, 10, 20];
const OFFICIAL_TVA_EPSILON = 0.05;
const MONTHS = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
const TYPE_LABELS = {
entree: 'Entrée client',
@@ -681,6 +687,16 @@
formatPct(v) {
return v === null || v === undefined ? '' : PCT.format(v) + ' %';
},
// Flags a TVA rate that isn't one of the 5 official French VAT
// rates -- either a genuinely blended/multi-rate invoice collapsed
// into one ligne_comptable, or a migrated line
// figli_compta_ledger_update_8007() left ambiguous rather than
// guess (see that function's docblock). Null (no TVA recorded at
// all) is never flagged -- nothing to question there.
isTvaOfficial(v) {
if (v === null || v === undefined) return true;
return OFFICIAL_TVA_RATES.some((o) => Math.abs(v - o) < OFFICIAL_TVA_EPSILON);
},
// Écart between this ouverture row's year and the previous year's
// calculated closing balance -- restricted to whichever compte(s)
// this specific row's répartition actually touches (ouverture lines
@@ -243,10 +243,10 @@
</td>
<td class="amount figli-ht-col" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
<td class="amount figli-cotisation-col">{{ formatEur(item.cotisation) }}</td>
<td class="amount figli-tva-col">{{ formatPct(item.tva) }}</td>
<td class="amount figli-tva-col">{{ formatPct(item.tva) }}<span v-if="!isTvaOfficial(item.tva)" class="figli-tva-badge" title="Taux TVA non officiel (ni 0, 2,1, 5,5, 10 ni 20 %)"></span></td>
<td class="amount figli-ttc-col">{{ formatEur(item.montant_ttc) }}</td>
<td v-for="c in allComptes" :key="c" class="amount compte-col">{{ item.parCompte[c] !== undefined ? formatEur(item.parCompte[c]) : '' }}</td>
<td class="amount" :class="{'figli-ecart': item.hasError}">{{ item.hasError ? formatEur(item.ecart) : '' }}</td>
<td class="amount" :class="{'figli-ecart': item.hasError && item.ecart < 0, 'figli-ecart-positif': item.hasError && item.ecart > 0}">{{ item.hasError ? formatEur(item.ecart) : '' }}</td>
</tr>
</template>
<tr ref="bottomSentinel" class="figli-sentinel-row">
@@ -324,7 +324,7 @@
<td class="amount" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
<td class="amount">{{ formatEur(item.montant_ttc) }}</td>
<td v-for="c in modalComptes" :key="c" class="amount compte-col">{{ item.parCompte[c] !== undefined ? formatEur(item.parCompte[c]) : '' }}</td>
<td class="amount" :class="{'figli-ecart': item.hasError}">{{ item.hasError ? formatEur(item.ecart) : '' }}</td>
<td class="amount" :class="{'figli-ecart': item.hasError && item.ecart < 0, 'figli-ecart-positif': item.hasError && item.ecart > 0}">{{ item.hasError ? formatEur(item.ecart) : '' }}</td>
</tr>
</tbody>
<tfoot>