diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-1.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-1.png new file mode 100644 index 0000000..5e38983 Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-1.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-2.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-2.png new file mode 100644 index 0000000..edf9e6d Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-2.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-3.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-3.png new file mode 100644 index 0000000..071941a Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-3.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-4.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-4.png new file mode 100644 index 0000000..6d95108 Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-4.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-5.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-5.png new file mode 100644 index 0000000..a90bbf1 Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-5.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-6.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-6.png new file mode 100644 index 0000000..388c2c3 Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-6.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image-7.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image-7.png new file mode 100644 index 0000000..5cf5727 Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image-7.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/image.png b/docs/Admin manuals/Настройка правил поиска для истории операций/image.png new file mode 100644 index 0000000..05f9f1a Binary files /dev/null and b/docs/Admin manuals/Настройка правил поиска для истории операций/image.png differ diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/index.md b/docs/Admin manuals/Настройка правил поиска для истории операций/index.md new file mode 100644 index 0000000..c1914f5 --- /dev/null +++ b/docs/Admin manuals/Настройка правил поиска для истории операций/index.md @@ -0,0 +1,479 @@ +# Настройка правил поиска для Истории операций + +## Описание + +В данной форме настраиваются правила поиска документа для [журнала состояния документов](https://ecm-user-manuals.readthedocs.io/ru/latest/User%20manuals/%D0%A1%D0%AD%D0%94/%D0%98%D1%81%D1%82%D0%BE%D1%80%D0%B8%D1%8F%20%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B9/%D0%98%D1%81%D1%82%D0%BE%D1%80%D0%B8%D1%8F%20%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B9/). +Чтобы открыть данную форму необходимо перейти в Меню - Администрирование - Документооборот - СЭД - Настройка правил поиска для истории операций. Для доступа к данному времени пользователю необходимо назначить роль **rulesforunifieddocumentreg_write** + +## Работа с данной формой + +## Вкладка "Настройки" + +На данной вкладке задаются основные настройки поиска документов. + +* **Не используется** - при включенной функции данная настройка не будет отображаться в журнале состояния документов. + +![Alt text](image-2.png) + +![Alt text](image-1.png) + +* **№ / Наименование** - указывается наименование настройки для отображения в журнале состояния документов. + +![Alt text](image-3.png) + +![Alt text](image-4.png) + +* **Служебное наименование** - указывается служебное наименование по которому фильтруется реестр документов. Служебное наименование должно быть **уникальным** в системе. + +![Alt text](image-5.png) + +**Использовать по умолчанию** - при включенной опции данный запрос будет заполняться автоматически в поле **"Что найти"**: + +![Alt text](image-6.png) + +![Alt text](image-7.png) + +## Вкладка "Запрос" + +В данном блоке указывается часть с динамическим запросом, содержащим непосредственно запроса для отображения документов. + +Примеры запросов: + +### Документы с моим участием + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype","routeId", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype",t."routeId", +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + (case when t."TypeName" = 'LND' then 'Поступил ЛНА на ознакомление' + when t."TypeName" = 'DocumentForSigning' then 'Поступил из 1С документ на подписание' + when t."TypeName" = 'EmployeeStatement' then 'Создано ' || ds."Name" ||' и отправлено на согласование' + else 'Поступил документ на подписание' + end) + from "#tmp_preresult" t + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true ; + ``` + +### Документы с моим участием + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype","routeId", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype",t."routeId", + +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + + (case when t."TypeName" = 'LND' then 'Поступил ЛНА на ознакомление' + when t."TypeName" = 'DocumentForSigning' then 'Поступил из 1С документ на подписание' + when t."TypeName" = 'EmployeeStatement' then 'Создано ' || ds."Name" ||' и отправлено на согласование' + else 'Поступил документ на подписание' + end) + from "#tmp_preresult" t + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + where t."TypeName" = 'EmployeeStatement' + and t."CUser" = t."StageUser"; +``` + +### Мои справки + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype","routeId", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype",t."routeId", + +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + + ('Заказ справки 2НДФЛ') + from "#tmp_preresult" t + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + where (t."TypeName" = 'EmployeeStatement' and t."DocumentSubtype" = 39) OR (t."TypeName" = 'DocumentForSigning' and t."DocumentSubtype" = 40); +``` + +### Инструкции и положения по работе + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype", +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + (case when t."TypeName" = 'LND' then 'Поступил ЛНА на ознакомление' + when t."TypeName" = 'DocumentForSigning' then 'Поступил из 1С документ на подписание' + when t."TypeName" = 'EmployeeStatement' then 'Создано ' || ds."Name" ||' и отправлено на согласование' + else 'Поступил документ на подписание' + end) + from "#tmp_preresult" t + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + where t."TypeName" = 'LND'; +``` + +### Все мои документы (заявления + ЛНА) + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype","routeId", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype",t."routeId", +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + (case when t."TypeName" = 'LND' then 'Поступил ЛНА на ознакомление' + when t."TypeName" = 'DocumentForSigning' then 'Поступил из 1С документ на подписание' + when t."TypeName" = 'EmployeeStatement' then 'Создано ' || ds."Name" ||' и отправлено на согласование' + else 'Поступил документ на подписание' + end) + from "#tmp_preresult" t + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true +where (t."TypeName" = 'EmployeeStatement' and t."CUser" = t."StageUser") or + t."TypeName" = 'LND' +; +``` + +### Все мои документы и действия в системе + +```sql + insert into "#tmp_finresult"( "VCode", "TypeName", "RDate", "DocumentNumber","DocumentSubtype","routeId", "attr", "Operation") + select t."VCode", t."TypeName", t."RDate", t."DocumentNumber",t."DocumentSubtype",t."routeId", +(case when not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName") + then 'Маршрут не создан' + when t."RouteStatus" = 2 then 'Идет согласование. Текущие участники: ' || rst."CurrentDocflowUser" + when t."RouteStatus" = 3 then 'Согласование завершено' + when exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" = 4) + and not exists (select 1 from comdoc."Route" AS r where r."DocCode" = t."VCode" AND r."DocType" = t."TypeName" and r."RouteStatus" in(2,3)) then 'Маршрут согласования отменен' + end::text ) ||' '|| + (select string_agg(dca."Name" || ':' || (case + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') <> '' then atr."Value" + when coalesce(dca."AttributeType",'') = 'string' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'bigint' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is not null then cast(atr."BigIntValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'string' and atr."BigIntValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Unispr' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Post' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.RP_Worker' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contract' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Contractor' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is null and coalesce(atr."Value",'') = '' then ' ' + when coalesce(dca."AttributeType",'') = 'Base.Department' and atr."BigIntValue" is not null and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is not null then cast(atr."MoneyValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'money' and atr."MoneyValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'Date' and atr."DateValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is not null then to_char(atr."DateValue", 'DD.MM.YYYY') + when coalesce(dca."AttributeType",'') = 'DateTime' and atr."DateTimeValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is not null then cast(atr."DoubleValue" as varchar(255)) + when coalesce(dca."AttributeType",'') = 'double' and atr."DoubleValue" is null then ' ' + + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') <> '' then coalesce(atr."Value",' ') + when coalesce(dca."AttributeType",'') = 'ServiceWord' and coalesce(atr."Value",'') = '' then ' ' + + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 0 then substring(coalesce("Value",'|'), position('|' in coalesce("Value",'|'))+1,char_length(coalesce("Value",'|'))) + when coalesce(dca."AttributeType",'') = 'bool' and coalesce("BigIntValue"::integer,0) = 1 then substring(coalesce("Value",'|'),0, position('|' in coalesce("Value",'|'))) + + end), '; ') AS "x" + from dfd."DocumentAdditionalAttribute" atr + join dfd."DocumentCategoryAttributeType" dca on atr."CategoryAttributeType" = dca."VCode" + where t."VCode" = atr."PCode" ) , + (case when t."TypeName" = 'LND' then 'Поступил ЛНА на ознакомление' + when t."TypeName" = 'DocumentForSigning' then 'Поступил из 1С документ на подписание' + when t."TypeName" = 'EmployeeStatement' then 'Создано ' || ds."Name" ||' и отправлено на согласование' + else 'Поступил документ на подписание' + end) + from "#tmp_preresult" t + left join dfd."DocumentSubtype" ds on ds."VCode" = t."DocumentSubtype" + LEFT JOIN LATERAL comdoc."getDocRouteCurrentStatus"(t."VCode", t."TypeName") AS rst ON true ; +``` \ No newline at end of file diff --git a/docs/Admin manuals/Технические роли.md b/docs/Admin manuals/Технические роли.md index a22bcd3..9f1dc26 100644 --- a/docs/Admin manuals/Технические роли.md +++ b/docs/Admin manuals/Технические роли.md @@ -119,6 +119,7 @@ QueryAnalyzer | | super,queryanalyzerform_write | [Настройка параметров обмена с 1С](Настройка%20для%20интеграции%20с%201С/Настройка%20интеграции%20справочников%20и%20документов/Настройка%20интеграция%20справочников%20и%20документов.md) | super, Интеграция с 1С | super, Интеграция с 1С | [Настройка пользователей](Настройка%20пользователей/Настройка%20пользователей.md) | usercompanies_read | super,администратор_склада,docflowadmin,usercompanies_write | [Настройка правил поиска для ЖСД](Настройка%20правил%20поиска%20для%20ЖСД/Настройка%20правил%20поиска%20для%20ЖСД.md) | rulesfordocumentstatusjournal_read | rulesfordocumentstatusjournal_write | +[Настройка правил поиска для истории операций](../Настройка%20правил%20поиска%20для%20истории%20операций/) | rulesforunifieddocumentreg_read | rulesforunifieddocumentreg_write [Настройка рассылки уведомлений](Настройки%20рассылки%20уведомлений/Настройки%20рассылки%20уведомлений.md) | | notificationsendconfform_write | [Настройка служебных пользователей](Настройка%20служебных%20пользователей/Настройка%20служебных%20пользователей.md) | serviceuser_read | serviceuser_write | Настройка справки | helpsetting_read | super,helpsetting_write | diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 987c070..15a0469 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -11,6 +11,7 @@ - [Настройка запрещающих правил для создания документов](Admin manuals/Настройка запрещающих правил/Настройка запрещающих правил.md) - [Настройка обозревателя аналитик](Admin manuals/Настройка ОА/Настройка ОА.md) - [Настройка правил поиска для ЖСД](Admin manuals/Настройка правил поиска для ЖСД/Настройка правил поиска для ЖСД.md) + - [Настройка правил поиска для истории операций](Admin manuals/Настройка правил поиска для истории операций/) - [Настройка своей организации](Admin manuals/Управление компаниями/Управление компаниями.md) - [Настройки сообщений в окне Документооборот](Admin manuals/Настройки сообщений в окне Документооборот/Настройки сообщений в окне Документооборот.md) - [Настройка шаблонов маршрутов](Admin manuals/Настройка шаблонов маршрутов/Настройка шаблонов маршрутов.md)