103
datamodule1.Query_view_dolgnost.Locate('Должность',form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.Fi
eldByName('Должность').AsString,[]);
form_sotrudnik.Edit_login.Text :=
form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Логин').AsString;
datamodule1.Table_dostup.Locate('name_dostup',form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByN
ame('Уровень_доступа').AsString,[]);
form_sotrudnik.Label_login.Caption :=
form_sotrudnik.DBGrid_sotrudnik.DataSource.DataSet.FieldByName('Логин').AsString;
form_sotrudnik.Button_add.Caption := 'Исправить';
end;
procedure TForm_sotrudnik.CheckBox_loginClick(Sender: TObject);
begin
if form_sotrudnik.CheckBox_login.Checked = True then form_sotrudnik.GroupBox_login.Visible := False
else
form_sotrudnik.GroupBox_login.Visible := True;end;
procedure TForm_sotrudnik.FormCreate(Sender: TObject);
var buf_zapros : string;
begin clear_label;end;
procedure TForm_sotrudnik.FormShow(Sender: TObject);
begin
datamodule1.Table_zavod.active := False; datamodule1.Table_zavod.active := True;
datamodule1.Table_zavod_view.Active := False; datamodule1.Table_zavod_view.Active := True;
view_sotrudnik; view_otdel; view_dolgnost;
end;
procedure TForm_sotrudnik.view_sotrudnik;
var buf_kav, buf_zapros : string;
begin
buf_zapros := 'SELECT sotrudnik.tabel_nomer as Табель_номер, sotrudnik.family as Фамилия,
sotrudnik.first_name as Имя, '
+' sotrudnik.second_name as Отчество, sotrudnik.phone as Телефон, zavod.name_zavod as Предприятие,
otdel.name_otdel as'
+' Отдел, dolgnost.name_dolgnost as Должность, dolgnost.oklad as Оклад, login_password.login as Логин,
dostup.name_dostup as Уровень_доступа '
+' FROM dostup RIGHT JOIN (login_password RIGHT JOIN ((zavod INNER JOIN (otdel INNER JOIN
dolgnost ON otdel.id_otdel = dolgnost.id_otdel) ON '
+' zavod.id_zavod = otdel.id_zavod) INNER JOIN sotrudnik ON dolgnost.id_dolgnost = sotrudnik.id_dolgnost)
ON login_password.login = sotrudnik.login) ON dostup.id_dostup = sotrudnik.dostup '
+' ORDER BY sotrudnik.family, sotrudnik.first_name, sotrudnik.second_name;';
datamodule1.Query_view_sotrudnik.Close;