18383 расчетки в истории операций
This commit is contained in:
parent
a3868dba0f
commit
538dd39a2c
|
@ -477,3 +477,74 @@ where (t."TypeName" = 'EmployeeStatement' and t."CUser" = t."StageUser") or
|
|||
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';
|
||||
```
|
Loading…
Reference in New Issue