Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_tst-customerOrders_getItems]
- @filters CRUDFilterParameter READONLY,
- @sort sql_variant,
- @direction nvarchar(8),
- @page int,
- @pageSize int,
- @username nvarchar(32)
- AS
- BEGIN
- -- основная процедура настройки таблицы
- -- результирующая таблица (описываем здесь поля)
- -- спецполя для нее: icon_age, prev_age, prevcolor_age, color_age, backcolor_age, desc_name, color, barPercent_age, barClass_age, badge_age
- declare @result TABLE(
- id int,
- product nvarchar(max),
- created nvarchar(max),
- cnt int,
- note nvarchar(max),
- total nvarchar(max)
- )
- declare @langID int
- select @langID = try_cast(Value as int) from @filters where [Key]='langID'
- -- извлекаем доп параметры из URL
- declare @filterItemID int
- select @filterItemID = cast(Value as int) from @filters where [Key] = 'itemID'
- insert into @result select
- id id,
- isnull((select name from tst_products where id = productID), '<span class="badge badge-secondary">'+iif(@langID=1,'no name', 'не указан')+'</span>') product,
- dbo.[as_timeDelay](datediff(minute, created, getdate())) +' назад' created,
- isnull(cnt, 0) cnt,
- isnull(note, '') note,
- cast(isnull(price * cnt, 0) as nvarchar)+'р.' total
- from tst_orders where customerID= @filterItemID
- -- 1 SELECT - сами данные
- select * from @result
- order by id
- OFFSET @PageSize * (@Page - 1) ROWS
- FETCH NEXT @PageSize ROWS ONLY;
- -- 2 SELECT - кол-во в таблице
- select count(*) from @result
- -- 3 SELECT Дополнительные настройки таблицы
- select 1 Compact, 1 HideTitleCount, '10px' FontSize, iif(@langID=1,'Client products', 'Товары клиента') Title --, 1 ZoomCells
- /*Select '' Title,
- '' ToolbarAdditional,
- '' GroupOperationsToolbar,
- '' FastCreateLinkText, '' FastCreateDialogHeader, '' FastCreateDialogPlaceholder,
- 0 HideTitleCount,
- 0 DisableCellTitle,
- '10px' FontSize,
- '{filterCode}' FilterMakeup,
- 1 InstantFilter,
- */
- --'gantt' ViewType,
- -- GanttScale, GanttNavigate, GanttItemForm, GanttItemFormTitle
- -- KanbanItemForm, KanbanItemFormTitle
- -- 4 SELECT Данные для подвала страницы или данные для Ганта/Канбана (если установлен ViewType в 3 SELECT)
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement