From 5afc5905d7d94a46c9dc0b2cf1f0f159a4692c49 Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 4 Sep 2026 21:25:53 +0200 Subject: [PATCH] Include ouverture lines in the footer's year totals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit totauxAnnee() excluded ouverture lines, so the footer showed net movement for the year rather than the actual account balance -- it never matched the "clôture calculée" (ouverture + movement) that the ouverture/clôture reconciliation badge's tooltip cites for the same year, which was confusing side by side. Verified per compte: ouverture 2023 minus the reconciliation écart now equals the footer's 2022 total exactly, to the cent, for every compte. --- .../src/Controller/LedgerStatsController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/modules/custom/figli_compta_ledger/src/Controller/LedgerStatsController.php b/web/modules/custom/figli_compta_ledger/src/Controller/LedgerStatsController.php index 2e3a34b..c053a62 100644 --- a/web/modules/custom/figli_compta_ledger/src/Controller/LedgerStatsController.php +++ b/web/modules/custom/figli_compta_ledger/src/Controller/LedgerStatsController.php @@ -18,8 +18,13 @@ class LedgerStatsController extends ControllerBase { /** * GET /lignes/api/totaux?annee=2023 -- per-compte répartition sums (plus * montant HT/TTC/écart totals) for every ligne_comptable dated that - * year. Ouverture lines are excluded: they're a carried-over balance, - * not activity within the year. + * year, including ouverture lines: the footer is meant to read as the + * actual account balance (solde) for the year, i.e. the same "clôture + * calculée" (ouverture + every movement dated within the year) that + * reconciliationOuverture() compares the *next* year's ouverture + * against. Excluding ouverture here would make this a net-movement + * figure instead, which never matches what the reconciliation badge's + * tooltip cites for the same year. */ public function totauxAnnee(Request $request) { $annee = $request->query->get('annee'); @@ -33,7 +38,6 @@ class LedgerStatsController extends ControllerBase { ->condition('type', 'ligne_comptable') ->condition('field_date_ligne', $annee . '-01-01', '>=') ->condition('field_date_ligne', ((int) $annee + 1) . '-01-01', '<') - ->condition('field_type_ligne', 'ouverture', '<>') ->execute(); $par_compte = [];