Различия
Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
общее.описание:скидки:скидки.и.программы [2019/04/26 12:09] a.korobka |
общее.описание:скидки:скидки.и.программы [2019/05/08 10:21] (текущий) |
||
---|---|---|---|
Строка 19: | Строка 19: | ||
declare did integer; | declare did integer; | ||
begin | begin | ||
- | for execute statement ('select dname, startdate, disdate, comment, list(f.shortname, ascii_char(10)), did | + | for select dname, bdate, fdate, comment, flist, |
- | from discountsprav d | + | case when pos=0 then did else (select min(dd.did) from discountsprav dd |
- | left join FILIAL_GROUP_LINKS fl on fl.filial_group_id=d.filial_group_id | + | where dd.dtype=1 and dd.dname starting with trim(substring(d.dname from 1 for d.pos-1))) end |
- | left join filials f on f.filid=fl.filial | + | from (select dname, startdate bdate, disdate fdate, comment, list(f.shortname, ascii_char(10)) flist, did, position('(' in dname) pos |
- | where dtype=1 | + | from discountsprav d |
- | and (disdate is null or disdate>current_date) | + | left join FILIAL_GROUP_LINKS fl on fl.filial_group_id=d.filial_group_id |
- | and (f.filid is null or f.filid>0 and coalesce(f.dis_in_schedule,0)=0) | + | left join filials f on f.filid=fl.filial |
- | group by 1, 2, 3, 4, 6 order by 1') | + | where dtype=1 |
- | on external '192.168.2.47:MED99' as user 'CHEA' password 'PDNTP' | + | and (disdate is null or disdate>current_date) |
+ | and (f.filid is null or f.filid>0 and coalesce(f.dis_in_schedule,0)=0) | ||
+ | group by 1, 2, 3, 4, 6, 7) d | ||
+ | order by 1 | ||
into dname, bdate, fdate, comment, flist, did do | into dname, bdate, fdate, comment, flist, did do | ||
begin | begin | ||
Строка 53: | Строка 56: | ||
declare did integer; | declare did integer; | ||
begin | begin | ||
- | for execute statement ('select * from (select dname, did, | + | for select dname, fdate, schname, comment, |
- | cast(minvalue(coalesce(d.disdate, ''01.01.2100''), ws.disdate) as date) fdate, | + | case when pos=0 then d.did else (select min(dd.did) from discountsprav dd |
- | substring(ws.kodoper||'' ''||ws.schname from 1 for 65) schname, comment | + | where dd.dtype=3 and dd.dname starting with trim(substring(d.dname from 1 for d.pos-1))) end did |
- | from discountsprav d | + | from (select dname, did, position('(' in dname) pos, |
- | left join wschema ws on ws.schid=d.schid where dtype=3) | + | cast(minvalue(coalesce(d.disdate, '01.01.2100'), ws.disdate) as date) fdate, |
- | where (fdate is null or fdate>current_date) | + | substring(ws.kodoper||' '||ws.schname from 1 for 65) schname, comment |
- | order by 1') | + | from discountsprav d |
- | on external '192.168.2.47:MED99' as user 'CHEA' password 'PDNTP' | + | left join wschema ws on ws.schid=d.schid |
- | into dname, did, fdate, schname, comment do | + | left join user$pricestructure ps on ps.structid=ws.structid |
+ | where dtype=3 and d.schid is not null | ||
+ | and ps.fdate>= current_date) d | ||
+ | where (fdate is null or fdate>current_date) | ||
+ | order by 1 | ||
+ | into dname, fdate, schname, comment, did do | ||
begin | begin | ||
dname = '[[:общее.описание:скидки:'||did||'|'||dname||']]'; | dname = '[[:общее.описание:скидки:'||did||'|'||dname||']]'; |