Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_Cuit | varchar | 20 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.ws_tiene_arba
@p_Cuit varchar(20)
AS
BEGIN
SET NOCOUNT ON;
declare @p_5anios date = getdate() - (5*365)
declare @p_2anios date = getdate() - (2*365)
declare @p_3meses date = getdate() - (90)
DECLARE @cantidad int = 0
set @cantidad = (SELECT count(*)
from arba
where arba.cuit = @p_Cuit
and visible = '1'
and tipo_movimiento != 4
AND
(((
(
(fecha_de_inicio_de_juicio >= @p_5anios)
AND
(estado_de_plan_de_pagos NOT IN ('2' ,'4'))
)
AND
(cancelacion_del_juicio NOT IN ('S' ,'T'))
)
AND
(fecha_de_cancelacion IS NULL)
)
OR
((fecha_de_inicio_de_juicio >= @p_2anios)
AND
(
((estado_de_plan_de_pagos IN ('2' ,'4')) OR (cancelacion_del_juicio IN ('S' ,'T')))
OR (fecha_de_cancelacion IS NOT NULL)
)
)
)
)
return @cantidad
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.ws_tiene_arba
@p_Cuit varchar(20)
AS
BEGIN
SET NOCOUNT ON;
declare @p_5anios date = getdate() - (5*365)
declare @p_2anios date = getdate() - (2*365)
declare @p_3meses date = getdate() - (90)
DECLARE @cantidad int = 0
set @cantidad = (SELECT count(*)
from arba
where arba.cuit = @p_Cuit
and visible = '1'
and tipo_movimiento != 4
AND
(((
(
(fecha_de_inicio_de_juicio >= @p_5anios)
AND
(estado_de_plan_de_pagos NOT IN ('2' ,'4'))
)
AND
(cancelacion_del_juicio NOT IN ('S' ,'T'))
)
AND
(fecha_de_cancelacion IS NULL)
)
OR
((fecha_de_inicio_de_juicio >= @p_2anios)
AND
(
((estado_de_plan_de_pagos IN ('2' ,'4')) OR (cancelacion_del_juicio IN ('S' ,'T')))
OR (fecha_de_cancelacion IS NOT NULL)
)
)
)
)
return @cantidad
END
GO
Depends On
1Used By
No items found