Advertisement
hecrus

Chart progress

Oct 18th, 2020 (edited)
2,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.68 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[crud_tst-chart1_getItems]
  2.     @filters CRUDFilterParameter READONLY,  
  3.     @sort sql_variant,
  4.     @direction nvarchar(8),
  5.     @page int,
  6.     @pageSize int,
  7.     @username nvarchar(32)
  8. AS
  9. BEGIN
  10.     declare @result TABLE (title nvarchar(256), value int, color nvarchar(128))
  11.     declare @langID int
  12.     select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
  13.  
  14.     declare @vip bit
  15.     select @vip = cast(Value as bit) from @filters where [Key] = 'vip'
  16.  
  17.     if isnull(@vip,0)<>0
  18.         insert into @result
  19.     select 'First company' title, 55 Value, 'pink' color
  20.     union
  21.     select 'Petrov PE' title, 40 Value, 'powderBlue' color
  22.     union
  23.     select 'Ivanov PE' title, 27 Value, 'lightGreen' color
  24.     union
  25.     select 'Condition Limited' title, 22 Value, 'aqua' color
  26.     union
  27.     select 'GorGarSnabStryServiceBit' title, 18 Value, 'lightGrey' color
  28.    
  29.     else
  30.         insert into @result
  31.         select 'First company' title, 55 Value, 'danger' color
  32.         union
  33.         select 'GorGarSnabStryServiceBit' title, 40 Value, 'primary' color
  34.         union
  35.         select 'Condition Limited' title, 27 Value, 'success' color
  36.         union
  37.         select 'Jack and partners' title, 18 Value, 'info' color
  38.         union
  39.         select 'Log solutions' title, 10 Value, 'secondary' color
  40.    
  41.     -- 1 SELECT - сами данные    
  42.     select * from @result
  43.     order by Value Desc
  44.    
  45.     -- 2 SELECT - кол-во в таблице
  46.     select count(*) from @result    
  47.  
  48.     -- 3 SELECT Дополнительные настройки таблицы
  49.     select 'progress' ViewType, 1 HidetitleCount, 1 InstantFilter, iif(@langID=1, 'TOP 5 Active customers', 'Топ 5 наиболее активных заказчиков') Title
  50. END
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement