dbo.PANEL_CONTROL_JSON_

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

5
Name Data Type Length Description
@accion varchar 50
@p_cliente int 4
@p_servicio int 4
@desde bigint 8
@hasta bigint 8

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [PANEL_CONTROL_JSON_] 'busqueda',2046807993,47
exec [PANEL_CONTROL_JSON_] 'resultado',2046807993,47,0,0
*/

CREATE OR ALTER PROCEDURE dbo.PANEL_CONTROL_JSON_ 
 -- Add the parameters for the stored procedure here
 @accion     varchar(50),
 @p_cliente int,
 @p_servicio int = 47,
 @desde bigint = 0,
 @hasta bigint = 0

AS
BEGIN
 SET NOCOUNT ON;
 if (@accion = 'busqueda')
 begin
 delete from PANEL_CONTROL_JSON where cliente = @p_cliente and servicio = @p_servicio 
 insert into PANEL_CONTROL_JSON
  (
  pais_servicio,
  country_name_servicio,
  PAIS,
  country_name,
  RAZON_SOCIAL,
  identificacion,
  FAMILIA,
  contraparte,
  clave_indicador,  
  producto_id,
  valor,
  color,
  textcolor,
  svg_data,
  textcaption,
  texto,
  punto,
  cell_data,
  detalle_killer,
  data_CLIENTE,
  CONTRATO
  )
  exec LN_dashboard_cliente_fidelitasprod_mis_prueba 'VALORES_GRILLA_EXT',@p_cliente,
  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
  @p_servicio

  select COUNT(distinct contraparte) as contrapartes, 
  COUNT(*) as total, 
  iif(COUNT(distinct contraparte)=0,0,COUNT(*) / COUNT(distinct contraparte)) as registros_por_contraparte
    from PANEL_CONTROL_JSON
    where cliente = @p_cliente and servicio = @p_servicio 
 end
 if (@accion = 'resultado')
 begin
 if (isnull(@desde,0) = 0) set @desde = (select min(nro_registro) from PANEL_CONTROL_JSON where cliente = @p_cliente and servicio = @p_servicio )
 if (isnull(@hasta,0) = 0) set @hasta = (select max(nro_registro) from PANEL_CONTROL_JSON where cliente = @p_cliente and servicio = @p_servicio )

 select * from PANEL_CONTROL_JSON
    where cliente = @p_cliente and servicio = @p_servicio 
    and nro_registro between @desde and @hasta
 end
END 
GO

Used By

No items found