122
procedure TForm_doctor_talon.MonthCalendar_endDblClick(Sender: TObject);
begin view_talon; end;
procedure TForm_doctor_talon.view_talon;
var buf_zapros,buf_kav : string;
myYear, myMonth, myDay : Word;
date_talon_begin : string;
date_talon_end : string;
begin
DecodeDate(Form_doctor_talon.MonthCalendar_begin.Date, myYear, myMonth, myDay);
date_talon_begin := '#'+inttostr(myMonth)+'/'+inttostr(myDay)+'/'+inttostr(myYear)+'#';
DecodeDate(Form_doctor_talon.MonthCalendar_end.Date, myYear, myMonth, myDay);
date_talon_end := '#'+inttostr(myMonth)+'/'+inttostr(myDay)+'/'+inttostr(myYear)+'#';
buf_zapros := 'SELECT talon.time_talon as Время_приема, pacient.snils as СНИЛС, pacient.Family as Фамилия,
pacient.first_name as Имя, pacient.second_name as Отчество, pacient.date_born as Дата_рождения, pacient.polis as
Полис '
+' FROM pol INNER JOIN (Special INNER JOIN (pacient INNER JOIN talon ON pacient.snils = talon.snils) ON
Special.Код = talon.doctor) ON pol.id_pol = pacient.pol '
+' WHERE talon.date_talon >= '+date_talon_begin + ' AND talon.date_talon <= '+date_talon_end
+' AND Special.Код = '+ Form_doctor_talon.DBGrid_doctor.DataSource.DataSet.FieldByName('Код').AsString
+' ORDER BY talon.date_talon,talon.time_talon;';
datamodule1.Query_view_talon.Close; datamodule1.Query_view_talon.SQL.Clear;
datamodule1.Query_view_talon.SQL.Text := buf_zapros; datamodule1.Query_view_talon.Open;
view_dbgrid_talon;
end;
procedure TForm_doctor_talon.view_dbgrid_talon;
begin
Form_doctor_talon.DBGrid_view_talon.Columns[0].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[1].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[2].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[3].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[4].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[5].Width := 100;
Form_doctor_talon.DBGrid_view_talon.Columns[6].Width := 100;end;
procedure TForm_doctor_talon.view_doctor;
var buf_zapros,buf_kav : string;
begin
buf_kav := '''';
buf_zapros := 'SELECT Special.Код, Special.name_special as Специальность,Special.uchastok as Участок,
Doctor.Family as Фамилия, Doctor.first_name as Имя, Doctor.Second_name as Отчество '
+' FROM Special INNER JOIN (Doctor INNER JOIN doctor_special ON Doctor.tabel_nomer =
doctor_special.doctor) ON Special.Код = doctor_special.special '
+' ORDER BY Special.name_special;';
datamodule1.Query_doctor_talon.Close; datamodule1.Query_doctor_talon.SQL.Clear;
datamodule1.Query_doctor_talon.SQL.Text := buf_zapros; datamodule1.Query_doctor_talon.Open;
dbgrid_doctor_talon;end;
procedure TForm_doctor_talon.dbgrid_doctor_talon;
begin
Form_doctor_talon.DBGrid_doctor.Columns[0].Visible := False;
Form_doctor_talon.DBGrid_doctor.Columns[1].Width := 150;
Form_doctor_talon.DBGrid_doctor.Columns[2].Width := 150;
Form_doctor_talon.DBGrid_doctor.Columns[3].Width := 150;
Form_doctor_talon.DBGrid_doctor.Columns[4].Width := 150;end;
end.