=== A1 - requete auditeur brute (sans entity) === SELECT COUNT(*) AS n, ROUND(SUM(total_ttc),2) AS ttc, ROUND(SUM(total_ttc - COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0)),2) AS reste FROM llx_facture f WHERE f.fk_statut=1 AND f.paye=0 n=41 | ttc=38307.97 | reste=37754.86 -- 1 ligne(s) === A2 - idem avec entity=1 === SELECT COUNT(*) AS n, ROUND(SUM(total_ttc),2) AS ttc, ROUND(SUM(total_ttc - COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0)),2) AS reste FROM llx_facture f WHERE f.fk_statut=1 AND f.paye=0 AND f.entity=1 n=41 | ttc=38307.97 | reste=37754.86 -- 1 ligne(s) === B - factures ouvertes AVEC paiement partiel === SELECT f.rowid, f.ref, f.datef, f.type, f.total_ttc, f.paye, f.fk_statut, ROUND(COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0),2) AS regle, ROUND(f.total_ttc - COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0),2) AS reste FROM llx_facture f WHERE f.fk_statut=1 AND f.paye=0 AND COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0)<>0 ORDER BY f.datef rowid=57 | ref=FA2510-0051 | datef=2025-10-06 | type=0 | total_ttc=26.20000000 | paye=0 | fk_statut=1 | regle=24 | reste=2.2 rowid=239 | ref=FA2605-0217 | datef=2026-05-12 | type=0 | total_ttc=258.91000000 | paye=0 | fk_statut=1 | regle=257.91 | reste=1 rowid=268 | ref=FA2606-0246 | datef=2026-06-16 | type=0 | total_ttc=1382.40000000 | paye=0 | fk_statut=1 | regle=271.2 | reste=1111.2 -- 3 ligne(s) === C - FA2604-0202 entete === SELECT rowid, ref, ref_ext, datef, type, total_ht, total_tva, total_ttc, paye, fk_statut, close_code, close_note, fk_soc, entity FROM llx_facture WHERE ref LIKE '%2604-0202%' rowid=222 | ref=FA2604-0202 | ref_ext= | datef=2026-04-18 | type=0 | total_ht=251.65000000 | total_tva=50.32000000 | total_ttc=301.97000000 | paye=1 | fk_statut=2 | close_code= | close_note= | fk_soc=284 | entity=1 -- 1 ligne(s) === D - paiements de FA2604-0202 === SELECT pf.rowid, pf.fk_paiement, pf.fk_facture, pf.amount, pf.multicurrency_amount, p.datep, p.num_paiement, p.fk_bank, p.statut FROM llx_paiement_facture pf LEFT JOIN llx_paiement p ON p.rowid=pf.fk_paiement WHERE pf.fk_facture=(SELECT rowid FROM llx_facture WHERE ref LIKE '%2604-0202%' LIMIT 1) rowid=164 | fk_paiement=79 | fk_facture=222 | amount=301.97000000 | multicurrency_amount=301.97000000 | datep=2026-04-28 12:00:00 | num_paiement= | fk_bank=80 | statut=0 -- 1 ligne(s) === E - avoirs lies a FA2604-0202 === SELECT rowid, ref, type, total_ttc, paye, fk_statut, fk_facture_source FROM llx_facture WHERE fk_facture_source=(SELECT rowid FROM llx_facture WHERE ref LIKE '%2604-0202%' LIMIT 1) -- 0 ligne(s) === F - remises/avoirs appliques a FA2604-0202 === SELECT * FROM llx_societe_remise_except WHERE fk_facture=(SELECT rowid FROM llx_facture WHERE ref LIKE '%2604-0202%' LIMIT 1) OR fk_facture_line IS NOT NULL AND fk_facture=(SELECT rowid FROM llx_facture WHERE ref LIKE '%2604-0202%' LIMIT 1) -- 0 ligne(s) === G - les 4 residus annonces === SELECT f.rowid, f.ref, f.datef, f.total_ttc, ROUND(COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0),2) AS regle, ROUND(f.total_ttc - COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0),2) AS reste FROM llx_facture f WHERE f.ref LIKE '%2510-0051%' OR f.ref LIKE '%2605-0217%' OR f.ref LIKE '%2607-0291%' OR f.ref LIKE '%2606-0246%' rowid=57 | ref=FA2510-0051 | datef=2025-10-06 | total_ttc=26.20000000 | regle=24 | reste=2.2 rowid=239 | ref=FA2605-0217 | datef=2026-05-12 | total_ttc=258.91000000 | regle=257.91 | reste=1 rowid=268 | ref=FA2606-0246 | datef=2026-06-16 | total_ttc=1382.40000000 | regle=271.2 | reste=1111.2 rowid=313 | ref=FA2607-0291 | datef=2026-07-29 | total_ttc=32.67000000 | regle=32.67 | reste=0 -- 4 ligne(s) === H - fournisseurs requete auditeur === SELECT COUNT(*) AS n, ROUND(SUM(total_ttc),2) AS ttc, ROUND(SUM(total_ttc - COALESCE((SELECT SUM(pf.amount) FROM llx_paiementfourn_facturefourn pf WHERE pf.fk_facturefourn=f.rowid),0)),2) AS reste FROM llx_facture_fourn f WHERE f.fk_statut=1 AND f.paye=0 n=12 | ttc=19897.89 | reste=19897.89 -- 1 ligne(s) === I - fournisseurs TTC negatif ouverts === SELECT f.rowid, f.ref, f.ref_supplier, f.datef, f.type, f.total_ttc, f.paye, f.fk_statut FROM llx_facture_fourn f WHERE f.fk_statut=1 AND f.paye=0 AND f.total_ttc<0 ORDER BY f.datef -- 0 ligne(s) === J - SI2606-0143 === SELECT rowid, ref, ref_supplier, datef, type, total_ht, total_ttc, paye, fk_statut, fk_soc FROM llx_facture_fourn WHERE ref LIKE '%2606-0143%' OR ref_supplier LIKE '%06/13%' rowid=294 | ref=SI2606-0143 | ref_supplier=06/13 | datef=2026-06-19 | type=0 | total_ht=-11.00000000 | total_ttc=-13.20000000 | paye=0 | fk_statut=2 | fk_soc=359 -- 1 ligne(s) === K - repartition statuts factures clients === SELECT fk_statut, paye, type, COUNT(*) AS n, ROUND(SUM(total_ttc),2) AS ttc FROM llx_facture GROUP BY fk_statut, paye, type ORDER BY fk_statut, paye, type fk_statut=0 | paye=0 | type=0 | n=2 | ttc=1118.33 fk_statut=1 | paye=0 | type=0 | n=41 | ttc=38307.97 fk_statut=2 | paye=1 | type=0 | n=347 | ttc=381296.75 fk_statut=3 | paye=0 | type=0 | n=2 | ttc=78290.23 -- 4 ligne(s)