dbo.LN_limite_credito_multiple

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_contraparte int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [LN_limite_credito_multiple] 33029
*/

CREATE OR ALTER PROCEDURE dbo.LN_limite_credito_multiple 
 @p_contraparte int
AS
BEGIN
 SET NOCOUNT ON;
 declare @indic int, @gest int, @valor int = null, @producto int = null 
 select  @indic = LN_indicadores.indicador, @producto = ln_productos.producto 
   from LN_indicadores inner join LN_productos on LN_indicadores.producto = LN_productos.producto
  where LN_productos.producto_id = 'limiteCreditoMultiple'
    and LN_indicadores.clave_indicador = 'PORCENTAJE_CREDITO'

 select @gest = LN_gestiones.gestion
   from LN_gestiones
   where LN_gestiones.contraparte = @p_contraparte
   and LN_gestiones.desde <= GETDATE()
   and LN_gestiones.hasta >= GETDATE()
   and LN_gestiones.vigente = 1 

 select @valor = valor_numerico 
   from ln_contraparte_indicadores 
   where contraparte = @p_contraparte
     and gestion = @gest
  and indicador = @indic

 select texto, fecha_solicitud, 
     convert(varchar,fecha_solicitud, 103) as fecha, 
     moneda, 
        monto_credito_solicitado, 
     @valor as porcentaje, 
     (monto_credito_solicitado * @valor / 100) as monto_otorgado
 from LN_dep_econ_compras 
 where contraparte = @p_contraparte 
 and visible = 1 
 and producto = @producto 
 order by fecha_solicitud desc 
END
GO

Used By

No items found