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.RunIT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ERRORNUMBER SMALLINT
update led_docs set estado_doc='P',compliance_doc='P',last_modified=getdate()
where periodo=dbo.PeriodoAdelantado() and estado_doc='N' and tipo_doc in (
select tipo_doc from led_tipos_doc where modalidad='V')
/*
DECLARE ImperiumDocs Cursor
FOR
select distinct led_docs.cliente,led_docs.led_seccion,led_docs.periodo,led_docs.contratista
from led_docs inner join led_tipos_doc on led_docs.tipo_doc = led_tipos_doc.tipo_doc
where led_docs.cliente NOT IN (9335603) and (insertado > getdate()-0.01 and (led_tipos_doc.doc_alta = 1 or led_tipos_doc.doc_baja = 1 )) or
(verificado > getdate()-0.01) or (rechazado > getdate()-0.01)
or (fecha_tolerancia between getdate() and getdate()-0.01) or (last_modified between getdate() and getdate()-0.01)
union all
select led_contratistas.cliente,'C' as led_seccion,led_contratista_periodo.periodo,led_contratista_periodo.contratista
from led_contratista_periodo inner join led_contratistas on led_contratista_periodo.contratista = led_contratistas.contratista
where led_contratista_periodo.fecha_afectacion > getdate()-0.01
and led_contratistas.cliente NOT IN (9335603)
union all
select led_empleados.cliente,'E' as led_seccion,led_empleados_periodo.periodo,led_empleados_periodo.contratista
from led_empleados_periodo inner join led_empleados on led_empleados_periodo.empleado = led_empleados.empleado
where led_empleados_periodo.fecha_afectacion > getdate()-0.01
and led_empleados.cliente NOT IN (9335603)
union all
select led_vehiculos.cliente,'V' as led_seccion,led_vehiculos_periodo.periodo,led_vehiculos_periodo.contratista
from led_vehiculos_periodo inner join led_vehiculos on led_vehiculos_periodo.vehiculo = led_vehiculos.vehiculo
where led_vehiculos_periodo.fecha_afectacion > getdate()-0.01
/* and led_vehiculos.cliente NOT IN (9335603) */
union all
select led_contratistas.cliente,'C' as led_seccion,led_subcontratista_periodo.periodo,led_subcontratista_periodo.contratista
from led_subcontratista_periodo inner join led_contratistas on led_subcontratista_periodo.subcontratista = led_contratistas.contratista
where led_subcontratista_periodo.fecha_afectacion > getdate()-0.01
/* and led_contratistas.cliente NOT IN (9335603)*/
*/
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.RunIT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ERRORNUMBER SMALLINT
update led_docs set estado_doc='P',compliance_doc='P',last_modified=getdate()
where periodo=dbo.PeriodoAdelantado() and estado_doc='N' and tipo_doc in (
select tipo_doc from led_tipos_doc where modalidad='V')
/*
DECLARE ImperiumDocs Cursor
FOR
select distinct led_docs.cliente,led_docs.led_seccion,led_docs.periodo,led_docs.contratista
from led_docs inner join led_tipos_doc on led_docs.tipo_doc = led_tipos_doc.tipo_doc
where led_docs.cliente NOT IN (9335603) and (insertado > getdate()-0.01 and (led_tipos_doc.doc_alta = 1 or led_tipos_doc.doc_baja = 1 )) or
(verificado > getdate()-0.01) or (rechazado > getdate()-0.01)
or (fecha_tolerancia between getdate() and getdate()-0.01) or (last_modified between getdate() and getdate()-0.01)
union all
select led_contratistas.cliente,'C' as led_seccion,led_contratista_periodo.periodo,led_contratista_periodo.contratista
from led_contratista_periodo inner join led_contratistas on led_contratista_periodo.contratista = led_contratistas.contratista
where led_contratista_periodo.fecha_afectacion > getdate()-0.01
and led_contratistas.cliente NOT IN (9335603)
union all
select led_empleados.cliente,'E' as led_seccion,led_empleados_periodo.periodo,led_empleados_periodo.contratista
from led_empleados_periodo inner join led_empleados on led_empleados_periodo.empleado = led_empleados.empleado
where led_empleados_periodo.fecha_afectacion > getdate()-0.01
and led_empleados.cliente NOT IN (9335603)
union all
select led_vehiculos.cliente,'V' as led_seccion,led_vehiculos_periodo.periodo,led_vehiculos_periodo.contratista
from led_vehiculos_periodo inner join led_vehiculos on led_vehiculos_periodo.vehiculo = led_vehiculos.vehiculo
where led_vehiculos_periodo.fecha_afectacion > getdate()-0.01
/* and led_vehiculos.cliente NOT IN (9335603) */
union all
select led_contratistas.cliente,'C' as led_seccion,led_subcontratista_periodo.periodo,led_subcontratista_periodo.contratista
from led_subcontratista_periodo inner join led_contratistas on led_subcontratista_periodo.subcontratista = led_contratistas.contratista
where led_subcontratista_periodo.fecha_afectacion > getdate()-0.01
/* and led_contratistas.cliente NOT IN (9335603)*/
*/
END
GO
Depends On
3Used By
No items found