Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN
- declare v_cant int;
- declare v_monto DOUBLE;
- declare v_idgiro int;
- SET v_monto = 0;
- -- Obtener el idgiro del puesto
- select p.idgiro into v_idgiro
- from p_puesto p
- where p.idpuesto = vidpuesto;
- -- Verificar si el puesto tiene el servicio activo
- select count(*) INTO v_cant
- from p_puesto_servicio ps
- where ps.idservicio = 3
- and ps.idpuesto = vidpuesto
- and ps.activo = 1;
- if v_cant > 0 THEN
- -- Evaluar idgiro y asignar los valores correspondientes
- select
- CASE
- WHEN v_idgiro IN (2, 6, 9) THEN 13
- ELSE 8
- END into v_monto
- from g_recibo_cargos gc
- where idconcepto = 7
- and periodo = vperiodo;
- end if;
- RETURN v_monto;
- END;
Add Comment
Please, Sign In to add comment