1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
SELECT BO_Clients.Siret_client AS Siret_client,
BO_Employes.Numero_employe AS Numero_employe,
BO_Articles.Reference_article AS Reference_article,
DIM_TEMPS.id_temps AS id_temps,
sum(BO_Lignes_de_facture.Quantite_vendue) AS Nombre_de_Vente,
BO_Receptions.Cout_d_achat_ht + BO_Receptions.Cout_d_achat_ht * BO_Receptions.Taux_de_tva_reception AS CA_TTC_hors_frais_port
FROM BO_Articles , BO_Clients , BO_Conditions_de_vente , BO_Employes , BO_Factures , BO_Lignes_de_facture, BO_receptions, DIM_TEMPS
WHERE BO_Employes.Numero_employe = BO_factures.Numero_employe
AND BO_Clients.Siret_client = BO_Factures.Siret_client
AND BO_Factures.Numero_facture = BO_Lignes_de_facture.Numero_facture
AND BO_Lignes_de_facture.Reference_article = BO_Conditions_de_vente.reference_article
AND BO_Lignes_de_facture.Date_condition_de_vente = BO_Conditions_de_vente.Date_condition_de_vente
AND BO_Receptions.Reference_article = BO_Articles.Reference_Article
AND BO_Articles.Reference_article = BO_Conditions_de_vente.Reference_article
And Cstr(YEAR(BO_Lignes_de_facture.Date_condition_de_vente))=ANNEE
And Cstr(DatePart("q",[BO_Lignes_de_facture.Date_condition_de_vente]))=trimestre
And Cstr(MONTH(BO_Lignes_de_facture.Date_condition_de_vente))=MOIS
And Cstr(DatePart("ww",[BO_Lignes_de_facture.Date_condition_de_vente]))=SEMAINE
GROUP BY BO_Clients.Siret_client, Bo_Employes.Numero_employe, BO_Articles.Reference_article, DIM_TEMPS.id_temps, (BO_Receptions.Cout_d_achat_ht+BO_Receptions.Cout_d_achat_ht*BO_Receptions.Taux_de_tva_reception); |
Partager