ред скрипт для отпуска в справочнике уведомлений
This commit is contained in:
parent
0a0d074df6
commit
86a3739a45
|
@ -50,73 +50,62 @@
|
|||
Пример:
|
||||
|
||||
```
|
||||
iinsert into "#forInsNotification" ("DocflowUser", "txt", "Link", "DocType", "DocName", "DocSubject", "IdWorker", "DateBeg", "Days", "TypeVacation", "Vacation", "DateEnd", "CopyTo")
|
||||
select pc_ch."Code" as "User", '<font size="4"> </font><p style="text-align: center;">' || p_ch."Name" || ' ' || coalesce(p_ch."Father", '') || ', добрый день!</p><p style="text-align: center;"><br></p>
|
||||
|
||||
<p> На основании
|
||||
статьи 123 Трудового кодекса Российской Федерации и согласно утвержденному графику отпусков на ' || p."Year"::text ||' год информируем о дате начала Вашего оплачиваемого отпуска (<b>' || coalesce(tw."Name",ex.name1c,'')||') </b> с <strong>' || to_char(coalesce(m."DateBegPer",m."DateBeg")::date, 'DD.MM.YYYY') || '</strong> сроком на <strong>' || coalesce(m."DaysPer",m."Days")::text
|
||||
|| '</strong> календарных
|
||||
дня(ей). Дата выхода на работу <strong>' ||to_char((coalesce(m."DateEndPer",m."DateEnd") + '1 day'::interval)::date, 'DD.MM.YYYY')
|
||||
|| '</strong>. В случае, если дата выхода на
|
||||
работу приходится на выходной день, она переносится на ближайший рабочий день.</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p> ВАЖНО! </p>
|
||||
|
||||
<p><em>В связи с
|
||||
вышеизложенным Вам следует подать заявление о предоставлении отпуска для
|
||||
своевременного проведения расчетов и подготовки соответствующих документов. </em></p>
|
||||
|
||||
<p><em>Если Вы не
|
||||
планируете использовать отпуск в указанные даты, обязательно сформируйте
|
||||
заявление о переносе отпуска. </em></p>
|
||||
|
||||
<p><strong> </strong></p>
|
||||
|
||||
<p><strong> Заявление на
|
||||
отпуск или перенос отпуска необходимо сформировать в системе КЭДО Lexema по
|
||||
соответствующей операции через кнопку «Операции» на панели инструментов данного
|
||||
уведомления.</strong></p>
|
||||
|
||||
<p><strong> </strong></p>
|
||||
|
||||
<p><strong> Уведомление
|
||||
можно закрыть только после выполнения одного из действий.</strong></p>
|
||||
|
||||
<p><br>
|
||||
Приятного отдыха! </p>
|
||||
<font size="4"></font>' as txt,
|
||||
p."VCode" as "link",p."TypeName",
|
||||
null /*case when "TypeName" = 'Base.RP_DocVacationChanges' then 'Переносы отпусков' else 'График отпусков' end*/,
|
||||
insert into "#forInsNotification" ("DocflowUser", "txt", "Link", "DocType", "DocName", "DocSubject", "IdWorker", "DateBeg", "Days", "TypeVacation", "Vacation", "DateEnd", "CopyTo", "txtSMS", "txtTelegram")
|
||||
select pc_ch."Code" as "User", null as "txt",
|
||||
p."VCode" as "link",p."TypeName", null /*case when "TypeName" = 'Base.RP_DocVacationChanges' then 'Переносы отпусков' else 'График отпусков' end*/,
|
||||
null, /*'Уведомление работника о времени начала отпуска',*/
|
||||
m."IdWorker",
|
||||
coalesce(m."DateBegPer",m."DateBeg")::date as "DateBeg", coalesce(m."DaysPer",m."Days") as "Days",
|
||||
m."HolidayTypeGuid", coalesce(tw."Name",ex.name1c), coalesce(m."DateEndPer",m."DateEnd") as "DateEnd", null as "CopyTo"
|
||||
m."IdWorker", coalesce(m."DateBegPer",m."DateBeg")::date, coalesce(m."DaysPer",m."Days"), m."HolidayTypeGuid", coalesce(tw."Name",ex.name1c), coalesce(m."DateEndPer",m."DateEnd") , null, null as "txtSMS", null as "txtTelegram"
|
||||
from aw."RP_DocVacation" p
|
||||
join aw."RP_WorkerVacation" m on p."VCode" = m."Pcode"
|
||||
cross join (select (now() + '1 day'::interval)::date as bd, (now() + '6 day'::interval)::date as ed ) dt
|
||||
cross join (select (now() + '8 day'::interval)::date as bd, (now() + '8 day'::interval)::date as ed ) dt
|
||||
cross join (select "LocationProtocol" || '//' || "LocationHostName" as "link_txt" from comdoc."DocflowSettings") l
|
||||
join rp."RP_Worker" w_ch on w_ch."VCode" = m."IdWorker"
|
||||
join rp."RP_Person" p_ch on w_ch."IdPerson" = p_ch."VCode"
|
||||
join rp."RP_PersonContact" pc_ch on p_ch."VCode" = pc_ch."Pcode" and pc_ch."IdTypeContact" = 6
|
||||
left join odata.exchange1cguids ex on m."HolidayTypeGuid" = ex.guid and ex.atype = 'TypeVacation' and ex.corg= p."COrg"
|
||||
left join aw."VTypeTimeWork" tw on m."TypeVacation" = tw."VCode"
|
||||
where coalesce(m."DateBegPer",m."DateBeg")>= dt.bd and coalesce(m."DateBegPer",m."DateBeg") <=dt.ed and
|
||||
not exists (select 1
|
||||
from "dfd"."UniversalDocument" AS "ud"
|
||||
join comdoc."ReadListItem" "rl" on "ud"."VCode" = "rl"."DocCode"
|
||||
join comdoc."DocflowLink" "dl" on "dl"."DocCode2" = p."VCode" and "dl"."DocCode1" = "ud"."VCode"
|
||||
where "rl"."DocflowUser" = pc_ch."Code" and
|
||||
"ud"."TypeName" = 'NotificationLexema' and
|
||||
"ud"."Text" like '%'|| to_char(coalesce(m."DateBegPer",m."DateBeg")::date, 'DD.MM.YYYY') ||'%')
|
||||
and 1 = coalesce((select "IdTypeBusy"
|
||||
from rp."RP_WorkerMove" rpwm
|
||||
where rpwm."IdWorker" = w_ch."VCode"
|
||||
and (rpwm."DateEnd" is null
|
||||
OR (now()::date <= coalesce(rpwm."DateEnd", '2100-01-01'::date)))
|
||||
limit 1)
|
||||
, 1)
|
||||
where p."COrg" <> 4 and
|
||||
coalesce(m."DateBegPer",m."DateBeg")>= dt.bd and coalesce(m."DateBegPer",m."DateBeg") <=dt.ed and
|
||||
not exists (select 1
|
||||
from "dfd"."UniversalDocument" AS "ud"
|
||||
join comdoc."ReadListItem" "rl" on "ud"."VCode" = "rl"."DocCode"
|
||||
join comdoc."DocflowLink" "dl" on "dl"."DocCode2" = p."VCode" and "dl"."DocCode1" = "ud"."VCode"
|
||||
join dfd."DocumentAdditionalAttribute" atr on "ud"."VCode" = atr."PCode"
|
||||
join dfd."DocumentCategoryAttributeType" atrtype on "atr"."CategoryAttributeType" = atrtype."VCode" and "ud"."DocumentCategory" = atrtype."PCode" and atrtype."AttributeType" = 'Date' and atrtype."ColumnName" = '#bdate#'
|
||||
where "rl"."DocflowUser" = pc_ch."Code" and
|
||||
"ud"."TypeName" = 'NotificationLexema' and
|
||||
atr."DateValue" = coalesce(m."DateBegPer",m."DateBeg")
|
||||
--"ud"."Text" like '%'|| to_char(coalesce(m."DateBegPer",m."DateBeg")::date, 'DD.MM.YYYY') ||'%'
|
||||
) and
|
||||
w_ch."DateEDM" is not null and
|
||||
w_ch."DateEnd" is null and
|
||||
--проверка на созданное заявление с завершенным маршрутом, на отпуск или на перенос
|
||||
not exists (select 1
|
||||
from "dfd"."UniversalDocument" AS "ud"
|
||||
join dfd."DocumentAdditionalAttribute" atr on "ud"."VCode" = atr."PCode"
|
||||
join dfd."DocumentCategoryAttributeType" atrtype on "atr"."CategoryAttributeType" = atrtype."VCode" and "ud"."DocumentCategory" = atrtype."PCode" and atrtype."AttributeType" = 'Date' and atrtype."ColumnName" = '#bdate#'
|
||||
join dfd."DocumentConstructor" dc on "ud"."DocumentCategory" = dc."VCode"
|
||||
join dfd."DocumentSubtype" ds on dc."DocumentSubtype" = ds."VCode"
|
||||
join comdoc."Route" r on ud."VCode" = r."DocCode" and ud."TypeName" = r."DocType" and r."RouteStatus" = 3
|
||||
where "ud"."TypeName" = 'EmployeeStatement' and
|
||||
"ud"."IdWorker" = m."IdWorker" and
|
||||
atr."DateValue" = coalesce(m."DateBegPer",m."DateBeg") and
|
||||
ds."InternalName" in ('EmployeeStatementVacation','EmployeeStatementTransperVacation') and
|
||||
ud."Removed" is not true and
|
||||
not exists (select 1 from dfd."CancellationAct" a where a."DocCode" = ud."VCode" and a."DocType" = ud."TypeName") and
|
||||
not exists (select 1
|
||||
from comdoc."Route" r
|
||||
join comdoc."RouteStage" rs on r."VCode" = rs."PCode"
|
||||
join comdoc."StageItem" si on rs."VCode" = si."PCode"
|
||||
inner join comdoc."DocflowDocumentSettings" as sts on sts."DocType" = r."DocType"
|
||||
inner join comdoc."DocflowDocumentSettingsDetail" as dfs on dfs."PCode" = sts."VCode" and
|
||||
dfs."DocumentAction" = si."DocumentAction" and
|
||||
dfs."DocumentStatus" = si."DocumentStatus"
|
||||
where r."DocCode" = "ud"."VCode" and
|
||||
r."DocType" = p."TypeName" and
|
||||
dfs."NegativeStatus" is true)
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
Таблица **"#forInsNotification"** представляет собой список логинов и текстов сообщений:
|
||||
|
|
Loading…
Reference in New Issue