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
CREATE OR ALTER PROCEDURE dbo.LN_Alta_Masiva_Blue
/* MARITA
faltan en ln_demo contrapartes 101 y 107
select c.country_code, f2.nombre_familia, f2.set_doc,
d.contraparte, d.gestion, d.visible, d.informe, d.id_dossier,
i.informe, i.fecha_ingreso, i.fecha_comprometida, i.fecha_inicio, i.fecha_entregado, i.estado_informe
from ln_gestiones g
inner join LN_contraparte_familias f on f.contraparte = g.contraparte
inner join LN_demo d on d.contraparte = g.contraparte and d.gestion = g.gestion
inner join LN_familias f2 on f2.familia = f.familia
inner join LN_contrapartes c on (c.contraparte = g.contraparte and c.subcontratista = 0)
inner join padrones p on p.id_padron = c.id_padron
left join informes i on (i.numero = p.identificacion and i.cliente = 5546348 and i.informe_padre is null and i.informe > 100640000)
where g.cliente = 5546348 and g.desde = '2023-04-12'
and f.contraparte in (101,107)
*/
/*
select * from informes where informe in (9925156) (9612000,1269675,1268189) or informe_padre in (9612000,1268189,1269675)
select * from ln_demo where informe in (1268189,1269675)
select * from ln_gestiones where
contraparte in (select contraparte from LN_contraparte_familias where familia in (385,386,389,390,391,392,397) and contraparte in (
select contraparte from ln_contrapartes where cliente = 5546348 and country_code = 'PY' and activo = 1))
and vigente = 1 and desde > '2021-04-20'
order by desde asc
/*
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000',
id_tipo_informe=4186979,
estado_informe='A' where informe in (8304427) and estado_informe!='I'
select * from ln_demo where informe in (1268189,1269675)
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000',
estado_informe='E' where informe_padre in (8304427) and estado_informe!='I'
*/
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',fecha_iniciado='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000'
where informe_padre is null and cliente = 5546348 and fecha_ingreso > '2021-05-06 17:21:34.260'
select * from informes where cliente = 5546348 and fecha_ingreso > '2021-05-06 17:21:34.260' and informe = 9612000 and id_tipo_informe=1578391
*/
AS
BEGIN
SET NOCOUNT ON;
declare @gest int, @contrap int ,@cuit varchar(20) ,@ident varchar(6)
--select * from informes where informe in (1342245,1157188)
--select * from ln_familias where cliente = 5546348 and familia not in (32,33,34,37,61,62,71,189,195,207)
DECLARE LEDALTAMASIVA Cursor
FOR
/*
select DISTINCT ln_gestiones.gestion,ln_gestiones.contraparte,padrones.identificacion,padrones.identificador/*,LN_GESTIONES.desde *//*,ln_demo.informe */
from ln_gestiones inner join ln_contrapartes on LN_gestiones.contraparte = ln_contrapartes.contraparte inner join padrones on ln_contrapartes.id_padron=padrones.id_padron
LEFT JOIN LN_DEMO ON LN_GESTIONES.GESTION = LN_DEMO.GESTION
/*left join informes on ln_demo.informe = informes.informe */
where ln_gestiones.contraparte in (select contraparte from LN_contraparte_familias where familia not in (32,33,34,37,61,62,71,189,195,207,120))
and LN_GESTIONES.CONTRAPARTE IN (select contraparte from ln_contrapartes where cliente = 5546348 and country_code = 'AR' and activo = 1 and servicio_contratado=47)
and LN_GESTIONES.vigente = 1
and LN_GESTIONES.desde > '2023-04-09' -- AND PADRONES.identificacion='33711028809'
--and LN_GESTIONES.contraparte = 96
AND LN_DEMO.GESTION IS not NULL
--and ln_demo.informe is null
--and ln_gestiones.contraparte not in (4315) and ln_gestiones.contraparte in (0)
order by contraparte asc
*/
/*
select TOP 100 IDENTIFICACION AS CUIT,IDENTIFICADOR from padrones where habilitado =1 and identificador in ('CUIT','CUIL') AND identificaCION in (
select distinct cuit from procesos_cuit
where cliente = 2046807993 and fecha = '2023-05-16' and len(cuit) = 11 and left(cuit,1) = '3'
union
select distinct cuit from procesos_cuit where cliente = 2046807993 and fecha = '2023-05-17' and len(cuit) = 11 and left(cuit,1) = '3'
)
and identificacion not in (select distinct numero from informes where cliente = 2046807993 and fecha_ingreso > getdate()-30 and informe_padre is null and estado_informe='X')
*/
select padrones.identificacion as cuit,padrones.identificador from ln_contrapartes inner join padrones on ln_contrapartes.id_padron=padrones.id_padron where contraparte in (
select distinct contraparte from ln_contraparte_familias where familia in (728,736,737) and contraparte in (select distinct contraparte from ln_gestiones where desde > '2023-08-27' and cliente = 5546348 and vigente = 1)
)
/*
select id_tipo_informe,* from informes where cliente=5546348 and informe_padre is null and fecha_ingreso > getdate()-1
select id_tipo_informe,* from informes where cliente=5546348 and fecha_ingreso > getdate()-3
update informes set fecha_ingreso='2023-04-28 19:30' where cliente=5546348 and fecha_ingreso > getdate()-1
*/
--exec [LN_Alta_Masiva_Blue]
--update informes set fecha_ingreso='2023-04-11 10:30',fecha_aceptacion='2023-04-11 10:30',fecha_iniciado='2023-04-11 10:30',fecha_inicio='2023-04-11 10:30',fecha_asignado='2023-04-11 10:30',fecha_comprometida='2023-05-03 23:59' where cliente=5546348 and fecha_ingreso > getdate()-3
--SELECT * FROM LN_GESTIONES WHERE GESTION IN (201042,201043)
--select * from ln_familias where cliente = 5546348 and country_code='AR' and servicio_contratado=47
--SELECT * FROM LN_DEMO WHERE CONTRAPARTE = 4208
--select id_tipo_informe,* from informes where numero = '800147332' and informe_padre is null
-- AR = 6407707 UY-PY = 2959197 -- Compliance 7772659
/* uy = (387,388,393,394,395,396,398) */
/* py = (385,386,389,390,391,392,397) */
Open LEDALTAMASIVA
Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident
While @@FETCH_STATUS = 0
BEGIN
--UPDATE LN_DEMO SET VISIBLE = 0 WHERE CONTRAPARTE = @contrap
--INSERT INTO LN_DEMO (CONTRAPARTE,GESTION,VISIBLE,PRODUCTO,CREATED,fecha_comprometida) VALUES (@contrap,@gest,0,2045,'2023-04-28 19:30:00','2023-05-31 23:59:59')
--select @contrap,@gest,0,2045,'2023-04-28 19:30:00','2023-05-31-23:59:59'
--select * from ln_productos where producto in (2002,2039,2045)
/* GENERAR INFORME EN BLUE Y EN LN_DEMO */
-- AR = 6407707 UY-PY = 2959197 -- Compliance 7772659
/*Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident*/
declare @inf int
declare @tarea int
declare @solicitante int =64208280-- 295891824
declare @itemcontrato int = 354
declare @idtipo int = 6407707-- 7772659 -- 1644790
/*
SELECT * FROM TIPOS_INFORME WHERE ID_TIPO_INFORME in (7772659,6407707,1644790)
select * from clientes where nombre_cliente like '%energy%'
select * from users where user_id in (45460019,1700309847)
select * from users where user_id in (select distinct user_id from usuarios_productos where cliente = 2046807993)
*/
declare @productoblue int =6
declare @prioridad int =5
declare @datam int =45460019
declare @productoleddemo int = 2045 -- 2039 AMX ES 2045
declare @asignado int =45460019
declare @cliente int = 5546348
declare @fechalimite datetime = '2023-09-15 23:59:59'
/* debe asociarse el informe a un item de contrato, obligatoriamente */
DECLARE @p_idioma smallint = NULL
DECLARE @p_filial smallint = NULL
select @p_idioma = idioma from idiomas where codigo_idioma = 'ES'
select @p_filial = filial from filiales where country_code = 'AR'
/* obtener nuevo ID de informe */
--EXEC LN_informes 'obtener_id', @p_contraparte, @id OUTPUT
exec @inf = Genera_ID_Informe_2022 @cliente,null
--ALTER TABLE INFORMES ALTER COLUMN column_name bigint;
if (@inf IS NOT NULL) begin
DECLARE @hist varchar(max) = 'Creación del informe.'
UPDATE informes SET /*informe=@id, cliente=@cliente,*/ identificador=@ident, numero=@cuit, fecha_ingreso='2023-09-08 10:00:00', id_tipo_informe=@idtipo,
objeto_informe='INFORME GENERADO A TRAVES DE BACKEND FIDELITAS',
historial_informe=@hist, ingresado_por=@solicitante, idioma=@p_idioma, filial=@p_filial, prioridad=5, datamanager=@datam,
asignado=@asignado, estado_informe='A', fecha_asignado='2023-09-08 10:00:00',
fecha_aceptacion='2023-09-08 10:00:00',
excepcion=0, excepcion_prod=0, notificar_cliente=0,
fecha_limite_doc=@fechalimite,fecha_comprometida=@fechalimite
WHERE informe = @inf and idreg=@inf
/* Generación de las subtareas */
DECLARE @tipo_subinforme INT = null
DECLARE @orden tinyint = NULL
DECLARE @prioridad_tarea tinyint = NULL
DECLARE TiposSubinformes CURSOR FOR
select tipos_subinformes.id_tipo_subinforme, tipos_subinformes.orden, isnull(tipos_informe.prioridad_default,0) as prioridad_default
from tipos_subinformes inner join tipos_informe on tipos_subinformes.id_tipo_subinforme = tipos_informe.id_tipo_informe
where tipos_subinformes.id_tipo_informe = @idtipo
order by tipos_subinformes.orden
OPEN TiposSubinformes
FETCH NEXT FROM TiposSubinformes INTO @tipo_subinforme, @orden, @prioridad_tarea
WHILE @@FETCH_STATUS = 0 BEGIN
exec @tarea = Genera_ID_Informe_2022 @cliente,@inf
if (@tarea > 0) begin
/* La prioridad de cada tarea depende del tipo de informe. Si está en 0 o nula toma la del informe padre */
update informes set identificador=@ident, numero=@cuit, fecha_ingreso='2023-09-08 10:00:00', id_tipo_informe=@tipo_subinforme,
objeto_informe=null, historial_informe= 'Creación del informe.', ingresado_por=@solicitante, idioma=@p_idioma,
filial=@p_filial, prioridad=5, datamanager=@datam, estado_informe= 'I', orden=@orden, informe_padre=@inf
where informe = @tarea and idreg=@tarea
end
FETCH NEXT FROM TiposSubinformes INTO @tipo_subinforme, @orden, @prioridad_tarea
END
CLOSE TiposSubinformes
DEALLOCATE TiposSubinformes
/* SELECT @inf AS informe*/
end
/*
select * from users where user_id in (45460019,608083,434439085,1700309847)
select * from users where email like '%claro%' (45460019,608083,434439085,1700309847)
*/
/*
exec LN_informes 'ingresar_informe', @contrap, @inf output, @solicitante, @itemcontrato, @productoblue, @idtipo, @prioridad, 'A', @solicitante, @datam, @asignado, @cliente, @fechalimite, @productoleddemo, @fechalimite, 'Carga backend'
*/
/*
exec LN_informes 'activar_gestion_documentacion', @contrap, @inf, @solicitante, @itemcontrato, @productoblue, @idtipo, @prioridad, 'P', @solicitante, @datam, @asignado, @cliente, @fechalimite, @productoleddemo,@fechalimite, 'Carga backend'
*/
--UPDATE LN_demo SET VISIBLE=0,informe = @inf where contraparte= @contrap and gestion= @gest and informe is null
-- select * from users where user_id =45460019
--select * from ln_productos where producto = 2045
/*
select * from informes where cliente = 431136419 and informe_padre is null
select * from tipos_informe where id_tipo_informe=1644793 or nombre_tipo_informe like '%enrique%'
*/
/*
select top 10 * from ln_contrapartes where servicio_contratado=47 and cliente = 2046807993 order by created
select * from ln_demo where contraparte=32109
select * from informes where informe = 4204379
select * from tipos_informe where id_tipo_informe in (
select distinct id_tipo_informe from informes where cliente = 2046807993)
*/
/*
select * from informes where informe in (5170207,1336206) or informe_padre in (5170207,1336206)
update informes set estado_informe='A',asignado=45460019 where informe in (5170207,1336206) or informe_padre in (5170207,1336206)
*/
--select * from informes where cliente = 2046807993 and fecha_ingreso > '2022-05-21 19:28:04.490'
/*
insert into LN_demo (contraparte, gestion, producto, informe, created, visible)
values (@contra, @gestion, @productoleddemo, @inf, GETDATE(), 0)
select * from padrones where id_padron= 34
select * from informes where informe in (5170207,1336206)
select * from ln_demo where contraparte in (186427,186426)
select * from ln_contrapartes where contraparte=186426
select * from consumo_contratos where cliente = 2046807993 order by consumido desc
select * from LN_productos
*/
--UPDATE LN_demo SET VISIBLE=0 where contraparte= @contra and gestion= @gestion and informe= @inf
Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident
END
CLOSE LEDALTAMASIVA
DEALLOCATE LEDALTAMASIVA
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.LN_Alta_Masiva_Blue
/* MARITA
faltan en ln_demo contrapartes 101 y 107
select c.country_code, f2.nombre_familia, f2.set_doc,
d.contraparte, d.gestion, d.visible, d.informe, d.id_dossier,
i.informe, i.fecha_ingreso, i.fecha_comprometida, i.fecha_inicio, i.fecha_entregado, i.estado_informe
from ln_gestiones g
inner join LN_contraparte_familias f on f.contraparte = g.contraparte
inner join LN_demo d on d.contraparte = g.contraparte and d.gestion = g.gestion
inner join LN_familias f2 on f2.familia = f.familia
inner join LN_contrapartes c on (c.contraparte = g.contraparte and c.subcontratista = 0)
inner join padrones p on p.id_padron = c.id_padron
left join informes i on (i.numero = p.identificacion and i.cliente = 5546348 and i.informe_padre is null and i.informe > 100640000)
where g.cliente = 5546348 and g.desde = '2023-04-12'
and f.contraparte in (101,107)
*/
/*
select * from informes where informe in (9925156) (9612000,1269675,1268189) or informe_padre in (9612000,1268189,1269675)
select * from ln_demo where informe in (1268189,1269675)
select * from ln_gestiones where
contraparte in (select contraparte from LN_contraparte_familias where familia in (385,386,389,390,391,392,397) and contraparte in (
select contraparte from ln_contrapartes where cliente = 5546348 and country_code = 'PY' and activo = 1))
and vigente = 1 and desde > '2021-04-20'
order by desde asc
/*
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000',
id_tipo_informe=4186979,
estado_informe='A' where informe in (8304427) and estado_informe!='I'
select * from ln_demo where informe in (1268189,1269675)
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000',
estado_informe='E' where informe_padre in (8304427) and estado_informe!='I'
*/
update informes set fecha_comprometida='2021-06-30 12:00:00.000',fecha_inicio='2021-04-30 08:00:00.000',fecha_iniciado='2021-04-30 08:00:00.000',
fecha_asignado='2021-04-30 08:00:00.000',
fecha_aceptacion='2021-04-30 08:00:00.000'
where informe_padre is null and cliente = 5546348 and fecha_ingreso > '2021-05-06 17:21:34.260'
select * from informes where cliente = 5546348 and fecha_ingreso > '2021-05-06 17:21:34.260' and informe = 9612000 and id_tipo_informe=1578391
*/
AS
BEGIN
SET NOCOUNT ON;
declare @gest int, @contrap int ,@cuit varchar(20) ,@ident varchar(6)
--select * from informes where informe in (1342245,1157188)
--select * from ln_familias where cliente = 5546348 and familia not in (32,33,34,37,61,62,71,189,195,207)
DECLARE LEDALTAMASIVA Cursor
FOR
/*
select DISTINCT ln_gestiones.gestion,ln_gestiones.contraparte,padrones.identificacion,padrones.identificador/*,LN_GESTIONES.desde *//*,ln_demo.informe */
from ln_gestiones inner join ln_contrapartes on LN_gestiones.contraparte = ln_contrapartes.contraparte inner join padrones on ln_contrapartes.id_padron=padrones.id_padron
LEFT JOIN LN_DEMO ON LN_GESTIONES.GESTION = LN_DEMO.GESTION
/*left join informes on ln_demo.informe = informes.informe */
where ln_gestiones.contraparte in (select contraparte from LN_contraparte_familias where familia not in (32,33,34,37,61,62,71,189,195,207,120))
and LN_GESTIONES.CONTRAPARTE IN (select contraparte from ln_contrapartes where cliente = 5546348 and country_code = 'AR' and activo = 1 and servicio_contratado=47)
and LN_GESTIONES.vigente = 1
and LN_GESTIONES.desde > '2023-04-09' -- AND PADRONES.identificacion='33711028809'
--and LN_GESTIONES.contraparte = 96
AND LN_DEMO.GESTION IS not NULL
--and ln_demo.informe is null
--and ln_gestiones.contraparte not in (4315) and ln_gestiones.contraparte in (0)
order by contraparte asc
*/
/*
select TOP 100 IDENTIFICACION AS CUIT,IDENTIFICADOR from padrones where habilitado =1 and identificador in ('CUIT','CUIL') AND identificaCION in (
select distinct cuit from procesos_cuit
where cliente = 2046807993 and fecha = '2023-05-16' and len(cuit) = 11 and left(cuit,1) = '3'
union
select distinct cuit from procesos_cuit where cliente = 2046807993 and fecha = '2023-05-17' and len(cuit) = 11 and left(cuit,1) = '3'
)
and identificacion not in (select distinct numero from informes where cliente = 2046807993 and fecha_ingreso > getdate()-30 and informe_padre is null and estado_informe='X')
*/
select padrones.identificacion as cuit,padrones.identificador from ln_contrapartes inner join padrones on ln_contrapartes.id_padron=padrones.id_padron where contraparte in (
select distinct contraparte from ln_contraparte_familias where familia in (728,736,737) and contraparte in (select distinct contraparte from ln_gestiones where desde > '2023-08-27' and cliente = 5546348 and vigente = 1)
)
/*
select id_tipo_informe,* from informes where cliente=5546348 and informe_padre is null and fecha_ingreso > getdate()-1
select id_tipo_informe,* from informes where cliente=5546348 and fecha_ingreso > getdate()-3
update informes set fecha_ingreso='2023-04-28 19:30' where cliente=5546348 and fecha_ingreso > getdate()-1
*/
--exec [LN_Alta_Masiva_Blue]
--update informes set fecha_ingreso='2023-04-11 10:30',fecha_aceptacion='2023-04-11 10:30',fecha_iniciado='2023-04-11 10:30',fecha_inicio='2023-04-11 10:30',fecha_asignado='2023-04-11 10:30',fecha_comprometida='2023-05-03 23:59' where cliente=5546348 and fecha_ingreso > getdate()-3
--SELECT * FROM LN_GESTIONES WHERE GESTION IN (201042,201043)
--select * from ln_familias where cliente = 5546348 and country_code='AR' and servicio_contratado=47
--SELECT * FROM LN_DEMO WHERE CONTRAPARTE = 4208
--select id_tipo_informe,* from informes where numero = '800147332' and informe_padre is null
-- AR = 6407707 UY-PY = 2959197 -- Compliance 7772659
/* uy = (387,388,393,394,395,396,398) */
/* py = (385,386,389,390,391,392,397) */
Open LEDALTAMASIVA
Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident
While @@FETCH_STATUS = 0
BEGIN
--UPDATE LN_DEMO SET VISIBLE = 0 WHERE CONTRAPARTE = @contrap
--INSERT INTO LN_DEMO (CONTRAPARTE,GESTION,VISIBLE,PRODUCTO,CREATED,fecha_comprometida) VALUES (@contrap,@gest,0,2045,'2023-04-28 19:30:00','2023-05-31 23:59:59')
--select @contrap,@gest,0,2045,'2023-04-28 19:30:00','2023-05-31-23:59:59'
--select * from ln_productos where producto in (2002,2039,2045)
/* GENERAR INFORME EN BLUE Y EN LN_DEMO */
-- AR = 6407707 UY-PY = 2959197 -- Compliance 7772659
/*Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident*/
declare @inf int
declare @tarea int
declare @solicitante int =64208280-- 295891824
declare @itemcontrato int = 354
declare @idtipo int = 6407707-- 7772659 -- 1644790
/*
SELECT * FROM TIPOS_INFORME WHERE ID_TIPO_INFORME in (7772659,6407707,1644790)
select * from clientes where nombre_cliente like '%energy%'
select * from users where user_id in (45460019,1700309847)
select * from users where user_id in (select distinct user_id from usuarios_productos where cliente = 2046807993)
*/
declare @productoblue int =6
declare @prioridad int =5
declare @datam int =45460019
declare @productoleddemo int = 2045 -- 2039 AMX ES 2045
declare @asignado int =45460019
declare @cliente int = 5546348
declare @fechalimite datetime = '2023-09-15 23:59:59'
/* debe asociarse el informe a un item de contrato, obligatoriamente */
DECLARE @p_idioma smallint = NULL
DECLARE @p_filial smallint = NULL
select @p_idioma = idioma from idiomas where codigo_idioma = 'ES'
select @p_filial = filial from filiales where country_code = 'AR'
/* obtener nuevo ID de informe */
--EXEC LN_informes 'obtener_id', @p_contraparte, @id OUTPUT
exec @inf = Genera_ID_Informe_2022 @cliente,null
--ALTER TABLE INFORMES ALTER COLUMN column_name bigint;
if (@inf IS NOT NULL) begin
DECLARE @hist varchar(max) = 'Creación del informe.'
UPDATE informes SET /*informe=@id, cliente=@cliente,*/ identificador=@ident, numero=@cuit, fecha_ingreso='2023-09-08 10:00:00', id_tipo_informe=@idtipo,
objeto_informe='INFORME GENERADO A TRAVES DE BACKEND FIDELITAS',
historial_informe=@hist, ingresado_por=@solicitante, idioma=@p_idioma, filial=@p_filial, prioridad=5, datamanager=@datam,
asignado=@asignado, estado_informe='A', fecha_asignado='2023-09-08 10:00:00',
fecha_aceptacion='2023-09-08 10:00:00',
excepcion=0, excepcion_prod=0, notificar_cliente=0,
fecha_limite_doc=@fechalimite,fecha_comprometida=@fechalimite
WHERE informe = @inf and idreg=@inf
/* Generación de las subtareas */
DECLARE @tipo_subinforme INT = null
DECLARE @orden tinyint = NULL
DECLARE @prioridad_tarea tinyint = NULL
DECLARE TiposSubinformes CURSOR FOR
select tipos_subinformes.id_tipo_subinforme, tipos_subinformes.orden, isnull(tipos_informe.prioridad_default,0) as prioridad_default
from tipos_subinformes inner join tipos_informe on tipos_subinformes.id_tipo_subinforme = tipos_informe.id_tipo_informe
where tipos_subinformes.id_tipo_informe = @idtipo
order by tipos_subinformes.orden
OPEN TiposSubinformes
FETCH NEXT FROM TiposSubinformes INTO @tipo_subinforme, @orden, @prioridad_tarea
WHILE @@FETCH_STATUS = 0 BEGIN
exec @tarea = Genera_ID_Informe_2022 @cliente,@inf
if (@tarea > 0) begin
/* La prioridad de cada tarea depende del tipo de informe. Si está en 0 o nula toma la del informe padre */
update informes set identificador=@ident, numero=@cuit, fecha_ingreso='2023-09-08 10:00:00', id_tipo_informe=@tipo_subinforme,
objeto_informe=null, historial_informe= 'Creación del informe.', ingresado_por=@solicitante, idioma=@p_idioma,
filial=@p_filial, prioridad=5, datamanager=@datam, estado_informe= 'I', orden=@orden, informe_padre=@inf
where informe = @tarea and idreg=@tarea
end
FETCH NEXT FROM TiposSubinformes INTO @tipo_subinforme, @orden, @prioridad_tarea
END
CLOSE TiposSubinformes
DEALLOCATE TiposSubinformes
/* SELECT @inf AS informe*/
end
/*
select * from users where user_id in (45460019,608083,434439085,1700309847)
select * from users where email like '%claro%' (45460019,608083,434439085,1700309847)
*/
/*
exec LN_informes 'ingresar_informe', @contrap, @inf output, @solicitante, @itemcontrato, @productoblue, @idtipo, @prioridad, 'A', @solicitante, @datam, @asignado, @cliente, @fechalimite, @productoleddemo, @fechalimite, 'Carga backend'
*/
/*
exec LN_informes 'activar_gestion_documentacion', @contrap, @inf, @solicitante, @itemcontrato, @productoblue, @idtipo, @prioridad, 'P', @solicitante, @datam, @asignado, @cliente, @fechalimite, @productoleddemo,@fechalimite, 'Carga backend'
*/
--UPDATE LN_demo SET VISIBLE=0,informe = @inf where contraparte= @contrap and gestion= @gest and informe is null
-- select * from users where user_id =45460019
--select * from ln_productos where producto = 2045
/*
select * from informes where cliente = 431136419 and informe_padre is null
select * from tipos_informe where id_tipo_informe=1644793 or nombre_tipo_informe like '%enrique%'
*/
/*
select top 10 * from ln_contrapartes where servicio_contratado=47 and cliente = 2046807993 order by created
select * from ln_demo where contraparte=32109
select * from informes where informe = 4204379
select * from tipos_informe where id_tipo_informe in (
select distinct id_tipo_informe from informes where cliente = 2046807993)
*/
/*
select * from informes where informe in (5170207,1336206) or informe_padre in (5170207,1336206)
update informes set estado_informe='A',asignado=45460019 where informe in (5170207,1336206) or informe_padre in (5170207,1336206)
*/
--select * from informes where cliente = 2046807993 and fecha_ingreso > '2022-05-21 19:28:04.490'
/*
insert into LN_demo (contraparte, gestion, producto, informe, created, visible)
values (@contra, @gestion, @productoleddemo, @inf, GETDATE(), 0)
select * from padrones where id_padron= 34
select * from informes where informe in (5170207,1336206)
select * from ln_demo where contraparte in (186427,186426)
select * from ln_contrapartes where contraparte=186426
select * from consumo_contratos where cliente = 2046807993 order by consumido desc
select * from LN_productos
*/
--UPDATE LN_demo SET VISIBLE=0 where contraparte= @contra and gestion= @gestion and informe= @inf
Fetch NEXT FROM LEDALTAMASIVA INTO @cuit,@ident
END
CLOSE LEDALTAMASIVA
DEALLOCATE LEDALTAMASIVA
END
GO
Depends On
9Used By
No items found