0% found this document useful (0 votes)
21 views2 pages

Script Comprobar Doc Tributario

The document declares variables and sets conditions to select data from different tables based on the values of the variables. It checks if the operation is for a group or individual, and selects the appropriate data from tables like cr_tramite, cr_tramite_grupal, ca_operacion_datos_adicionales_tmp, etc. based on whether the operation is for a group or individual and whether it is a temporary or permanent record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Script Comprobar Doc Tributario

The document declares variables and sets conditions to select data from different tables based on the values of the variables. It checks if the operation is for a group or individual, and selects the appropriate data from tables like cr_tramite, cr_tramite_grupal, ca_operacion_datos_adicionales_tmp, etc. based on whether the operation is for a group or individual and whether it is a temporary or permanent record.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

DECLARE @w_banco VARCHAR(20) = '00010001874', --SCGRENTES.1.23.

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 = 'S' AND @w_reg_g IS NULL


SELECT @w_es_gr = 'S'
ELSE
SELECT @w_es_gr = 'N'

IF @w_es_gr = 'N'
BEGIN

SELECT tr_numero_op, ie_ente, ie.*


FROM cob_credito..cr_tramite t, cobis..cl_ident_ente ie
WHERE tr_tramite = @w_trami
AND tr_cliente = ie_ente
ORDER BY t.tr_numero_op

SELECT tr_cod_actividad, se_codActEc, en_actividad, en_ente, *


FROM cob_credito..cr_tramite, cobis..cl_ente, cobis..cl_subactividad_ec
WHERE tr_tramite = @w_trami
AND tr_cliente = en_ente
and tr_cod_actividad = se_codigo

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

SELECT tr_numero_op, ie_ente, ie.*


FROM cob_credito..cr_tramite t, cob_credito..cr_tramite_grupal,
cobis..cl_ident_ente ie
WHERE tg_tramite = @w_trami
AND (tg_operacion = tr_numero_op)
AND tr_cliente = ie_ente
ORDER BY t.tr_numero_op

SELECT tr_numero_op, tr_cod_actividad, se_codActEc, en_actividad, en_ente,


t.*
FROM cob_credito..cr_tramite t, cob_credito..cr_tramite_grupal,
cobis..cl_ente, cobis..cl_subactividad_ec
WHERE tg_tramite = @w_trami
AND (tg_operacion = tr_numero_op)
AND tr_cliente = en_ente
and tr_cod_actividad = se_codigo
ORDER BY t.tr_numero_op

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

You might also like