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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| SELECT
LigneCommande.IDLigneCommande AS IDLigneCommande,
LigneCommande.NumeroLigneCommande AS NumeroLigneCommande,
Commande.IDCommande AS IDCommande,
Commande.NumeroCommande AS NumeroCommande,
Commande.Date AS Commande_Date,
C2.RaisonSociale AS RaisonSociale_ClientLivre,
C1.RaisonSociale AS RaisonSociale_ClientFacture,
Affaire.IDAffaire AS IDAffaire,
Type_Affaire.Libellé AS Type_Affaire_Libelle,
Besoin_Machine.IDBesoin_Machine AS IDBesoin_Machine,
Besoin_Modele.Date_Prev_Livraison AS Date_Prev_Livraison,
LigneCommande.TypeModele AS TypeModele,
LigneCommande.Modele AS Modele,
Configuration.Libellé AS Configuration_Libelle,
Sourcing.Libellé AS Sourcing_Libelle,
LigneCommande.Date_SU_Previsionnelle AS Date_SU_Previsionnelle,
LigneCommande.Date_SU_Reelle AS Date_SU_Reelle,
LigneCommande.Numero_MSO AS Numero_MSO,
LigneCommande.Numero_Serie AS Numero_Serie,
LigneCommande.Numero_Sourcing AS Numero_Sourcing,
LigneCommande.SendAfter AS SendAfter,
LigneCommande.SendBefore AS SendBefore,
LigneCommande.Date_SU_Demandee AS Date_SU_Demandee,
LigneCommande.DealerCode AS DealerCode,
LigneCommande.NumeroReservation AS NumeroReservation,
LigneCommande.SPAR_Upfront_Numero AS SPAR_Upfront_Numero,
LigneCommande.SPAR_Upfront_Pourcentage AS SPAR_Upfront_Pourcentage,
LigneCommande.SPAR_Numero AS SPAR_Numero,
LigneCommande.SPAR_Pourcentage AS SPAR_Pourcentage,
LigneCommande.MarketingPlan_Numero AS MarketingPlan_Numero,
LigneCommande.PositionAutreDealer_DealerCode AS PositionAutreDealer_DealerCode,
LigneCommande.PositionAutreDealer_NumeroMSO AS PositionAutreDealer_NumeroMSO,
LigneCommande.Commentaires_OrdreCommande AS Commentaires_OrdreCommande,
LigneCommande.FicheConfiguration AS FicheConfiguration,
LigneCommande.FicheConfiguration_Chemin AS FicheConfiguration_Chemin,
Statut_Attribution.Libellé AS Statut_Attribution_Libelle,
Affaire.Incoterms + ' ' + Affaire.Incoterms_Destination AS Incoterms,
Statut_Avancement_Administratif.Libellé AS Statut_Avancement_Administratif_Libelle,
Besoin_Modele.IDBesoin_Modele AS IDBesoin_Modele,
LigneCommandeParent.NumeroLigneCommande AS NumeroLigneCommande_Parent,
Statut_Localisation.Libellé AS Statut_Localisation_Libelle,
LigneCommande.Lieu AS Lieu,
Facture_Magellan.NumeroFacture AS Facture_Magellan_NumeroFacture,
Facture_Magellan.DateFacture AS Facture_Magellan_DateFacture,
Facture_Fournisseur.NumeroFacture AS Facture_Fournisseur_NumeroFacture,
Facture_Fournisseur.DateFacture AS Facture_Fournisseur_DateFacture
FROM
LigneCommande INNER JOIN Commande ON
LigneCommande.IDCommande = Commande.IDCommande,
LigneCommande INNER JOIN Statut_Avancement_Administratif ON
LigneCommande.IDStatut_Avancement_Administratif = Statut_Avancement_Administratif.IDStatut_Avancement_Administratif,
LigneCommande INNER JOIN Statut_Localisation ON
LigneCommande.IDStatut_Localisation = Statut_Localisation.IDStatut_Localisation,
LigneCommande LEFT OUTER JOIN Attribution ON
LigneCommande.IDAttribution = Attribution.IDAttribution,
Attribution LEFT OUTER JOIN Besoin_Machine ON
Attribution.IDAttribution = Besoin_Machine.IDAttribution,
Attribution LEFT OUTER JOIN Statut_Attribution ON
Attribution.IDStatutAttribution = Statut_Attribution.IDStatutAttribution,
Besoin_Machine LEFT OUTER JOIN Besoin_Modele ON
Besoin_Machine.IDBesoin_Modele = Besoin_Modele.IDBesoin_Modele,
Besoin_Modele LEFT OUTER JOIN Affaire ON
Besoin_Modele.IDAffaire = Affaire.IDAffaire,
Affaire LEFT OUTER JOIN Type_Affaire ON
Affaire.IDType_Affaire = Type_Affaire.IDType_Affaire,
LigneCommande LEFT OUTER JOIN Configuration ON
LigneCommande.IDConfiguration = Configuration.IDConfiguration,
LigneCommande LEFT OUTER JOIN Sourcing ON
LigneCommande.Numero_Sourcing = Sourcing.Numero_Sourcing,
Affaire LEFT OUTER JOIN Client C2 ON
Affaire.Client_Livre_Numero = C2.NumeroClient,
Affaire LEFT OUTER JOIN Client C1 ON
Affaire.Client_Facture_Numero = C1.NumeroClient,
LigneCommande LEFT OUTER JOIN LigneCommande LigneCommandeParent ON
LigneCommande.IDLigneCommande_Parent = LigneCommandeParent.IDLigneCommande,
LigneCommande LEFT OUTER JOIN Facture_Magellan ON
LigneCommande.IDFacture_Magellan = Facture_Magellan.IDFacture_Magellan,
Commande LEFT OUTER JOIN Facture_Fournisseur ON
Commande.IDFacture_Fournisseur = Facture_Fournisseur.IDFacture_Fournisseur |
Partager