Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @cuit | varchar | 20 | |
| @contraparte | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec deuda_previsional_ '20946541614',null
select * from fuentes_procesadas where fuente = 'previsional'
*/
CREATE OR ALTER PROCEDURE dbo.deuda_previsional_
@cuit varchar(20),
@contraparte int = null
AS
BEGIN
SET NOCOUNT ON;
if (@cuit is null)
select @cuit = identificacion
from ln_contrapartes
inner join padrones on padrones.id_padron = ln_contrapartes.id_padron
where ln_contrapartes.contraparte = @contraparte
select cuit, nombre_persona, codigo,
case codigo
when '301' then 'Aportes a la Seg. Social'
when '351' then 'Contribuciones a la Seg. Social'
end
as tipo,
periodo,
SUBSTRING(convert(varchar,periodo),5,2) + '/' + SUBSTRING(convert(varchar,periodo),1,4) as periodo_my,
SUBSTRING(convert(varchar,periodo),1,4) + '-' + SUBSTRING(convert(varchar,periodo),5,2) as periodo_ym,
fecha_info,
convert(varchar, fecha_info, 103) as fecha_info_dmy
from deuda_previsional
inner join padrones on (identificacion = cuit and habilitado = 1)
where cuit = @cuit
and visible = 1
order by periodo, codigo
end
/*
select top 10 * from deuda_previsional
*/
GO
GO
/*
exec deuda_previsional_ '20946541614',null
select * from fuentes_procesadas where fuente = 'previsional'
*/
CREATE OR ALTER PROCEDURE dbo.deuda_previsional_
@cuit varchar(20),
@contraparte int = null
AS
BEGIN
SET NOCOUNT ON;
if (@cuit is null)
select @cuit = identificacion
from ln_contrapartes
inner join padrones on padrones.id_padron = ln_contrapartes.id_padron
where ln_contrapartes.contraparte = @contraparte
select cuit, nombre_persona, codigo,
case codigo
when '301' then 'Aportes a la Seg. Social'
when '351' then 'Contribuciones a la Seg. Social'
end
as tipo,
periodo,
SUBSTRING(convert(varchar,periodo),5,2) + '/' + SUBSTRING(convert(varchar,periodo),1,4) as periodo_my,
SUBSTRING(convert(varchar,periodo),1,4) + '-' + SUBSTRING(convert(varchar,periodo),5,2) as periodo_ym,
fecha_info,
convert(varchar, fecha_info, 103) as fecha_info_dmy
from deuda_previsional
inner join padrones on (identificacion = cuit and habilitado = 1)
where cuit = @cuit
and visible = 1
order by periodo, codigo
end
/*
select top 10 * from deuda_previsional
*/
GO
Depends On
3Used By
No items found