dbo.ln_dictamen_vrm_detalle_

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@contraparte int 4
@gestion int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [ln_dictamen_vrm_detalle_] 185145, 183110
exec [ln_dictamen_vrm_detalle_] 192853, 191196
*/


CREATE OR ALTER PROCEDURE dbo.ln_dictamen_vrm_detalle_ 
  @contraparte int, 
  @gestion int = null  
AS
BEGIN
 SET NOCOUNT ON;

 if (@gestion is null)
    select @gestion = gestion from LN_gestiones 
  where contraparte = @contraparte 
   and LN_gestiones.vigente = 1 and LN_gestiones.desde <= GETDATE() and LN_gestiones.hasta >= GETDATE()

 select top 1 i.contraparte, p.identificacion, a.etiqueta, 
        i.valor_memo, d.detalle, d.created, 
     case i.valor_texto
     when 'AA' then  '63b68c'
     when 'NA' then  'A72B2A'
     else '000000'
     end as color
    from LN_contraparte_indicadores i
    inner join LN_contrapartes c on c.contraparte = i.contraparte
    inner join padrones p        on p.id_padron = c.id_padron
    inner join LN_indicadores a  on a.indicador = i.indicador
     left join ln_dictamen_vrm_detalle d on (i.gestion = d.gestion and i.indicador = d.indicador)
  where i.contraparte = @contraparte 
     and i.gestion = @gestion
  and i.visible = 1 
  and i.indicador = 452 
 order by d.created desc 

END
/*
select * from ln_indicadores where indicador = 396
select * from ln_indicadores where producto = 2080

update LN_indicadores set etiqueta = 'Dictamen VRM Sugerido' where indicador = 452
select * from ln_dictamen_vrm_detalle where visible = 1
select * from ln_dictamen_vrm_detalle 
inner join ln_gestiones on ln_gestiones.gestion = ln_dictamen_vrm_detalle.gestion 
where visible = 1 and vigente = 1


opciones


APTO|NO APTO|NO APLICA|LINK VENCIDO^AA|NA|XX|L

select distinct valor_texto from ln_contraparte_indicadores where indicador = 452
*/

GO

Used By

No items found