diff --git a/docs/Admin manuals/СЭД/Настройка внутрисистемных уведомлений/Настройка внутрисистемных уведомлений.md b/docs/Admin manuals/СЭД/Настройка внутрисистемных уведомлений/Настройка внутрисистемных уведомлений.md index 371e375..0edcca5 100644 --- a/docs/Admin manuals/СЭД/Настройка внутрисистемных уведомлений/Настройка внутрисистемных уведомлений.md +++ b/docs/Admin manuals/СЭД/Настройка внутрисистемных уведомлений/Настройка внутрисистемных уведомлений.md @@ -301,6 +301,44 @@ null as "DocName" /*case when "TypeName" = 'Base.RP_DocVacationChanges' then 'П ) ``` +### Оповещение о списке работников, которые не создали заявление об отпуске + +``` +with list as ( +select ud."VCode", ud."IdWorker", atr."Value" as "Vacation", to_char(atrD."DateValue",'DD.MM.YYYY') as "DateBeg" , f."Name" as "COrgName" + from dfd."UniversalDocument" AS ud + join dfd."DocumentConstructor" dc on ud."DocumentCategory" = dc."VCode" + join dfd."DocumentSubtype" ds on dc."DocumentSubtype" = ds."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" = 'string' and atrtype."ColumnName" = '#typeVacation#' + join dfd."DocumentAdditionalAttribute" atrD on ud."VCode" = atrD."PCode" + join dfd."DocumentCategoryAttributeType" atrtypeD on atrD."CategoryAttributeType" = atrtypeD."VCode" and ud."DocumentCategory" = atrtypeD."PCode" and + atrtypeD."AttributeType" = 'Date' and atrtypeD."ColumnName" = '#bdate#' +join comdoc."VFilials" f on ud."COrg" = f."VCode" + where ud."TypeName" = 'NotificationLexema' and + ds."InternalName" = 'NotificationVacation' and + not exists (select 1 + from dfd."UniversalDocument" es + join comdoc."DocflowLink" dle on ud."VCode" = dle."DocCode2" and + ((dle."DocType2" = ud."TypeName" and ud."VCode" = dle."DocCode2") or + (dle."DocType1" = ud."TypeName" and ud."VCode" = dle."DocCode1") + ) + where es."TypeName" = 'EmployeeStatement' ) and + atrD."DateValue" > now()::date ) + +insert into "#forInsNotification" ( "txt", "txtSMS", "txtTelegram") +select null as "txt", null as "txtSMS", null as "txtTelegram" +from (select ('
Организация | Сотрудник | Отпуск |
---|---|---|
' || coalesce(l."COrgName",'') || ' | ' || coalesce(r."NameFull",'') || ' | ' || + '' || coalesce(l."Vacation", '') || ' ' || l."DateBeg" || ' | ' + ||'