1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
SELECT
Facture.NumPro AS NumPro,
Facture.CodeMvt AS CodeMvt,
Facture.Avoir AS Avoir,
Facture.TypeClient AS TypeClient,
Facture.RsNom AS NomPrenom,
Facture.NomVendeur AS NomVendeur,
Facture.CleRS AS Rs,
Facture.DateFact AS DateFact,
Facture.DateBC AS DateBC,
Facture.TotalFacture AS TotalFacture,
FactDet.VenteTotHT AS VenteTotHT,
FactDet.TvaVente AS TvaVente,
FactDet.VenteTotTTC AS VenteTotTTC,
FactDet.VECLEUNIK AS VECLEUNIK,
Vehicule.NumLivPol AS NumLivPol,
Vehicule.RefDossier AS RefDossier,
Vehicule.NumImmat AS NumImmat,
Vehicule.VOVN AS VOVN,
Vehicule.Marque AS Marque,
Vehicule.Modele AS Modele,
Vehicule.Provenance AS Provenance,
Vehicule.fournisseurve AS fournisseurve,
Vehicule.AchatHT AS AchatHT,
Vehicule.AchatTTC AS AchatTTC,
Vehicule.FraisRE AS FraisRE,
Vehicule.FraisDivers AS FraisDivers,
Vehicule.FraisGarantie AS FraisGarantie,
Vehicule.MargeBrute AS MargeBrute,
Vehicule.MargeNette AS MargeNette,
Vehicule.GarantieAss AS GarantieAss,
Vehicule.CoutGarantie AS CoutGarantie,
Vehicule.MargeFinale AS MargeFinale,
Vehicule.DateStock AS DateStock,
Vehicule.DateVente AS DateVente
FROM
Client RIGHT OUTER JOIN Facture ON Client.CleRS = Facture.CleRS,
Facture INNER JOIN FactDet ON Facture.NumPro = FactDet.NumPro,
Vehicule INNER JOIN FactDet ON Vehicule.VECLEUNIK = FactDet.VECLEUNIK
WHERE
(
Facture.Vendu = 1
AND Facture.DateVente >= {pDateDebut}
AND Facture.DateVente <= {pDateFin}
AND FactDet.TypeLigne = 1
AND FactDet.AvecTvaVente = {pTVA}
AND Facture.NomVendeur = {pVendeur}
AND Facture.TypeClient = {pTypeClient}
AND Facture.TypeClient <= {pTypeFrance}
AND Facture.Particulier = {pParticulier}
AND Facture.ProvAcheteur = {pSource}
AND Facture.CleRS LIKE %{pRSContient}%
AND Facture.CleRS LIKE {pRSDebut}%
AND Facture.CleRS = {pRSEgal}
AND Vehicule.VOVN = {pVOVN}
AND Vehicule.Marque = {pMarque}
AND Vehicule.Parc = {pParc}
AND Vehicule.Provenance = {pProvenance}
AND Vehicule.fournisseurve = {pFournisseur}
AND Vehicule.fournisseurve LIKE {pFourDebut}%
AND Vehicule.fournisseurve LIKE %{pFourContient}%
AND Vehicule.DestSortie = {pDestSortie}
AND Client.Famille = {pFamille}
)
ORDER BY
NumLivPol ASC,
VECLEUNIK ASC,
NumPro ASC |
Partager