From 538dd39a2c13530ec0076958c74b04e17ef6dec4 Mon Sep 17 00:00:00 2001 From: mirzakaev_tf Date: Tue, 30 Jan 2024 10:46:24 +0500 Subject: [PATCH] =?UTF-8?q?18383=20=D1=80=D0=B0=D1=81=D1=87=D0=B5=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B2=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/docs/Admin manuals/Настройка правил поиска для истории операций/index.md b/docs/Admin manuals/Настройка правил поиска для истории операций/index.md index be06619..c7a8034 100644 --- a/docs/Admin manuals/Настройка правил поиска для истории операций/index.md +++ b/docs/Admin manuals/Настройка правил поиска для истории операций/index.md @@ -476,4 +476,75 @@ where (t."TypeName" = 'EmployeeStatement' and t."CUser" = t."StageUser") or 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" ) , + + ('Расчетный лист') + 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 ds."InternalName" = 'PaySlip'; ``` \ No newline at end of file