20055 выборка по константам

This commit is contained in:
mirzakaev_tf 2024-05-07 10:41:27 +05:00
parent 48daeb5e44
commit db25739970
1 changed files with 29 additions and 0 deletions

View File

@ -1166,4 +1166,33 @@
AND (
t."DocumentDate" IS NULL OR t."DocumentDate" BETWEEN _bdate AND _edate
) and t."DocType" in ('UniversalDocument') ;
```
#### Выборка из учетной политики
??? note "Запрос"
Основной запрос:
```sql
do $newQ$
declare _str text;
begin
end;
$newQ$;
```
Итоговая выборка:
```sql
insert into "tmp_finresult"( "DocCode" , "DocType" , "DocForm" , "AnyColumnA" , "AnyColumnB" , "AnyColumnC", "AnyColumnD", "AnyColumnE", "AnyColumnF", "orgId", "AnyColumnG", "AnyColumnH"
)
select p."VCode", 'Base.AccountingPolitics', 'RulesForDocumentStatusJournalForm' , f."Name", m."Determination", m."ValueText", m."ValueConst", to_char(p."WDate",'DD.MM.YYYY'), p."WUser", p."COrg",
to_char(p."BeginDate",'DD.MM.YYYY'), to_char(p."EndDate",'DD.MM.YYYY')
from acc."AccountingPolitics" p
join comdoc."SettingOfConstants" m on p."VCode" = m."PCode"
join comdoc."VFilials" f on p."COrg" = f."VCode"
where now()::date between coalesce(p."BeginDate",'19700101') and coalesce(p."EndDate",'20700101')
;
```