ред скрипт для отпуска

This commit is contained in:
mirzakaev_tf 2023-05-02 12:55:55 +05:00
parent 99968f3976
commit 0a69e1f259
1 changed files with 3 additions and 2 deletions

View File

@ -86,13 +86,13 @@
```
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",
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, 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() + '8 day'::interval)::date as bd, (now() + '8 day'::interval)::date as ed ) dt
cross join (select (now() + '1 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"
@ -114,6 +114,7 @@ where p."COrg" <> 4 and
) and
w_ch."DateEDM" is not null and
w_ch."DateEnd" is null and
--проверка на созданное заявление с завершенным маршрутом, на отпуск или на перенос
not exists (select 1
from "dfd"."UniversalDocument" AS "ud"