Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
4| Name | Data Type | Length | Description |
|---|---|---|---|
| @accion | varchar | 20 | |
| @id_cliente1 | varchar | 20 | |
| @fecha_desde1 | varchar | 20 | |
| @fecha_hasta1 | varchar | 20 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [LN_Historial_acciones] 'conexiones', '60554188', '2023-08-01','2023-08-31'
exec [LN_Historial_acciones] 'acciones', '60554188', '2023-08-01','2023-08-31'
*/
CREATE OR ALTER PROCEDURE dbo.LN_Historial_acciones
@accion varchar(20),
@id_cliente1 varchar(20),
@fecha_desde1 varchar(20),
@fecha_hasta1 varchar(20)
AS
BEGIN
SET NOCOUNT ON;
set @id_cliente1 = RTRIM(@id_cliente1)
set @fecha_desde1 = RTRIM(@fecha_desde1)
set @fecha_hasta1 = RTRIM(@fecha_hasta1)
if (@id_cliente1 = '') begin set @id_cliente1 = null end
if (@fecha_desde1 = '') begin set @fecha_desde1 = null end
if (@fecha_hasta1 = '') begin set @fecha_hasta1 = null end
declare @id_cliente int = convert(int, @id_cliente1)
declare @fecha_desde date = convert(date, @fecha_desde1)
declare @fecha_hasta date = convert(date, @fecha_hasta1)
if (@accion = 'conexiones')
select distinct iif(realizado=0, 'ERROR','OK') as realizado,
created as fecha_oculta,
(CONVERT(VARCHAR(10),created, 103)) + ' ' + (convert(varchar, created,108)) as fecha,
case accion
when 'getToken' then 'Obtener token'
when 'getJson' then 'Procesar datos'
when 'update' then 'Actualizar datos conexion'
else accion
end
as accion,
cliente,
usuario,
codEmpresa,
ptoTrabajo,
escenario,
vista,
url,
iif(error = 'OK', null, isnull(error,'') + ' - ' + ISNULL(err,'')) as error
from Iterceros_conexiones
where cliente = @id_cliente
and convert(date,created) between @fecha_desde and @fecha_hasta
order by created desc
if (@accion = 'acciones')
select distinct iif(Iterceros_trazabilidad.realizado=0, 'ERROR','OK') as realizado,
Iterceros_trazabilidad.created as fecha_oculta,
(CONVERT(VARCHAR(10),Iterceros_trazabilidad.created, 103)) + ' ' + (convert(varchar, Iterceros_trazabilidad.created,108)) as fecha,
Iterceros_trazabilidad.cliente,
Iterceros_trazabilidad.cli_cod,
iif (Iterceros_trazabilidad.cli_razsoc is null, padrones.nombre_persona, Iterceros_trazabilidad.cli_razsoc) as cli_razsoc,
iif (Iterceros_trazabilidad.cli_cuit is null,padrones.identificacion, Iterceros_trazabilidad.cli_cuit) as cli_cuit,
Iterceros_trazabilidad.cli_direc,
Iterceros_trazabilidad.cli_loc,
Iterceros_trazabilidad.cli_tel,
Iterceros_trazabilidad.cli_email,
Iterceros_trazabilidad.cli_fecmod,
Iterceros_trazabilidad.cli_habilitado,
IIF(Iterceros_trazabilidad.realizado = 0,
case accion
when 'UPDATE' then 'ERROR ACTUALIZAR'
when 'ALTA' then 'ERROR ALTA'
when 'INSERT' then 'ERROR ALTA'
when 'INACTIVAR' then 'ERROR INACTIVAR'
else 'ERROR ' + isnull(accion,'')
end,
case accion
when 'UPDATE' then 'REGISTRO ACTUALIZADO'
when 'ALTA' then 'REGISTRO DADO DE ALTA'
when 'INSERT' then 'REGISTRO DADO DE ALTA'
when 'INACTIVAR' then 'REGISTRO INACTIVADO'
else accion
end)
as accion,
Iterceros_trazabilidad.detalle
from Iterceros_trazabilidad
left join ln_contrapartes on LN_contrapartes.contraparte = Iterceros_trazabilidad.contraparte
left join padrones on padrones.id_padron = ln_contrapartes.id_padron
where Iterceros_trazabilidad.cliente = @id_cliente
and convert(date,Iterceros_trazabilidad.created) between @fecha_desde and @fecha_hasta
order by Iterceros_trazabilidad.created desc
END
/*
select distinct accion from Iterceros_conexiones
*/
GO
GO
/*
exec [LN_Historial_acciones] 'conexiones', '60554188', '2023-08-01','2023-08-31'
exec [LN_Historial_acciones] 'acciones', '60554188', '2023-08-01','2023-08-31'
*/
CREATE OR ALTER PROCEDURE dbo.LN_Historial_acciones
@accion varchar(20),
@id_cliente1 varchar(20),
@fecha_desde1 varchar(20),
@fecha_hasta1 varchar(20)
AS
BEGIN
SET NOCOUNT ON;
set @id_cliente1 = RTRIM(@id_cliente1)
set @fecha_desde1 = RTRIM(@fecha_desde1)
set @fecha_hasta1 = RTRIM(@fecha_hasta1)
if (@id_cliente1 = '') begin set @id_cliente1 = null end
if (@fecha_desde1 = '') begin set @fecha_desde1 = null end
if (@fecha_hasta1 = '') begin set @fecha_hasta1 = null end
declare @id_cliente int = convert(int, @id_cliente1)
declare @fecha_desde date = convert(date, @fecha_desde1)
declare @fecha_hasta date = convert(date, @fecha_hasta1)
if (@accion = 'conexiones')
select distinct iif(realizado=0, 'ERROR','OK') as realizado,
created as fecha_oculta,
(CONVERT(VARCHAR(10),created, 103)) + ' ' + (convert(varchar, created,108)) as fecha,
case accion
when 'getToken' then 'Obtener token'
when 'getJson' then 'Procesar datos'
when 'update' then 'Actualizar datos conexion'
else accion
end
as accion,
cliente,
usuario,
codEmpresa,
ptoTrabajo,
escenario,
vista,
url,
iif(error = 'OK', null, isnull(error,'') + ' - ' + ISNULL(err,'')) as error
from Iterceros_conexiones
where cliente = @id_cliente
and convert(date,created) between @fecha_desde and @fecha_hasta
order by created desc
if (@accion = 'acciones')
select distinct iif(Iterceros_trazabilidad.realizado=0, 'ERROR','OK') as realizado,
Iterceros_trazabilidad.created as fecha_oculta,
(CONVERT(VARCHAR(10),Iterceros_trazabilidad.created, 103)) + ' ' + (convert(varchar, Iterceros_trazabilidad.created,108)) as fecha,
Iterceros_trazabilidad.cliente,
Iterceros_trazabilidad.cli_cod,
iif (Iterceros_trazabilidad.cli_razsoc is null, padrones.nombre_persona, Iterceros_trazabilidad.cli_razsoc) as cli_razsoc,
iif (Iterceros_trazabilidad.cli_cuit is null,padrones.identificacion, Iterceros_trazabilidad.cli_cuit) as cli_cuit,
Iterceros_trazabilidad.cli_direc,
Iterceros_trazabilidad.cli_loc,
Iterceros_trazabilidad.cli_tel,
Iterceros_trazabilidad.cli_email,
Iterceros_trazabilidad.cli_fecmod,
Iterceros_trazabilidad.cli_habilitado,
IIF(Iterceros_trazabilidad.realizado = 0,
case accion
when 'UPDATE' then 'ERROR ACTUALIZAR'
when 'ALTA' then 'ERROR ALTA'
when 'INSERT' then 'ERROR ALTA'
when 'INACTIVAR' then 'ERROR INACTIVAR'
else 'ERROR ' + isnull(accion,'')
end,
case accion
when 'UPDATE' then 'REGISTRO ACTUALIZADO'
when 'ALTA' then 'REGISTRO DADO DE ALTA'
when 'INSERT' then 'REGISTRO DADO DE ALTA'
when 'INACTIVAR' then 'REGISTRO INACTIVADO'
else accion
end)
as accion,
Iterceros_trazabilidad.detalle
from Iterceros_trazabilidad
left join ln_contrapartes on LN_contrapartes.contraparte = Iterceros_trazabilidad.contraparte
left join padrones on padrones.id_padron = ln_contrapartes.id_padron
where Iterceros_trazabilidad.cliente = @id_cliente
and convert(date,Iterceros_trazabilidad.created) between @fecha_desde and @fecha_hasta
order by Iterceros_trazabilidad.created desc
END
/*
select distinct accion from Iterceros_conexiones
*/
GO
Used By
No items found