dbo.LN_impe_status_datos

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

7
Name Data Type Length Description
@accion varchar 10
@cliente int 4
@puntos int 4
@desde int 4
@hasta int 4
@texto varchar -1
@color varchar 10

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [LN_impe_status_datos] 'select',0

*/

CREATE OR ALTER PROCEDURE dbo.LN_impe_status_datos 
  @accion varchar(10), 
  @cliente int, 
  @puntos int = null, 
  @desde int = null, 
  @hasta int = null, 
  @texto varchar(max) = null, 
  @color varchar(10) = null
AS
BEGIN
 SET NOCOUNT ON;
 if (@accion = 'select')
 begin
  select da.cliente, da.dias,da.puntos, 
      cn.desde, cn.hasta, cn.texto, cn.texto_largo, cn.color_fondo
  from LN_dias_alertas da
  inner join LN_cliente_nivel cn on (cn.cliente = da.cliente and cn.desde = da.puntos and cn.indicador = 286)
  where da.cliente = @cliente and tabla = 'impe_status' order by dias 
 end 
 if (@accion = 'borrar') 
 begin 
  update LN_dias_alertas  set tabla = 'impe_status_ANT' where cliente = @cliente and tabla = 'impe_status'
  update LN_cliente_nivel set indicador = 999286 where cliente = @cliente and indicador = 286
 end 
 if (@accion = 'grabar') 
 begin
  insert into LN_cliente_nivel(cliente,desde,hasta,texto,texto_largo,color_fondo,color_texto,indicador) 
  values (@cliente, @puntos, @puntos+1, @texto, @texto, @color, 'FFFFFF',286) 
  
  insert into LN_dias_alertas(cliente, tabla,dias,puntos,producto) 
  values (@cliente, 'impe_status', @desde, @puntos, 'IMPE')
 end 

END 

/*


select * from LN_dias_alertas where tabla = 'impe_estatus_ANT'
select * from LN_cliente_nivel where indicador = 999286


select * from LN_dias_alertas where cliente = 0 
tabla = 'impe_status'
select * from LN_cliente_nivel where indicador = 286
*/


GO

Used By

No items found