Advertisement
Ruslan_Rayanov

Widget CheckField

Oct 18th, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 2.96 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[fm_tst-statistic_checkItemField]
  2.     @itemID int,   
  3.     @username nvarchar(256),
  4.     @field nvarchar(256),
  5.     @value nvarchar(max),
  6.     @parameters ExtendedDictionaryParameter readonly
  7. AS
  8. BEGIN
  9.     declare @langID int
  10.     select @langID = try_cast(Value as int) from @parameters where [Key] = 'langID'
  11.  
  12.     declare @valuta nvarchar(32) = iif(@langID=1, 'dollars', 'руб.')
  13.     declare @count nvarchar(32) = iif(@langID=1, 'cnt', 'шт.')
  14.  
  15.     declare @count1 nvarchar(16), @count2 nvarchar(16), @count3 nvarchar(16)
  16.     declare @count11 nvarchar(16), @count22 nvarchar(16), @count33 nvarchar(16)
  17.     declare @tooltip nvarchar(16)
  18.  
  19.     if @field = 'period' begin
  20.         if @value = 1 begin
  21.             select @count1 = '+7', @count11 = '22 000 ' + @valuta
  22.             select @count2 = '+12', @count22 = '101 ' + @count
  23.             select @count3 = '+14', @count33 = '130 000 '+@valuta, @tooltip = iif(@langID=1,'(month)', '(за месяц)')
  24.         end else if @value = 2 begin
  25.             select @count1 = '+5', @count11 = '27 0000 ' + @valuta
  26.             select @count2 = '+56', @count22 = '299 ' + @count
  27.             select @count3 = '+47', @count33 = '450 000 ' + @valuta, @tooltip = iif(@langID=1,'(quartal)','(за квартал)')
  28.         end else if @value = 3 begin
  29.             select @count1 = '+4', @count11 = '25 000 ' + @valuta
  30.             select @count2 = '+12', @count22 = '1305 ' + @count
  31.             select @count3 = '+280', @count33 = '900 000 ' + @valuta, @tooltip = iif(@langID=1,'(year)','(за год)')
  32.         end
  33.     end
  34.  
  35.     declare @ReplaceContainerHtml nvarchar(max)
  36.     select @ReplaceContainerHtml =
  37.     '
  38.    <div class="row mt-2">
  39.         <div class="col-12 col-md-4 border border-1 rounded-left p-3">
  40.           <div class="text-success">'+@count1+'<span class="text-secondary ml-1">'+@tooltip+'</span></div>
  41.           <div class="h3 font-weight-bold text-center">'+@count11+'</div>
  42.           <div class="font-weight-bold text-center text-secondary">'+iif(@langID=1, 'Avg check', 'СРЕДНИЙ ЧЕК')+'</div>
  43.         </div>
  44.         <div class="col-12 col-md-4 border border-1 p-3">
  45.           <div class="text-success">'+@count2+'<span class="text-secondary ml-1">'+@tooltip+'</span></div>
  46.           <div class="h3 font-weight-bold text-center">'+@count22+'</div>
  47.           <div class="font-weight-bold text-center text-secondary">'+iif(@langID=1, 'Orders count', 'КОЛ-ВО ЗАКАЗОВ')+'</div>
  48.         </div>
  49.         <div class="col-12 col-md-4 border border-1 rounded-right p-3">
  50.           <div class="text-success">'+@count3+'<span class="text-secondary ml-1">'+@tooltip+'</span></div>
  51.           <div class="h3 font-weight-bold text-center">'+@count33+'</div>
  52.           <div class="font-weight-bold text-center text-secondary">'+iif(@langID=1, 'Total income', 'ВЫРУЧКА')+'</div>
  53.         </div>
  54.     </div>
  55.    '
  56.  
  57.     -- SELECT 1
  58.     select '' Msg, 1 Result, '' ShowContainer, '' HideContainer, '' RefreshContainer,
  59.         '#selector1' ReplaceContainer, @ReplaceContainerHtml ReplaceContainerHtml
  60. END
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement