Сотруднику год назад было назначено временное заместительство на 1 месяц.
Выяснилось, что теперь этому сотруднику постоянно выводит должность сотрудника, которого он замещал.
И это не единичный случай.
Выполняется запрос
Код: Выделить всё
create view
var
  sPath : string;
  wType : word;
  wId   : word;
  hDBFh,
  fDBFf : longint;
  bExPr : boolean;
  l_date : date;
  intStaj  : integer;
  iStaj  : RunStaj;
from
  Persons
 ,LSchet
 ,Appointments
 ,Catalogs
 ,Synonym Catalogs CatStaj
 ,KlRejim
 ,Education
 ,tmpDBF
where
((
    Persons.nRec == Appointments.Person
and Persons.nRec == LSchet.TPerson
))
order by Appointments.AppointDate
  
bounds PersInArchive   
    as  'У' == Persons.IsEmployee Ordered by Persons.FIO
bounds AllPers         
    as  'С' == Persons.IsEmployee Ordered by Persons.FIO
bounds PersIsEmployee  
    as  'С' == Persons.IsEmployee  and
          0 == Persons.DisDate(noindex) ordered by Persons.FIO
;
Код: Выделить всё
  if getfirst Catalogs 
    where ((Appointments.Post == Catalogs.nRec)) = tsok
      {
        StrV[6] := Catalogs.nRec;
        StrV[7] := Catalogs.Name;       
      }
Как получить именно текущую должность?
