1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Select his.NOM_MAT,ma.lib_mat,his.dat_mvt_reel,his.TYP_MVT,his.sens_mvt,his.QTE_MVT,
case
when pri.code_mon_tenu ='MAD' then pri.prix_ind/10000
when pri.code_mon_tenu ='EUR' then pri.prix_ind/10000 * '" + euro.Text + "'
when pri.code_mon_tenu ='DOL' then pri.prix_ind/10000 * '" + dolard.Text + "'
end as prix_en_Mad ,
case
when pri.code_mon_tenu ='MAD' then pri.prix_ind/10000 * his.qte_mvt
when pri.code_mon_tenu ='EUR' then pri.prix_ind/10000 * '" + euro.Text + "' * his.qte_mvt
when pri.code_mon_tenu ='DOL' then pri.prix_ind/10000 * '" + dolard.Text + "' * his.qte_mvt
end as Total ,
pri.code_mon_tenu From COMP_HIS his left join comp_prix_std pri on his.nom_mat=pri.nom_mat and his.code_colb=pri.code_colb and nvl(his.nom_tail,'0')=nvl(pri.nom_tail,'0') left join matiere ma on his.nom_mat=ma.nom_mat
Where his.CODE_MAGM='" + cro.Text + "' and his.DAT_MVT_REEL between '" + DateTimePicker1.Value.Date + "'and '" + DateTimePicker2.Value.Date + "'
and his.typ_mvt='" + mouvement.Text + "' and his.sens_mvt= '" + entresor.Text + "' and (( (select distinct max(date_eff) from comp_prix_std where nom_mat=his.nom_mat and code_colb=his.code_colb and nvl(nom_tail,'0')=nvl(his.nom_tail,'0')) )= pri.date_eff |