1 2 3 4
| SELECT RJours.DateJour AS DateCA, (nz(Sum(facture_clients.reste),0)+nz(Sum([detail_paie_C.montant_reglé]),0)) AS Client, (nz(Sum(facture_fournisseurs.reste),0)+nz(Sum([detail_paie_F.montant_reglé]),0)) AS fournisseur, nz(Sum([CNSS.montant_TTC]),0) AS CNSS, nz(Sum([Frais_de_banque.montant_TTC]),0) AS FraisBq, nz(Sum([Honoraires_associés.montant_TTC]),0) AS Honorass, nz(Sum([Honoraires_extra_groupe.montant_TTC]),0) AS Honorex, nz(Sum([Honoraires_intra_groupe.montant_TTC]),0) AS Honorint, nz(Sum([Loyer.montant_TTC]),0) AS loyer, nz(Sum([lydec.montant_TTC]),0) AS lydec, nz(Sum([Notes_de_frais_autres.montant_TTC]),0) AS NFb, nz(Sum([notes_de_frais_carte_bleue.montant_TTC]),0) AS NFa, nz(Sum([Salaires_employés.montant_TTC]),0) AS Sem, nz(Sum([Téléphone.montant_TTC]),0) AS Tel, nz(Sum([Voitures.montant_TTC]),0) AS voitures, nz(Sum([IR.montant_TTC]),0) AS IR, nz(Sum([CIMR.montant_TTC]),0) AS CIMR
FROM ((((((((((((((((((SELECT DateSerial(Année,Mois,Tjours.jour) AS DateJour FROM (SELECT top 1 1 AS jour FROM Facture_clients union SELECT top 1 2 FROM Facture_clients union SELECT top 1 3 FROM Facture_clients union SELECT top 1 4 FROM Facture_clients union SELECT top 1 5 FROM Facture_clients union SELECT top 1 6 FROM Facture_clients union SELECT top 1 7 FROM Facture_clients union SELECT top 1 8 FROM Facture_clients union SELECT top 1 9 FROM Facture_clients union SELECT top 1 10 FROM Facture_clients union SELECT top 1 11 FROM Facture_clients union SELECT top 1 12 FROM Facture_clients union SELECT top 1 13 FROM Facture_clients union SELECT top 1 14 FROM Facture_clients union SELECT top 1 15 FROM Facture_clients union SELECT top 1 16 FROM Facture_clients union SELECT top 1 17 FROM Facture_clients union SELECT top 1 18 FROM Facture_clients union SELECT top 1 19 FROM Facture_clients union SELECT top 1 20 FROM Facture_clients union SELECT top 1 21 FROM Facture_clients union SELECT top 1 22 FROM Facture_clients union SELECT top 1 23 FROM Facture_clients union SELECT top 1 24 FROM Facture_clients union SELECT top 1 25 FROM Facture_clients union SELECT top 1 26 FROM Facture_clients union SELECT top 1 27 FROM Facture_clients union SELECT top 1 28 FROM Facture_clients union SELECT top 1 29 FROM Facture_clients union SELECT top 1 30 FROM Facture_clients union SELECT top 1 31 FROM Facture_clients) AS Tjours WHERE Month(DateSerial(Année,Mois,TJours.jour))=Mois) AS RJours LEFT JOIN Facture_clients ON RJours.DateJour=Facture_clients.date_reglement) LEFT JOIN facture_fournisseurs ON RJours.DateJour=facture_fournisseurs.date_reglement) LEFT JOIN CNSS ON RJours.DateJour=CNSS.date_reglement) LEFT JOIN Frais_de_banque ON RJours.DateJour=Frais_de_banque.date_reglement) LEFT JOIN Honoraires_associés ON RJours.DateJour=Honoraires_associés.date_reglement) LEFT JOIN Honoraires_extra_groupe ON RJours.DateJour=Honoraires_extra_groupe.date_reglement) LEFT JOIN Honoraires_intra_groupe ON RJours.DateJour=Honoraires_intra_groupe.date_reglement) LEFT JOIN Loyer ON RJours.DateJour=Loyer.date_reglement) LEFT JOIN Lydec ON RJours.DateJour=Lydec.date_reglement) LEFT JOIN Notes_de_frais_autres ON RJours.DateJour=Notes_de_frais_autres.date_reglement) LEFT JOIN Notes_de_frais_carte_bleue ON RJours.DateJour=Notes_de_frais_carte_bleue.date_reglement) LEFT JOIN Téléphone ON RJours.DateJour=Téléphone.date_reglement) LEFT JOIN Salaires_employés ON RJours.DateJour=Salaires_employés.date_reglement) LEFT JOIN Voitures ON RJours.DateJour=Voitures.date_reglement) LEFT JOIN detail_paie_C ON RJours.DateJour=detail_paie_C.Date_reglement) LEFT JOIN detail_paie_F ON RJours.DateJour=detail_paie_F.Date_reglement) LEFT JOIN CIMR ON RJours.DateJour=CIMR.date_reglement) LEFT JOIN IR ON RJours.DateJour=IR.date_reglement
GROUP BY RJours.DateJour
ORDER BY RJours.DateJour; |
Partager