SELECT A.ID_AN_CDE_FOUR AS ID_AN_CDE_FOUR,
A.ID_LIG_CDE_FOUR,
A.SA_DATE_DEM,
A.SA_DATE_CONF,
A.JOUR_LIV_PREV,
A.REMARQUE,
A.ETAT_CONFIRMATION,
A.REFERENCE_FOUR,
A.SOLDE,
B.MARCHE_GLOBAL - (ISNULL((SELECT SUM(C.QTE_LIVREE) FROM V_LIGCDEFOUR AS C
WHERE C.ID_AN_CDE_FOUR = B.ID_AN_CDE_FOUR AND C.SOLDE <= 0 ),0)) AS SOLDE_MARCHE,
T_LIEULIVR.LIBELLE,
T_LIEULIVR.ADRESSE1,
T_LIEULIVR.ADRESSE2
FROM V_LIGCDEFOUR A INNER JOIN CDEFOUR B ON A.ID_AN_CDE_FOUR = B.ID_AN_CDE_FOUR
INNER JOIN T_LIEULIVR ON T_LIEULIVR.ID_T_LIEU_LIVR = B.ID_T_LIEU_LIVR
WHERE A.ID_ARTICLE = :ID_ARTICLE
AND B.ID_COND_FOUR_DEV = :ID_COND_FOUR_DEV
AND ((A.SA_DATE_DEM = :W0)
OR (A.SA_DATE_DEM = :W1)
OR (A.SA_DATE_DEM = :W2)
OR (A.SA_DATE_DEM = :W3)
OR (A.SA_DATE_DEM = :W4)
OR (A.SA_DATE_DEM = :W5)
OR (A.SA_DATE_DEM = :W6)
OR (A.SA_DATE_DEM = :W7)
OR (A.SA_DATE_DEM = :W8)
OR (A.SA_DATE_DEM = :W9)
OR (A.SA_DATE_DEM = :W10)
OR (A.SA_DATE_DEM = :W11))
Partager