dbo.LN_control_calidad_por_cuit_31052022

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@p_cliente int 4
@p_cuit varchar 20

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.LN_control_calidad_por_cuit_31052022
@p_cliente int, 
@p_cuit    varchar(20) 
AS
BEGIN
    SET NOCOUNT ON;

 select distinct socios.c01_cuit_soc as cuit, padrones2.nombre_persona as nombre, car_nombre as cargo
   from padrones  
   inner join socios on socios.c01_cuit = padrones.identificacion 
   inner join padrones padrones2 on padrones2.identificacion = socios.c01_cuit_soc and padrones2.habilitado = 1 
   inner join LN_control_black_list on socios.c01_cuit_soc = LN_control_black_list.identificacion
   left join cargos on cargos.car_codigo = socios.car_codigo 
   where padrones.identificacion = @p_cuit
    and socios.visible = 1
    and isnull(socios.c04_ultimo,'') != 'N'
    and LN_control_black_list.visible = 1
    and LN_control_black_list.cliente = @p_cliente

    union all 

   select distinct padrones.identificacion as cuit, padrones.nombre_persona as nombre, '' as cargo
   from padrones
   inner join LN_control_black_list on LN_control_black_list.identificacion = padrones.identificacion
   where padrones.identificacion = @p_cuit
    and LN_control_black_list.visible = 1
    and LN_control_black_list.cliente = @p_cliente
END 

GO

Used By

No items found