Advertisement
hecrus

Demo2 Get Counters

Oct 17th, 2020
1,045
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.56 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[dashboard_tst-dashboard_getCounters]
  2. @username nvarchar(128)
  3. AS
  4. BEGIN
  5. -- панель чисел вверху дашборда
  6. select
  7.     'Customers' Title,
  8.     'Registered customers in the system' Tooltip,
  9.     'fa fa-user-tie' Icon,
  10.     cast((select count(*) from tst_customers) as nvarchar) Number,
  11.     '<div class="text-danger">VIP - '+cast((select count(*) from tst_customers where vip = 1) as nvarchar)+'</div>' AdditionalNumber,
  12.     'Go' DownTitle,
  13.     '/tst-customers' DownLink
  14. union all
  15. select
  16.     'Products' Title,
  17.     'Product count' Tooltip,
  18.     'fa fas fa-boxes' Icon,
  19.     cast((select count(*) from tst_products where isnull(isVisible,0) != 1) as nvarchar) Number,
  20.     'Hided - '+cast((select count(*) from tst_products where isnull(isVisible,0) = 0) as nvarchar) AdditionalNumber,
  21.     'Go' DownTitle,
  22.     '/tst-cardproducts' DownLink
  23. union all
  24. select
  25.     'Sold' Title,
  26.     'Number of items sold' Tooltip,
  27.     'fa fas fa-check' Icon,
  28.     cast((select sum(cnt) from tst_orders) as nvarchar) Number,
  29.     'Products' AdditionalNumber,
  30.     'Go' DownTitle,
  31.     '/tst-kanban' DownLink
  32. union all
  33. select
  34.     'Sum' Title,
  35.     'Total order sum' Tooltip,
  36.     'fa fas fa-rub' Icon,
  37.     '10.465' Number, -- cast((select sum(cnt*price)/1000000 from tst_orders) as nvarchar) Number,
  38.     'dollars' AdditionalNumber,
  39.     'Go' DownTitle,
  40.     '/tst-chartbar' DownLink
  41.  
  42.     -- здесь можно переименовать динамически названия панелей дашборда (panelCode1 - это код соответствующей панели)
  43.     select 'Name 1' panelCode1, 'Name 2' panelCode2
  44. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement