Ir para conteúdo
Fórum Script Brasil

Marcio Rodrigues

Membros
  • Total de itens

    3
  • Registro em

  • Última visita

Tudo que Marcio Rodrigues postou

  1. Como criar um campo com soma do valor_fat e custo_medio? Desde já agradeço. select c.cd_atendimento atendimento, d.nm_paciente paciente, f.cd_produto, b.cd_pro_fat procedimento, e.ds_pro_fat ds_profat, --b.dt_lancamento data, sum(nvl(b.qt_lancamento,0)) qnt, round(avg(nvl(b.vl_unitario,0)),2) valor_fat, round(avg(nvl(g.vl_custo_medio * h.vl_fator,0)),2) custo_medio from reg_fat a, itreg_fat b, atendime c, paciente d, pro_fat e, produto f, ( select cm.cd_produto, cm.vl_custo_medio from custo_medio cm where cm.dh_custo_medio in (select max(a.dh_custo_medio) from dbamv.custo_medio a where cm.cd_produto = a.cd_produto ) )g, ( select cd_produto, vl_fator, seq from ( select un.cd_produto, un.vl_fator, row_number() over ( partition by un.cd_produto order by cu.cd_ordem) seq from dbamv.uni_pro un, dbamv.config_unidade cu where un.tp_relatorios = cu.tp_unidade and cu.cd_grupo = 1 ) where seq = 1 ) h where a.cd_reg_fat=b.cd_reg_fat and c.cd_atendimento=a.cd_atendimento and d.cd_paciente=c.cd_paciente and e.cd_pro_fat=b.cd_pro_fat and f.cd_produto=g.cd_produto and f.cd_pro_fat=b.cd_pro_fat(+) and f.cd_produto = h.cd_produto ---and f.sn_consignado = 'N' --and c.cd_atendimento= '260617' --and b.cd_pro_fat='08019208' group by c.cd_atendimento, d.nm_paciente, f.cd_produto, b.cd_pro_fat, e.ds_pro_fat order by procedimento Marcio Rodrigues Coordenador de T.I Hospital Pronto Cardio
  2. Como criar um campo com soma do valor_fat e custo_medio? Desde já agradeço. select c.cd_atendimento atendimento, d.nm_paciente paciente, f.cd_produto, b.cd_pro_fat procedimento, e.ds_pro_fat ds_profat, --b.dt_lancamento data, sum(nvl(b.qt_lancamento,0)) qnt, round(avg(nvl(b.vl_unitario,0)),2) valor_fat, round(avg(nvl(g.vl_custo_medio * h.vl_fator,0)),2) custo_medio from reg_fat a, itreg_fat b, atendime c, paciente d, pro_fat e, produto f, ( select cm.cd_produto, cm.vl_custo_medio from custo_medio cm where cm.dh_custo_medio in (select max(a.dh_custo_medio) from dbamv.custo_medio a where cm.cd_produto = a.cd_produto ) )g, ( select cd_produto, vl_fator, seq from ( select un.cd_produto, un.vl_fator, row_number() over ( partition by un.cd_produto order by cu.cd_ordem) seq from dbamv.uni_pro un, dbamv.config_unidade cu where un.tp_relatorios = cu.tp_unidade and cu.cd_grupo = 1 ) where seq = 1 ) h where a.cd_reg_fat=b.cd_reg_fat and c.cd_atendimento=a.cd_atendimento and d.cd_paciente=c.cd_paciente and e.cd_pro_fat=b.cd_pro_fat and f.cd_produto=g.cd_produto and f.cd_pro_fat=b.cd_pro_fat(+) and f.cd_produto = h.cd_produto ---and f.sn_consignado = 'N' --and c.cd_atendimento= '260617' --and b.cd_pro_fat='08019208' group by c.cd_atendimento, d.nm_paciente, f.cd_produto, b.cd_pro_fat, e.ds_pro_fat order by procedimento Marcio Rodrigues Coordenador de T.I Hospital Pronto Cardio
  3. Como criar um campo com soma do valor_fat e custo_medio? Desde já agradeço. select c.cd_atendimento atendimento, d.nm_paciente paciente, f.cd_produto, b.cd_pro_fat procedimento, e.ds_pro_fat ds_profat, --b.dt_lancamento data, sum(nvl(b.qt_lancamento,0)) qnt, round(avg(nvl(b.vl_unitario,0)),2) valor_fat, round(avg(nvl(g.vl_custo_medio * h.vl_fator,0)),2) custo_medio from reg_fat a, itreg_fat b, atendime c, paciente d, pro_fat e, produto f, ( select cm.cd_produto, cm.vl_custo_medio from custo_medio cm where cm.dh_custo_medio in (select max(a.dh_custo_medio) from dbamv.custo_medio a where cm.cd_produto = a.cd_produto ) )g, ( select cd_produto, vl_fator, seq from ( select un.cd_produto, un.vl_fator, row_number() over ( partition by un.cd_produto order by cu.cd_ordem) seq from dbamv.uni_pro un, dbamv.config_unidade cu where un.tp_relatorios = cu.tp_unidade and cu.cd_grupo = 1 ) where seq = 1 ) h where a.cd_reg_fat=b.cd_reg_fat and c.cd_atendimento=a.cd_atendimento and d.cd_paciente=c.cd_paciente and e.cd_pro_fat=b.cd_pro_fat and f.cd_produto=g.cd_produto and f.cd_pro_fat=b.cd_pro_fat(+) and f.cd_produto = h.cd_produto ---and f.sn_consignado = 'N' --and c.cd_atendimento= '260617' --and b.cd_pro_fat='08019208' group by c.cd_atendimento, d.nm_paciente, f.cd_produto, b.cd_pro_fat, e.ds_pro_fat order by procedimento Marcio Rodrigues Coordenador de T.I Hospital Pronto Cardio
×
×
  • Criar Novo...