16573 оповещение при изменении ФИО

This commit is contained in:
mirzakaev_tf 2023-09-01 14:50:47 +05:00
parent 2339ddd014
commit 239dd06468
2 changed files with 32 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -751,4 +751,35 @@ group by rlU."DocflowUser"
```sql
call dfd."CreateCheckContractor"()
``` -->
``` -->
### Уведомление о перевыпуске сертификата в связи с изменением ФИО
```sql
with list_persons as
( select distinct case when coalesce(sert."LastName",'') <> coalesce(pers."Family",'') then 'фамилия, ' else '' end ||
case when coalesce(sert."FirstName",'') <> coalesce(pers."Name",'') then 'имя, ' else '' end ||
case when coalesce(sert."MiddleName",'') <> coalesce(pers."Father",'') then 'отчество' else '' end as "Changed",
sert."FullName",
coalesce(pers."Family",'') || ' ' || coalesce(pers."Name",'')|| ' ' ||coalesce(pers."Father",'') as "PersonFIO"
from comdoc."ECPCertificateApplication" sert
join rp."RP_PersonContact" pc on sert."DocflowUser" = pc."Code" and pc."IdTypeContact" = 6
join rp."RP_Person" pers on pc."Pcode" = pers."VCode"
where now()::date between sert."BeginDate" and sert."EndDate" and
(coalesce(sert."LastName",'') <> coalesce(pers."Family",'') or
coalesce(sert."FirstName",'') <> coalesce(pers."Name",'') or
coalesce(sert."MiddleName",'') <> coalesce(pers."Father",'')))
insert into "#forInsNotification" ( "txt", "txtSMS", "txtTelegram")
select null as "txt", null as "txtSMS", null as "txtTelegram"
from (select ('<table><tr><th align="left">Изменение</th><th align="left">ФИО в сертификате</th><th align="left">ФИО в Физ.лице</th></tr>' ||
(SELECT DISTINCT string_agg(x."link", '')
FROM ( SELECT '<tr><td>' || coalesce(l."Changed",'') || '</td><td>' || coalesce(l."FullName",'') || '</td>' ||
'<td>' || coalesce(l."PersonFIO", '') || '</td>'
||'</tr>' as "link"
FROM list_persons l ) AS x) || '</table>'
) ::text as "data") d
```
![Уведомление](media/certs.png)