Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[pg_crumbs_pay]
- @roles nvarchar(128),
- @itemID nvarchar(128) = '',
- @urlParameters CRUDFilterParameter READONLY
- AS
- BEGIN
- declare @g uniqueidentifier = try_convert(uniqueidentifier, @itemID)
- declare @redirectUrl nvarchar(max) = iif(@g is null, '/', '')
- declare @financeID int
- declare @financeStatus nvarchar(max)
- declare @sum float = 0
- declare @orderID int = 123
- declare @orderDesc nvarchar(max) = ''
- declare @fio nvarchar(max) = ''
- declare @email nvarchar(max) = ''
- declare @phone nvarchar(max) = ''
- select @financeID = f.id, @sum = f.[sum],@orderID = o.id,
- @orderDesc = o.description,
- @fio = isnull((select top 1 isnull(firstname, '') + ' ' + isnull(surname, '') from ctr_contacts where contragentID = client.contragentID), ''),
- @email = isnull((select top 1 email from ctr_contacts where contragentID = client.contragentID), ''),
- @phone = isnull((select top 1 phone1 from ctr_contacts where contragentID = client.contragentID), ''),
- @financeStatus = (select code from fin_financeStatuses where id = f.statusID)
- from fin_finances f
- inner join crm_orders o on f.relatedItemID = o.id
- inner join crm_clients client on client.id = o.clientID
- where guid = @g and relatedTypeCode='order'
- declare @title nvarchar(max) = ''
- declare @result TABLE (title nvarchar(256), link nvarchar(256), tooltip nvarchar(256),
- ord int, [right] bit, customLink nvarchar(512))
- -- SELECT 1 Breadcrumbs
- select * from @result order by ord
- -- SELECT 2 page settings
- select @title Title, '' Description, '' Keywords, @redirectUrl RedirectUrl
- declare @header nvarchar(max) = '<h2>Оплата по счету #'+isnull(cast(@financeID as nvarchar), '--' )+' на сумму '+isnull(try_cast(@sum as nvarchar) ,'')+' руб.</h2>
- <p>Услуга - '+isnull(@orderDesc,'')+'</p>'
- declare @form nvarchar(max) = ''
- declare @yooShopID nvarchar(max) = dbo.as_setting('yookassa.payment_shopId', '')
- set @form = iif(isnull(@yooShopID, '') = '', '<div class="alert alert-warning">Не задан ключ Yookassa (publicID)</div>',
- '<div class="as-form" data-code="yookassapay" data-itemID="'+convert(nvarchar(128),@g)+'"></div>')
- -- SELECT 3
- select '<div class="as-panel mx-auto" style="max-width: 600px;">'+
- @header+
- iif(@financeStatus in ('done', 'hold', 'deleted'), '<div class="alert alert-warning">
- По данному счету нельзя провести оплату (статус <b>'+@financeStatus+'</b>)</div>', @form)+'
- </div>' text
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement