Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION hbs_obter_valor_atendimento( nr_atendimento_p NUMBER)
- RETURN NUMBER IS
- -- 09-10-2019 - função criada para indentificar a receita de um atendimento. Gabriela Colonetti
- vl_procedimento_w NUMBER (15,2);
- vl_material_w NUMBER (15,2);
- vl_resultado_w NUMBER (15,2);
- BEGIN
- SELECT SUM (a.vl_procedimento)
- INTO vl_procedimento_w
- FROM tasy.procedimento_paciente a join conta_paciente b ON a.nr_interno_conta = b.nr_interno_conta
- WHERE a.nr_atendimento = nr_atendimento_p
- AND a.cd_motivo_exc_conta IS NULL
- AND ((a.nr_seq_proc_pacote <> a.nr_sequencia) OR (a.nr_seq_proc_pacote IS NULL))AND b.ie_cancelamento IS NULL;
- SELECT SUM (a.vl_material)
- INTO vl_material_w
- FROM tasy.material_atend_paciente a join conta_paciente b ON a.nr_interno_conta = b.nr_interno_conta
- WHERE a.nr_atendimento = nr_atendimento_p
- AND a.cd_motivo_exc_conta IS NULL;
- vl_resultado_w := vl_procedimento_w + vl_material_w;
- RETURN NVL(vl_resultado_w,0);
- END hbs_obter_valor_atendimento;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement