$dep->retrive(); if ($dep->count > 0) { $behalf->where('note1=' . $dep->id[0]); $dep1 = new WpList(1); $dep1->where('id_1=' . $dep->id[0]); $dep1->retrive(); if ($dep1->count > 0) { $behalf->where('note1=' . $dep1->id[0]); } if ($p - prior_dolg < 35) { $behalf->where('prior_dolg < 36'); } } $behalf->retrive(); $behalf->sortBy('fio'); $behalf->tplComboboxInner('IOLIST', 'fio', 'note6'); } $activeBehalf = new WPBehalf(); $tab = $p->note6[0]; $activeBehalf->where("tab=\"{$tab}\" and typeIO=1"); $activeBehalf->retrive(); if ($activeBehalf->count > 0) { $tpl->assign('TABIO', $activeBehalf->tabio[0]); } else { $tpl->assign('TABIO', 0); } $activeio = ''; foreach ($userBehalf->tab as $f) { $r = new WpPerson(); $r->where("SAPR_VIEW_people.note6='{$f}'"); $r->retrive();