Cotisation diffuseur URSSAF (1,1%) : nouveau champ, TTC calculé en cascade

Architecture métier corrigée : la SAS devise HT, ajoute (quand
applicable -- pas systématique) 1,1% de cotisation diffuseur URSSAF
pour l'usage de freelances, puis applique la TVA sur ce montant
augmenté -- pas sur le HT brut. La répartition entre comptes reste
basée sur le HT seul, inchangée.

- field_cotisation_active (case à cocher, "Entrée client" uniquement,
  cochée par défaut sur une nouvelle ligne -- optionnelle puisque tous
  les devis ne l'incluent pas historiquement).
- field_cotisation_urssaf ("1,1%", montant calculé HT × 1,011, jamais
  éditable).
- Montant TTC = round(cotisation × (1 + TVA/100), 2) quand la
  cotisation s'applique, round(HT × (1 + TVA/100), 2) sinon --
  inchangé pour tous les types hors "Entrée client".

Migration (update hooks 8006/8007) : toutes les lignes "Entrée client"
de field_tva rétro-calculées par figli_compta_ledger_update_8005()
étaient fausses dès que la cotisation s'appliquait (taux mixte HT->TTC,
pas le vrai taux de TVA) -- corrigées avec la même prudence que la
migration précédente : 2021 laissée de côté (pratique non confirmée
sur cette année), et par ligne, un taux déjà "propre" (0/2,1/5,5/10/20
%) signifie qu'aucune cotisation n'a été appliquée (laissé tel quel) ;
sinon le nouveau taux recalculé n'est retenu que s'il retombe lui-même
sur un taux officiel, sinon la ligne reste inchangée plutôt que de
deviner. Montant TTC historique jamais réécrit, comme pour toute
migration de ce module. Résultat : 154 lignes corrigées (cotisation
active), 90 déjà correctes (cotisation inactive), 40 ambiguës laissées
telles quelles, 43 lignes 2021 ignorées.

Formulaire réorganisé en grille à 4 colonnes (HT | 1,1% | TVA | TTC),
case à cocher masquée hors "Entrée client" via #states réel (fiable
ici, contrairement au select TVA -- watch sur field_type_ligne, un
vrai champ, pas un élément ajouté à la main). Colonne "1,1%" ajoutée
au grand livre entre HT et TVA.
This commit is contained in:
2026-09-07 14:33:20 +02:00
parent 134c97ac9d
commit 6c33bc0098
13 changed files with 478 additions and 74 deletions
@@ -457,6 +457,13 @@ html.gin--dark-mode #figli-home-app {
#figli-home-app .amount.figli-ttc-col {
width: 5%;
}
/* Cotisation diffuseur URSSAF (1,1%) -- blank for every non-"Entrée
client" row (see figli_compta_ledger_node_presave()), same width
budget as HT/TTC since it's a real € amount, not a short rate like
TVA. */
#figli-home-app .amount.figli-cotisation-col {
width: 5%;
}
#figli-home-app .amount.figli-tva-col {
width: 3.5%;
}
@@ -25,7 +25,7 @@
--flform-danger: #b3261e;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-columns: repeat(4, 1fr);
gap: 0.5rem 1rem;
max-width: 44rem;
margin: 0 auto;
@@ -59,15 +59,18 @@ html.gin--dark-mode .figli-ledger-form {
display: none;
}
/* Row layout, fully explicit (not left to grid auto-placement) --
there are now two separate 1-col-plus-2-col row groupings (Client +
N° Facture, then Montant HT + TVA + Montant TTC) and relying on DOM
order alone to keep them from bleeding into each other got fragile
once a 4th financial field (TVA) entered the picture. This must stay
in sync with the field weights set in
figli_compta_ledger_update_8004()/_figli_compta_ledger_create_node_type_ligne_comptable(). */
/* Row layout, fully explicit (not left to grid auto-placement) -- with
Cotisation now in the mix there are three separate row groupings
(Client + N° Facture, the checkbox on its own full-width row, then
Montant HT + Cotisation + TVA + Montant TTC as a clean four-column
row) and relying on DOM order alone to keep them from bleeding into
each other got fragile once that many financial fields entered the
picture. This must stay in sync with the field weights set in
figli_compta_ledger_update_8006()/_figli_compta_ledger_create_node_type_ligne_comptable(). */
.figli-ledger-form > .field--name-title,
.figli-ledger-form > .field--name-field-entree-liee,
.figli-ledger-form > .field--name-field-cotisation-active,
.figli-ledger-form > .field--name-field-tva,
.figli-ledger-form > .field--name-field-repartition,
.figli-ledger-form > .field--name-field-notes,
.figli-ledger-form > .field--name-field-flag {
@@ -77,31 +80,32 @@ html.gin--dark-mode .figli-ledger-form {
grid-column: 1 / 2;
}
.figli-ledger-form > .field--name-field-type-ligne {
grid-column: 2 / 4;
grid-column: 2 / 5;
}
.figli-ledger-form > .field--name-field-client {
grid-column: 1 / 3;
grid-column: 1 / 4;
}
.figli-ledger-form > .field--name-field-numero-facture {
grid-column: 3 / 4;
grid-column: 4 / 5;
}
.figli-ledger-form > .field--name-field-montant-ht {
grid-column: 1 / 2;
}
/* The field_tva_rate select (added in figli_compta_ledger_form_alter(),
not a real field so it gets no field--name-* class) fills the middle
slot of the HT/TVA/TTC row instead -- see that function's #weight
comment for why this specific ordering (weight 6, between HT's 5 and
TTC's 7) matters, not just matching column numbers. field_tva itself
only appears -- full width, its own row -- when "Autre" is picked. */
.figli-ledger-form > .js-form-item-field-tva-rate {
.figli-ledger-form > .field--name-field-cotisation-urssaf {
grid-column: 2 / 3;
}
.figli-ledger-form > .field--name-field-tva {
grid-column: 1 / -1;
/* The field_tva_rate select (added in figli_compta_ledger_form_alter(),
not a real field so it gets no field--name-* class) fills the third
slot of the HT/Cotisation/TVA/TTC row -- see that function's #weight
comment for why this specific ordering (weight 7, between Cotisation's
6 and TTC's 8) matters, not just matching column numbers. field_tva
itself (grouped with the other always-full-width fields above) only
appears -- full width, its own row -- when "Autre" is picked. */
.figli-ledger-form > .js-form-item-field-tva-rate {
grid-column: 3 / 4;
}
.figli-ledger-form > .field--name-field-montant-ttc {
grid-column: 3 / 4;
grid-column: 4 / 5;
}
/* Field basics */