Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
17| Name | Data Type | Length | Description |
|---|---|---|---|
| @action | varchar | 15 | |
| @id_plan | int | 4 | |
| @doc_id | bigint | 8 | |
| @nro_plan | int | 4 | |
| @cant_cuotas | smallint | 2 | |
| @fecha_consolidacion | date | 3 | |
| @concepto_consolidado | varchar | 20 | |
| @periodo_consolidado | varchar | 10 | |
| @monto_total | decimal | 9 | |
| @importe_cuota | decimal | 9 | |
| @cuotas_canceladas | smallint | 2 | |
| @importe_cancelado | decimal | 9 | |
| @user_id | int | 4 | |
| @adjunto1 | varchar | 100 | |
| @adjunto2 | varchar | 100 | |
| @adjunto3 | varchar | 100 | |
| @adjunto4 | varchar | 100 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDUREdbo.LN_auditoria
@action VARCHAR(15),
@id_plan int null,
@doc_id bigint,
@nro_plan int,
@cant_cuotas smallint,
@fecha_consolidacion date,
@concepto_consolidado varchar(20),
@periodo_consolidado varchar(10),
@monto_total decimal(15,2),
@importe_cuota decimal(15,2),
@cuotas_canceladas smallint,
@importe_cancelado decimal(15,2),
@user_id int,
@adjunto1 varchar(100) null,
@adjunto2 varchar(100) null,
@adjunto3 varchar(100) null,
@adjunto4 varchar(100) null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
if (@action = 'LISTAR') /* RECUPERA LOS VALORES CARGADOS PARA EL DOC_ID */
BEGIN
SELECT TOP 10 LN_CONTROL_SCREENING.*,PADRONES.nombre_persona,padrones.identificacion,clientes.nombre_cliente FROM LN_CONTROL_SCREENING
INNER JOIN identificadores ON LN_CONTROL_SCREENING.country_code = identificadores.country_code
LEFT JOIN PADRONES ON (LN_control_screening.identificacion=PADRONES.identificacion AND identificadores.identificador=PADRONES.identificador AND PADRONES.HABILITADO=1)
INNER JOIN CLIENTES ON LN_control_screening.cliente=CLIENTES.cliente
--WHERE CLIENTES.CLIENTE = @IDcliente
/*
select * from clientes where cliente in (
select distinct cliente from LN_control_screening)
*/
END
if (@action = 'ADDPLAN') /* ACTUALIZA LOS VALORES CARGADOS PARA EL DOC_ID Y EL ID DE PLAN*/
BEGIN
INSERT INTO led_planes_pagos (nro_plan,cant_cuotas,fecha_consolidacion,concepto_consolidado,periodo_consolidado,monto_total,importe_cuota,cuotas_canceladas,importe_cancelado,
created,created_by,doc_id)
VALUES
(@nro_plan,@cant_cuotas,@fecha_consolidacion,@concepto_consolidado,@periodo_consolidado,@monto_total,@importe_cuota,@cuotas_canceladas,@importe_cancelado,
getdate(),@user_id,@doc_id)
END
if (@action = 'UPDPLAN') /* ACTUALIZA LOS VALORES CARGADOS PARA EL DOC_ID Y EL ID DE PLAN*/
BEGIN
update led_planes_pagos set
nro_plan =@nro_plan,
cant_cuotas=@cant_cuotas,
fecha_consolidacion=@fecha_consolidacion,
concepto_consolidado=@concepto_consolidado,
periodo_consolidado=@periodo_consolidado,
monto_total=@monto_total,
importe_cuota=@importe_cuota,
cuotas_canceladas=@cuotas_canceladas,
importe_cancelado=@importe_cancelado,
adjunto1=@adjunto1,
adjunto2=@adjunto2,
adjunto3=@adjunto3,
adjunto4=@adjunto4,
modified=getdate(),
modified_by=@user_id
where doc_id = @doc_id and id_plan=@id_plan
END
END
GO
GO
CREATE OR ALTER PROCEDUREdbo.LN_auditoria
@action VARCHAR(15),
@id_plan int null,
@doc_id bigint,
@nro_plan int,
@cant_cuotas smallint,
@fecha_consolidacion date,
@concepto_consolidado varchar(20),
@periodo_consolidado varchar(10),
@monto_total decimal(15,2),
@importe_cuota decimal(15,2),
@cuotas_canceladas smallint,
@importe_cancelado decimal(15,2),
@user_id int,
@adjunto1 varchar(100) null,
@adjunto2 varchar(100) null,
@adjunto3 varchar(100) null,
@adjunto4 varchar(100) null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
if (@action = 'LISTAR') /* RECUPERA LOS VALORES CARGADOS PARA EL DOC_ID */
BEGIN
SELECT TOP 10 LN_CONTROL_SCREENING.*,PADRONES.nombre_persona,padrones.identificacion,clientes.nombre_cliente FROM LN_CONTROL_SCREENING
INNER JOIN identificadores ON LN_CONTROL_SCREENING.country_code = identificadores.country_code
LEFT JOIN PADRONES ON (LN_control_screening.identificacion=PADRONES.identificacion AND identificadores.identificador=PADRONES.identificador AND PADRONES.HABILITADO=1)
INNER JOIN CLIENTES ON LN_control_screening.cliente=CLIENTES.cliente
--WHERE CLIENTES.CLIENTE = @IDcliente
/*
select * from clientes where cliente in (
select distinct cliente from LN_control_screening)
*/
END
if (@action = 'ADDPLAN') /* ACTUALIZA LOS VALORES CARGADOS PARA EL DOC_ID Y EL ID DE PLAN*/
BEGIN
INSERT INTO led_planes_pagos (nro_plan,cant_cuotas,fecha_consolidacion,concepto_consolidado,periodo_consolidado,monto_total,importe_cuota,cuotas_canceladas,importe_cancelado,
created,created_by,doc_id)
VALUES
(@nro_plan,@cant_cuotas,@fecha_consolidacion,@concepto_consolidado,@periodo_consolidado,@monto_total,@importe_cuota,@cuotas_canceladas,@importe_cancelado,
getdate(),@user_id,@doc_id)
END
if (@action = 'UPDPLAN') /* ACTUALIZA LOS VALORES CARGADOS PARA EL DOC_ID Y EL ID DE PLAN*/
BEGIN
update led_planes_pagos set
nro_plan =@nro_plan,
cant_cuotas=@cant_cuotas,
fecha_consolidacion=@fecha_consolidacion,
concepto_consolidado=@concepto_consolidado,
periodo_consolidado=@periodo_consolidado,
monto_total=@monto_total,
importe_cuota=@importe_cuota,
cuotas_canceladas=@cuotas_canceladas,
importe_cancelado=@importe_cancelado,
adjunto1=@adjunto1,
adjunto2=@adjunto2,
adjunto3=@adjunto3,
adjunto4=@adjunto4,
modified=getdate(),
modified_by=@user_id
where doc_id = @doc_id and id_plan=@id_plan
END
END
GO
Used By
No items found