update smcard c set accepted=2,flags=0,scaleload=0,cashload=0,receiptok=0 where accepted=1 and datatype=0 and not exists (select (1) from smspec s where doctype='WI' and c.article=s.article); commit;
update smcard set scaleload=0,cashload=0,accepted=0,flags=0 where article in ( select c.article from smcard c, smcomplexarticles a where c.accepted=1 and c.article=a.complexarticle and ((select accepted from smcard where article=a.article)=2)); commit;