Trab.feito

731 palavras 3 páginas
select DISTINCT ger_emp.emp_dsres as loja, vec_prop.prop_nrpedido, ger_cg.cg_nm, ve_nr = case when ger_ve.ve_nr is not null then ger_ve.ve_nr else 'FUTURO' end, tab_mod.mod_ds, fun_nmguerra = isnull((select fun_nmguerra from tab_fun(nolock) where tab_fun.fun_cd = vec_prop.fun_cd), tab_fun.fun_nmguerra), tab_fun_fun_nm = isnull((select tab_fun.fun_nm from tab_fun(nolock) where tab_fun.fun_cd = vec_prop.fun_cd), tab_fun.fun_nm), vec_prop.prop_vl, vec_prop.prop_dtaprl, vec_prop.prop_dtlibentrega, vec_prop.prop_funlibentrega, nm_libentrega = fun_lib_entrega.fun_nmguerra, vec_prop.prop_hrlibentrega, vec_prop.prop_dtaprc, ger_cg.cg_cd, vec_prop.prop_nr, ger_nfs.nf_dtemis, ger_nfs.est_cd, vec_prop.nf_nr as nf_nr, vec_prop.nf_serie as nf_serie, vec_prop.prop_nr, vec_prop.prop_dtentrega, vec_prop.prop_hrentrega, vec_prop.fun_entrega, nm_entrega = fun_entrega.fun_nmguerra, vec_prop.prop_preventrega, vec_prop.bp_ano, vec_prop.bp_nr, vec_prop.bp_item, vec_prop.fun_aprl, vec_vis.vis_cd, vec_prop.prop_hrpreventrega, vec_prop.fun_aprc, estoque = isnull( ( select max(tab_est.est_tp) from vec_vee(nolock), tab_est(nolock) where tab_est.est_cd = vec_vee.est_cd and vec_vee.ve_nr = ger_ve.ve_nr and vec_vee.me_dtsai is null and vec_vee.est_cd (select pm_valor from ger_pm where pm_id = 'PM_EST_VEICULOS_OFICINA')), isnull (( select max(tab_est.est_tp) from ger_nfs(nolock), tab_est(nolock) where tab_est.est_cd = ger_nfs.est_cd and vec_prop.nf_nr = ger_nfs.nf_nr and vec_prop.nf_serie = ger_nfs.nf_serie), 'VN') ), ger_ve.ve_chassi, ger_ve.ve_placa, ger_ve.uf_placa, (select fun_nmguerra from tab_fun(nolock) where tab_fun.fun_cd = ger_nfs.fun_vend) as fun_nmguerra_vend_nfs,

Relacionados

  • Trab.feitos
    2966 palavras | 12 páginas
  • Trab.feitos
    397 palavras | 2 páginas