Script Comprobar Doc Tributario
Script Comprobar Doc Tributario
000085
@w_reg_g VARCHAR(20),
@w_opera INT,
@w_trami INT,
@w_tempo CHAR(1) = 'N',
@w_es_gr CHAR(1),
@w_tipo CHAR(1) = '1' -- 1: NRC, 2: diff
IF @w_tempo = 'S'
SELECT @w_opera = opt_operacion,
@w_trami = opt_tramite,
@w_es_gr = opt_grupal,
@w_reg_g = opt_ref_grupal
FROM ca_operacion_tmp
WHERE opt_banco = @w_banco
ELSE
SELECT @w_opera = op_operacion,
@w_trami = op_tramite,
@w_es_gr = op_grupal,
@w_reg_g = op_ref_grupal
FROM ca_operacion
WHERE op_banco = @w_banco
SELECT @w_trami
IF @w_es_gr = 'N'
BEGIN
IF @w_tempo = 'S'
SELECT * FROM ca_operacion_datos_adicionales_tmp WHERE odt_operacion =
@w_opera ORDER BY odt_operacion
ELSE
SELECT * FROM ca_operacion_datos_adicionales WHERE oda_operacion = @w_opera
ORDER BY oda_operacion
END
ELSE
BEGIN
IF @w_tempo = 'S'
SELECT t.* FROM ca_operacion_datos_adicionales_tmp t, ca_operacion
WHERE (op_banco = @w_banco
OR op_ref_grupal = @w_banco)
AND odt_operacion = op_operacion
ORDER BY odt_operacion
else
SELECT t.* FROM ca_operacion_datos_adicionales t, ca_operacion
WHERE (op_banco = @w_banco
OR op_ref_grupal = @w_banco)
AND oda_operacion = op_operacion
ORDER BY oda_operacion
END