Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @cliente | int | 4 | |
| @p_fecha_desde | date | 3 | |
| @p_fecha_hasta | date | 3 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec obtener_novedades_html_mail 1299789112,'2021-04-26'
*/
CREATE OR ALTER PROCEDURE dbo.obtener_novedades_html_mail_fechas
@cliente int,
@p_fecha_desde date,
@p_fecha_hasta date
AS
BEGIN
SET NOCOUNT ON;
select distinct mr.cuit, p.nombre_persona, isnull(m.observaciones_cliente,'') as observaciones, mr.seccion_mantenimiento, mr.tipo_novedad,
iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)) as tabla,
mr.html
from monitoreos_resultados as mr
inner join padrones p
on p.identificacion = mr.cuit
inner join monitoreos m
on m.cliente = @cliente
and m.cuit = mr.cuit
and (m.seccion_mantenimiento = mr.seccion_mantenimiento or m.seccion_mantenimiento is null)
and m.visible = 1
and (m.fecha_vigencia_mantenimiento is null or m.fecha_vigencia_mantenimiento > @p_fecha_desde)
where mr.fecha between @p_fecha_desde and @p_fecha_hasta
and mr.novedad = 1
order by mr.seccion_mantenimiento, iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)), mr.cuit
END
--select * from productos_secciones
GO
GO
/*
exec obtener_novedades_html_mail 1299789112,'2021-04-26'
*/
CREATE OR ALTER PROCEDURE dbo.obtener_novedades_html_mail_fechas
@cliente int,
@p_fecha_desde date,
@p_fecha_hasta date
AS
BEGIN
SET NOCOUNT ON;
select distinct mr.cuit, p.nombre_persona, isnull(m.observaciones_cliente,'') as observaciones, mr.seccion_mantenimiento, mr.tipo_novedad,
iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)) as tabla,
mr.html
from monitoreos_resultados as mr
inner join padrones p
on p.identificacion = mr.cuit
inner join monitoreos m
on m.cliente = @cliente
and m.cuit = mr.cuit
and (m.seccion_mantenimiento = mr.seccion_mantenimiento or m.seccion_mantenimiento is null)
and m.visible = 1
and (m.fecha_vigencia_mantenimiento is null or m.fecha_vigencia_mantenimiento > @p_fecha_desde)
where mr.fecha between @p_fecha_desde and @p_fecha_hasta
and mr.novedad = 1
order by mr.seccion_mantenimiento, iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)), mr.cuit
END
--select * from productos_secciones
GO
Depends On
3Used By
No items found