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
/*
select * from domicilios_todos where cuit = '20225157937' and tipo_domicilio = 'E'
exec [actualizar_datos_con_padron] '20288662682'
select * from domicilios_todos where cuit = '20225157937' and tipo_domicilio = 'E'
select * from padron_electoral where documento = '22515793'
*/
/*
select * from consultar_afip where proceso = 'fallecidos202003' and isnull(procesado,0) = 0
*/
CREATE OR ALTER PROCEDURE dbo.AFIP_GET_BATCH_NOCTURNO_REVISAR
/*@p_cuit varchar(20),
@p_userid int = 0
*/
AS
BEGIN
SET NOCOUNT ON;
declare @top int
declare @top2 int
declare @proceso varchar(25) = 'LEDJUNIO2020'
/*
PARA CONTROL
declare @procesadosHoy int
declare @limiteDiario int = 39900
declare @limiteHoy int
declare @RestanHoy int
declare @TotalAProcesar int
declare @Avance money
declare @ProcesadosTotales int
declare @proceso varchar(25) = 'AEROPUERTOS'
select @procesadoshoy = count(*) from consultar_afip where procesado = 1 and convert(date,fecha_proceso) = convert(date,getdate())
select @RestanHoy= count(*) from consultar_afip where isnull(procesado,0) = 0 and proceso = @proceso
select @TotalAProcesar= count(*) from consultar_afip where proceso = @proceso
select @ProcesadosTotales= count(*) from consultar_afip where proceso = @proceso and isnull(procesado,0) = 1
set @limiteHoy = @limiteDiario-@procesadosHoy
set @Avance = (@ProcesadosTotales*100)/@TotalAProcesar
select @RestanHoy as RestanHoy,@limiteDiario as limiteDiario,@procesadosHoy as ProcesadosHoy,@limiteHoy as limiteHoy,@TotalAProcesar as TotalAProcesar,@Avance as Avance
*/
/*
select @top = count(*) from servicios_externos_cuits_consultados where fecha = convert(date,getdate())
select count(*) from consultar_afip where proceso = 'MONSANTO-REP'
aND procesado = 0
and ierror = 1
update consultar_afip set procesado=0,ierror = 0 where
procesado = 1
and proceso = 'MONSANTO-REP'
and ierror = 1
*/
select @top = count(*) from consultar_afip where procesado = 1 and convert(date,fecha_proceso) = convert(date,getdate())
set @top2=39900-@top
--select @top as ATOP,@top2 as TOP2
if (@top2 > 250)
BEGIN
SET @TOP2 = 250
END
if (@top2 < 0)
BEGIN
SET @TOP2 = 0
END
-- select @top as ATOP,@top2 as TOP2
select TOP (@top2) * from consultar_afip where isnull(procesado,0) = 0 and proceso = @proceso ORDER BY CUIT DESC,FECHA ASC
/*
select * from consultar_afip where isnull(procesado,0) = 0 and proceso = 'experta090120' ORDER BY CUIT DESC,FECHA ASC
*/
/*
select * from consultar_afip where fecha between '2018-08-16 00:00:00' and '2018-08-16 23:59:59' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11 and proceso = 'WORLDSYS14082018'
*/
/*select top 9000 * from consultar_afip where procesado = 0
--and fecha = '2019-07-14'
and fecha = convert(date,getdate())
and isnull(procesado,0)=0
AND LEN(RTRIM(RTRIM(cuit)))=11
/*
and proceso = 'ESTRELLA2'
*/
union
select top 9000 * from consultar_afip where procesado = 0
/*and fecha between '2018-08-16 00:00:00' and '2018-08-16 23:59:59' */
--and fecha = '2019-07-14'
and fecha = convert(date,getdate())
and isnull(procesado,0)=0
AND LEN(RTRIM(RTRIM(cuit)))=11
order by proceso desc
*/
/*
update consultar_afip set procesado=1,fecha_proceso=getdate()-1 where fecha = convert(date,getdate()-1) and proceso='ESTRELLA2'
*/
/*
and proceso = 'SYSWORLD'
insert into consultar_afip (proceso,cuit,fecha,procesado,fecha_proceso)
select top 11750 'HSBC' AS PROCESO,cuit,'2019-04-12' as fecha,0 as procesado,null as fecha_proceso from hsbc_temp_procesamiento order by cuit asc
*/
/* select top 15000 * from consultar_afip where proceso = 'WORLDSYS14082018' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11
*/
/*
update consultar_afip set fecha = '2018-08-16' where idreg in (
select top 15000 idreg from consultar_afip where proceso = 'WORLDSYS14082018' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11 and fecha = '2018-08-14'
)
*/
/*
select * from consultar_afip
WHERE FECHA = '2018-08-13'
AND PROCESO = 'MACRO TELEFONOS'
and procesado=0
*/
END
GO
GO
/*
select * from domicilios_todos where cuit = '20225157937' and tipo_domicilio = 'E'
exec [actualizar_datos_con_padron] '20288662682'
select * from domicilios_todos where cuit = '20225157937' and tipo_domicilio = 'E'
select * from padron_electoral where documento = '22515793'
*/
/*
select * from consultar_afip where proceso = 'fallecidos202003' and isnull(procesado,0) = 0
*/
CREATE OR ALTER PROCEDURE dbo.AFIP_GET_BATCH_NOCTURNO_REVISAR
/*@p_cuit varchar(20),
@p_userid int = 0
*/
AS
BEGIN
SET NOCOUNT ON;
declare @top int
declare @top2 int
declare @proceso varchar(25) = 'LEDJUNIO2020'
/*
PARA CONTROL
declare @procesadosHoy int
declare @limiteDiario int = 39900
declare @limiteHoy int
declare @RestanHoy int
declare @TotalAProcesar int
declare @Avance money
declare @ProcesadosTotales int
declare @proceso varchar(25) = 'AEROPUERTOS'
select @procesadoshoy = count(*) from consultar_afip where procesado = 1 and convert(date,fecha_proceso) = convert(date,getdate())
select @RestanHoy= count(*) from consultar_afip where isnull(procesado,0) = 0 and proceso = @proceso
select @TotalAProcesar= count(*) from consultar_afip where proceso = @proceso
select @ProcesadosTotales= count(*) from consultar_afip where proceso = @proceso and isnull(procesado,0) = 1
set @limiteHoy = @limiteDiario-@procesadosHoy
set @Avance = (@ProcesadosTotales*100)/@TotalAProcesar
select @RestanHoy as RestanHoy,@limiteDiario as limiteDiario,@procesadosHoy as ProcesadosHoy,@limiteHoy as limiteHoy,@TotalAProcesar as TotalAProcesar,@Avance as Avance
*/
/*
select @top = count(*) from servicios_externos_cuits_consultados where fecha = convert(date,getdate())
select count(*) from consultar_afip where proceso = 'MONSANTO-REP'
aND procesado = 0
and ierror = 1
update consultar_afip set procesado=0,ierror = 0 where
procesado = 1
and proceso = 'MONSANTO-REP'
and ierror = 1
*/
select @top = count(*) from consultar_afip where procesado = 1 and convert(date,fecha_proceso) = convert(date,getdate())
set @top2=39900-@top
--select @top as ATOP,@top2 as TOP2
if (@top2 > 250)
BEGIN
SET @TOP2 = 250
END
if (@top2 < 0)
BEGIN
SET @TOP2 = 0
END
-- select @top as ATOP,@top2 as TOP2
select TOP (@top2) * from consultar_afip where isnull(procesado,0) = 0 and proceso = @proceso ORDER BY CUIT DESC,FECHA ASC
/*
select * from consultar_afip where isnull(procesado,0) = 0 and proceso = 'experta090120' ORDER BY CUIT DESC,FECHA ASC
*/
/*
select * from consultar_afip where fecha between '2018-08-16 00:00:00' and '2018-08-16 23:59:59' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11 and proceso = 'WORLDSYS14082018'
*/
/*select top 9000 * from consultar_afip where procesado = 0
--and fecha = '2019-07-14'
and fecha = convert(date,getdate())
and isnull(procesado,0)=0
AND LEN(RTRIM(RTRIM(cuit)))=11
/*
and proceso = 'ESTRELLA2'
*/
union
select top 9000 * from consultar_afip where procesado = 0
/*and fecha between '2018-08-16 00:00:00' and '2018-08-16 23:59:59' */
--and fecha = '2019-07-14'
and fecha = convert(date,getdate())
and isnull(procesado,0)=0
AND LEN(RTRIM(RTRIM(cuit)))=11
order by proceso desc
*/
/*
update consultar_afip set procesado=1,fecha_proceso=getdate()-1 where fecha = convert(date,getdate()-1) and proceso='ESTRELLA2'
*/
/*
and proceso = 'SYSWORLD'
insert into consultar_afip (proceso,cuit,fecha,procesado,fecha_proceso)
select top 11750 'HSBC' AS PROCESO,cuit,'2019-04-12' as fecha,0 as procesado,null as fecha_proceso from hsbc_temp_procesamiento order by cuit asc
*/
/* select top 15000 * from consultar_afip where proceso = 'WORLDSYS14082018' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11
*/
/*
update consultar_afip set fecha = '2018-08-16' where idreg in (
select top 15000 idreg from consultar_afip where proceso = 'WORLDSYS14082018' and isnull(procesado,0)=0 AND LEN(RTRIM(RTRIM(cuit)))=11 and fecha = '2018-08-14'
)
*/
/*
select * from consultar_afip
WHERE FECHA = '2018-08-13'
AND PROCESO = 'MACRO TELEFONOS'
and procesado=0
*/
END
GO
Depends On
1Used By
No items found