Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Task_RunTareaEventual
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/*INSERTAR TXT DE EMPLEADOS */
DECLARE @vidreg int
DECLARE @vcreated datetime
DECLARE @vvisible bit
DECLARE @vremtot decimal(15,4)
DECLARE @vremimp decimal(15,4)
DECLARE @vperiodo int
DECLARE @vcuit varchar(20)
DECLARE @vcuil varchar(20)
DECLARE @vCounter INT =0
DECLARE @vinternalCounter INT =1
/*AVERIGUAMOS LA CANTIDAD DE CICLOS */
select @vCounter = count(idreg) / 1000 from nominas_txt
WHILE (@vinternalCounter < @vCounter)
begin
DECLARE C_TerminosTask CURSOR FOR
select top 1000 cuil,CUIT as cuit,convert(int,PERIODO) as periodo,convert(decimal(15,4),cuil_remun_total) as remimp,convert(decimal(15,4),cuil_remun_total) as remtot,1 as visible,getdate() as created
,idreg from nominas_txt where periodo != '' and isnull(procesado,0) = 0 and periodo in (2410)
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated,@vidreg
WHILE @@fetch_status = 0
BEGIN
begin
insert into empleados (cuil,cuit,periodo,remimp,remtot,visible,created)
values (@vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated)
update nominas_txt set procesado = 1 where idreg =@vidreg
WAITFOR DELAY '00:00:00:500';
end
FETCH NEXT FROM C_TerminosTask INTO @vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated,@vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
set @vinternalCounter = @vinternalCounter + 1
/*set @vinternalCounter = 100000000*/
end
RETURN
/*FIN INSERTAR TXT DE EMPLEADOS */
/* PARA DEPURAR CENDEU
exec CENDEU_DEPURAR
return
*/
-- select count(*) from chequesBCRA where visible = 0 -- select 9748079 - 9687646
-- select count(*) from chequesBCRA where visible = 1 --9120330
/* PARA DEPURAR CHEQUESBCRA */
--DECLARE @vidreg int
DECLARE C_TerminosTask CURSOR FOR
select count(id_cheque) / 10000 from chequesBCRA where visible = 0
/*select top 100000 id_cheque from chequesBCRA where visible = 0*/
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vidreg
WHILE @@fetch_status = 0
BEGIN
DECLARE @Counter INT
SET @Counter=0
WHILE (@Counter <= @vidreg)
begin
delete ChequesBCRA where id_cheque in (select top 10000 id_cheque from chequesBCRA where visible = 0)
set @Counter = @Counter + 1
WAITFOR DELAY '00:00:03:000';
end
FETCH NEXT FROM C_TerminosTask INTO @vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
return
/*
DECLARE @vidreg int
DECLARE C_TerminosTask CURSOR FOR
/*
select count(idrow) from PANEL_CONTROL_JSON where cliente = 515494256 or visible=0
select count(idrow) from PANEL_CONTROL_JSON_dEpU where visible=1
*/
/*select top 100000 idrow from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte*/
select count(idrow) / 100000 from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0)
--select idrow from PANEL_CONTROL_JSON where cliente = 515494256
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vidreg
WHILE @@fetch_status = 0
BEGIN
DECLARE @Counter INT
SET @Counter=0
WHILE (@Counter <= @vidreg)
begin
/*delete PANEL_CONTROL_JSON where idrow = @vidreg*/
/*select @Counter as cont,@vidreg as idreg*/
delete PANEL_CONTROL_JSON where idrow in (
select top 100000 idrow from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0))
set @Counter = @Counter + 1
WAITFOR DELAY '00:00:03:000';
end
FETCH NEXT FROM C_TerminosTask INTO @vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
*/
/*
delete PANEL_CONTROL_JSON where idrow in (select top 100000 idrow from PANEL_CONTROL_JSON where cliente in ( select distinct C.cliente
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0
) and visible=0)
*/
/*
1122949280
1108550898
exec sp_procesos_cuits_homonimos_sociedades
exec sp_procesos_cuits_homonimos
*/
/*
select COUNT(distinct cuit) from procesos_cuit_edictos_homonimos
select COUNT(distinct cuit) from procesos_cuit_juicios_homonimos
*/
END
GO
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Task_RunTareaEventual
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/*INSERTAR TXT DE EMPLEADOS */
DECLARE @vidreg int
DECLARE @vcreated datetime
DECLARE @vvisible bit
DECLARE @vremtot decimal(15,4)
DECLARE @vremimp decimal(15,4)
DECLARE @vperiodo int
DECLARE @vcuit varchar(20)
DECLARE @vcuil varchar(20)
DECLARE @vCounter INT =0
DECLARE @vinternalCounter INT =1
/*AVERIGUAMOS LA CANTIDAD DE CICLOS */
select @vCounter = count(idreg) / 1000 from nominas_txt
WHILE (@vinternalCounter < @vCounter)
begin
DECLARE C_TerminosTask CURSOR FOR
select top 1000 cuil,CUIT as cuit,convert(int,PERIODO) as periodo,convert(decimal(15,4),cuil_remun_total) as remimp,convert(decimal(15,4),cuil_remun_total) as remtot,1 as visible,getdate() as created
,idreg from nominas_txt where periodo != '' and isnull(procesado,0) = 0 and periodo in (2410)
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated,@vidreg
WHILE @@fetch_status = 0
BEGIN
begin
insert into empleados (cuil,cuit,periodo,remimp,remtot,visible,created)
values (@vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated)
update nominas_txt set procesado = 1 where idreg =@vidreg
WAITFOR DELAY '00:00:00:500';
end
FETCH NEXT FROM C_TerminosTask INTO @vcuil,@vcuit,@vperiodo,@vremimp,@vremtot,@vvisible,@vcreated,@vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
set @vinternalCounter = @vinternalCounter + 1
/*set @vinternalCounter = 100000000*/
end
RETURN
/*FIN INSERTAR TXT DE EMPLEADOS */
/* PARA DEPURAR CENDEU
exec CENDEU_DEPURAR
return
*/
-- select count(*) from chequesBCRA where visible = 0 -- select 9748079 - 9687646
-- select count(*) from chequesBCRA where visible = 1 --9120330
/* PARA DEPURAR CHEQUESBCRA */
--DECLARE @vidreg int
DECLARE C_TerminosTask CURSOR FOR
select count(id_cheque) / 10000 from chequesBCRA where visible = 0
/*select top 100000 id_cheque from chequesBCRA where visible = 0*/
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vidreg
WHILE @@fetch_status = 0
BEGIN
DECLARE @Counter INT
SET @Counter=0
WHILE (@Counter <= @vidreg)
begin
delete ChequesBCRA where id_cheque in (select top 10000 id_cheque from chequesBCRA where visible = 0)
set @Counter = @Counter + 1
WAITFOR DELAY '00:00:03:000';
end
FETCH NEXT FROM C_TerminosTask INTO @vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
return
/*
DECLARE @vidreg int
DECLARE C_TerminosTask CURSOR FOR
/*
select count(idrow) from PANEL_CONTROL_JSON where cliente = 515494256 or visible=0
select count(idrow) from PANEL_CONTROL_JSON_dEpU where visible=1
*/
/*select top 100000 idrow from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte*/
select count(idrow) / 100000 from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0)
--select idrow from PANEL_CONTROL_JSON where cliente = 515494256
OPEN C_TerminosTask
FETCH NEXT FROM C_TerminosTask INTO @vidreg
WHILE @@fetch_status = 0
BEGIN
DECLARE @Counter INT
SET @Counter=0
WHILE (@Counter <= @vidreg)
begin
/*delete PANEL_CONTROL_JSON where idrow = @vidreg*/
/*select @Counter as cont,@vidreg as idreg*/
delete PANEL_CONTROL_JSON where idrow in (
select top 100000 idrow from PANEL_CONTROL_JSON where contraparte in (select distinct C.contraparte
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0))
set @Counter = @Counter + 1
WAITFOR DELAY '00:00:03:000';
end
FETCH NEXT FROM C_TerminosTask INTO @vidreg
END
CLOSE C_TerminosTask
DEALLOCATE C_TerminosTask
*/
/*
delete PANEL_CONTROL_JSON where idrow in (select top 100000 idrow from PANEL_CONTROL_JSON where cliente in ( select distinct C.cliente
from LN_contrapartes C
inner join LN_gestiones G on (G.contraparte = C.contraparte and G.vigente = 1)
inner join ln_contraparte_familias CF on (CF.contraparte = C.contraparte and isnull(CF.activo,1) = 1)
inner join ln_familias F on (F.familia = CF.familia and isnull(F.visible,1) = 1)
inner join clientes CL on (CL.cliente = C.cliente and CL.estado_cliente='A')
inner join clientes_productos CP on (CP.cliente = C.cliente and CP.id_producto = 47 and CP.activo = 1 and CP.no_queue != 1)
where C.activo = 1 and C.servicio_contratado = 47 and C.subcontratista=0
) and visible=0)
*/
/*
1122949280
1108550898
exec sp_procesos_cuits_homonimos_sociedades
exec sp_procesos_cuits_homonimos
*/
/*
select COUNT(distinct cuit) from procesos_cuit_edictos_homonimos
select COUNT(distinct cuit) from procesos_cuit_juicios_homonimos
*/
END
GO
Depends On
2Used By
No items found