=== A. requete auditeur === SELECT f.rowid,f.ref,f.total_ttc,f.fk_statut,f.paye,SUM(pf.amount) sp FROM llx_facture f JOIN llx_paiement_facture pf ON pf.fk_facture=f.rowid WHERE f.fk_statut=1 GROUP BY f.rowid HAVING ABS(f.total_ttc-sp)<0.005 === B. factures ouvertes avec paiement === SELECT f.rowid,f.ref,f.entity,f.type,f.total_ttc,f.fk_statut,f.paye,COALESCE(SUM(pf.amount),0) sp, f.total_ttc-COALESCE(SUM(pf.amount),0) reste FROM llx_facture f LEFT JOIN llx_paiement_facture pf ON pf.fk_facture=f.rowid WHERE f.fk_statut=1 GROUP BY f.rowid HAVING sp>0 ORDER BY reste rowid=239; ref=FA2605-0217; entity=1; type=0; total_ttc=258.91000000; fk_statut=1; paye=0; sp=257.91000000; reste=1.00000000; rowid=57; ref=FA2510-0051; entity=1; type=0; total_ttc=26.20000000; fk_statut=1; paye=0; sp=24.00000000; reste=2.20000000; rowid=268; ref=FA2606-0246; entity=1; type=0; total_ttc=1382.40000000; fk_statut=1; paye=0; sp=271.20000000; reste=1111.20000000; === C. nb paiements === SELECT COUNT(*) n, SUM(amount) tot FROM llx_paiement n=138; tot=381849.86000000; === D. statut paiements === SELECT statut,COUNT(*) n FROM llx_paiement GROUP BY statut statut=0; n=123; statut=1; n=15; === E. factures fk_soc=284 === SELECT f.rowid,f.ref,f.datef,f.total_ttc,f.fk_statut,f.paye,COALESCE(SUM(pf.amount),0) sp FROM llx_facture f LEFT JOIN llx_paiement_facture pf ON pf.fk_facture=f.rowid WHERE f.fk_soc=284 AND f.entity=1 GROUP BY f.rowid ORDER BY f.datef rowid=147; ref=FA2602-0129; datef=2026-02-05; total_ttc=165.66000000; fk_statut=2; paye=1; sp=165.66000000; rowid=146; ref=FA2602-0128; datef=2026-02-05; total_ttc=333.45000000; fk_statut=2; paye=1; sp=333.45000000; rowid=222; ref=FA2604-0202; datef=2026-04-18; total_ttc=301.97000000; fk_statut=2; paye=1; sp=301.97000000; rowid=237; ref=FA2605-0215; datef=2026-05-11; total_ttc=1557.85000000; fk_statut=2; paye=1; sp=1557.85000000; rowid=248; ref=FA2605-0226; datef=2026-05-21; total_ttc=243.37000000; fk_statut=2; paye=1; sp=243.37000000; rowid=250; ref=FA2605-0228; datef=2026-05-26; total_ttc=17.19000000; fk_statut=2; paye=1; sp=17.19000000; rowid=251; ref=FA2605-0229; datef=2026-05-29; total_ttc=36.48000000; fk_statut=2; paye=1; sp=36.48000000; rowid=256; ref=FA2606-0234; datef=2026-06-01; total_ttc=465.48000000; fk_statut=2; paye=1; sp=465.48000000; rowid=266; ref=FA2606-0244; datef=2026-06-11; total_ttc=609.12000000; fk_statut=2; paye=1; sp=609.12000000; rowid=274; ref=FA2606-0252; datef=2026-06-24; total_ttc=47.54000000; fk_statut=2; paye=1; sp=47.54000000; rowid=285; ref=FA2607-0263; datef=2026-07-10; total_ttc=54.24000000; fk_statut=2; paye=1; sp=54.24000000; rowid=298; ref=FA2607-0276; datef=2026-07-20; total_ttc=2116.44000000; fk_statut=2; paye=1; sp=2116.44000000; rowid=305; ref=FA2607-0283; datef=2026-07-22; total_ttc=515.51000000; fk_statut=2; paye=1; sp=515.51000000; rowid=317; ref=FA2607-0295; datef=2026-07-30; total_ttc=2241.79000000; fk_statut=2; paye=1; sp=2241.79000000; rowid=325; ref=FA2608-0303; datef=2026-08-03; total_ttc=743.27000000; fk_statut=2; paye=1; sp=743.27000000; rowid=393; ref=FA2609-0354; datef=2026-09-02; total_ttc=375.14000000; fk_statut=1; paye=0; sp=0.00000000; rowid=405; ref=FA2609-0363; datef=2026-09-21; total_ttc=1939.72000000; fk_statut=1; paye=0; sp=0.00000000; rowid=417; ref=FA2609-0375; datef=2026-09-28; total_ttc=260.01000000; fk_statut=1; paye=0; sp=0.00000000; === F. tiers 284 === SELECT s.rowid,s.nom,s.code_client FROM llx_societe s WHERE s.rowid=284 rowid=284; nom=LEFEVRE R; code_client=CU2601-00057; === G. creances statut 1 === SELECT COUNT(*) nb, SUM(f.total_ttc) ttc_total, SUM(f.total_ttc-COALESCE((SELECT SUM(pf.amount) FROM llx_paiement_facture pf WHERE pf.fk_facture=f.rowid),0)) reste FROM llx_facture f WHERE f.entity=1 AND f.fk_statut=1 nb=41; ttc_total=38307.97000000; reste=37754.86000000; === I. repartition factures === SELECT f.fk_statut,f.paye,f.type,COUNT(*) n,SUM(f.total_ttc) s FROM llx_facture f WHERE f.entity=1 GROUP BY f.fk_statut,f.paye,f.type fk_statut=2; paye=1; type=0; n=347; s=381296.75000000; fk_statut=1; paye=0; type=0; n=41; s=38307.97000000; fk_statut=3; paye=0; type=0; n=2; s=78290.23000000; fk_statut=0; paye=0; type=0; n=2; s=1118.33000000; === J. ligne banque 80 === SELECT rowid,dateo,datev,amount,label,rappro,num_releve,fk_account,fk_type,num_chq FROM llx_bank WHERE rowid=80 rowid=80; dateo=2026-04-28; datev=2026-04-28; amount=301.97000000; label=(CustomerInvoicePayment); rappro=1; num_releve=202604; fk_account=1; fk_type=VIR; num_chq=; === K. bank_url 80 === SELECT * FROM llx_bank_url WHERE fk_bank=80 rowid=157; fk_bank=80; url_id=79; url=/compta/paiement/card.php?id=; label=(paiement); type=payment; rowid=158; fk_bank=80; url_id=284; url=/comm/card.php?socid=; label=LEFEVRE R; type=company;