DBEdit3.ReadOnly:=False;
DM_f.ADOTable3.Edit;
DBEdit1.SetFocus;
end;
procedure TMashini_f.SpeedButton4Click(Sender: TObject);
begin
DM_f.ADOTable3.Delete;
end;
procedure TMashini_f.SpeedButton5Click(Sender: TObject);
begin
if (DBEdit1.Text='') or (DBEdit2.Text='') or
(DBEdit3.Text='')
then
ShowMessage('Заполнитевсеполя')
else begin
DM_f.ADOTable3.Post;
SpeedButton3.Enabled:=true;
SpeedButton4.Enabled:=true;
SpeedButton2.Enabled:=true;
SpeedButton1.Enabled:=true;
SpeedButton7.Enabled:=true;
SpeedButton8.Enabled:=true;
SpeedButton5.Enabled:=False;
SpeedButton6.Enabled:=False;
DBEdit1.ReadOnly:=True;
DBEdit2.ReadOnly:=True;
DBEdit3.ReadOnly:=True;
end;
end;
procedure TMashini_f.SpeedButton6Click(Sender: TObject);
begin
SpeedButton3.Enabled:=true;
SpeedButton4.Enabled:=true;
SpeedButton2.Enabled:=true;
SpeedButton1.Enabled:=true;
SpeedButton7.Enabled:=true;
SpeedButton8.Enabled:=true;
SpeedButton5.Enabled:=False;
SpeedButton6.Enabled:=False;
DBEdit1.ReadOnly:=True;
DBEdit2.ReadOnly:=True;
DBEdit3.ReadOnly:=True;
DM_f.ADOTable3.Cancel;
end;
procedure TMashini_f.FormShow(Sender: TObject);
begin
DM_f.ADOTable3.Filtered:=false;
end;
end.
unit Oformlenie_poezdki
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, Mask, DBCtrls, ExtCtrls, Buttons,
ComCtrls;
type
TOformlenie_poezdki_f = class(TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
DBEdit2: TDBEdit;
DBEdit1: TDBEdit;
DBEdit4: TDBEdit;
DBEdit3: TDBEdit;
DBGrid1: TDBGrid;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
DBEdit16: TDBEdit;
DBEdit15: TDBEdit;
SpeedButton11: TSpeedButton;
SpeedButton3: TSpeedButton;
GroupBox5: TGroupBox;
DBEdit5: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label1: TLabel;
SpeedButton7: TSpeedButton;
SpeedButton1: TSpeedButton;
DBEdit9: TDBEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
GroupBox4: TGroupBox;
SpeedButton10: TSpeedButton;
SpeedButton2: TSpeedButton;
DBEdit10: TDBEdit;
DBEdit8: TDBEdit;
Label8: TLabel;
Label9: TLabel;
Button4: TButton;
Button5: TButton;
GroupBox6: TGroupBox;
Button6: TButton;
Edit1: TEdit;
CheckBox2: TCheckBox;
Label10: TLabel;
DBEdit11: TDBEdit;
DateTimePicker1: TDateTimePicker;
Button7: TButton;
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure GroupBox5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button7Click(Sender: TObject);
procedure GroupBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure GroupBox2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure GroupBox6MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Button6MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Label10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure CheckBox2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Oformlenie_poezdki_f: TOformlenie_poezdki_f;
implementation
uses DM, Glavnaya;
{$R *.dfm}
procedure TOformlenie_poezdki_f.SpeedButton7Click(Sender: TObject);
begin
if
(DBEdit5.Text='') or (DBEdit6.Text='') or (DBEdit7.Text='')
then ShowMessage('Заполните все поля')
else
begin
DM_f.ADOTable6.FieldByName('№ Оператора').AsInteger:=1;
DM_f.ADOTable6.FieldByName('№ Водителя').AsString:=DBEdit10.Text;
DM_f.ADOTable6.FieldByName('№ Машины').AsString:=DBEdit16.Text;
DM_f.ADOTable6.FieldByName('№ Клиента').AsString:=DM_f.ADOTable5.FieldByName('№ Клиента').AsString;
DM_f.ADOTable6.FieldByName('Дата_отправления').AsString:=DBEdit9.Text;
DM_f.ADOTable6.Post;
ShowMessage('Данные сохранены!');//вывод сообщения
DM_f.ADOTable2.Edit;
DM_f.ADOTable2.FieldByName('К-во_поездок').AsInteger:=StrToInt(DBEdit11.Text)+1;
DM_f.ADOTable2.Post;
DM_f.ADOTable3.Edit; //Изменениестатусавыбранноймашины
DM_f.ADOTable3.FieldByName('Статус').AsString:='False'; // Изменениестатусамашины
DM_f.ADOTable3.Post; // Сохранение данных в таблице машины
DM_f.ADOTable2.Edit; //Изменение статуса выбранного водителя
DM_f.ADOTable2.FieldByName('Статус').AsString:='False'; // Изменение статуса водителя
DM_f.ADOTable2.Post; // Сохранение данных в таблице водители
SpeedButton1.Enabled:=true;
Button4.Enabled:=true;
Button5.Enabled:=false;
SpeedButton7.Enabled:=false;
end;
end;
procedure TOformlenie_poezdki_f.SpeedButton10Click(Sender: TObject);
begin
DM_f.ADOTable2.Prior;
end;
procedure TOformlenie_poezdki_f.SpeedButton11Click(Sender: TObject);
begin
DM_f.ADOTable3.Prior;
end;
procedure TOformlenie_poezdki_f.SpeedButton2Click(Sender: TObject);
begin
DM_f.ADOTable2.Next;
end;
procedure TOformlenie_poezdki_f.SpeedButton3Click(Sender: TObject);
begin
DM_f.ADOTable3.Next;
end;
procedure TOformlenie_poezdki_f.SpeedButton1Click(Sender: TObject);
begin
Glavnaya_f.Show;
Oformlenie_poezdki_f.Hide;
end;
procedure TOformlenie_poezdki_f.FormShow(Sender: TObject);
begin
DBEdit9.Text:=DateToStr(date);
DM_f.ADOTable3.Filtered:=False; //Деактивацияфильтра
DM_f.ADOTable3.Filter:='Статус=True'; //Заданиефильтра
DM_f.ADOTable3.Filtered:=True; //Активацияфильтра
DM_f.ADOTable2.Filtered:=False; //Деактивацияфильтра
DM_f.ADOTable2.Filter:='Статус=True' ;//Заданиефильтра;
DM_f.ADOTable2.Filtered:=True;//Деактивацияфильтра
end;
procedure TOformlenie_poezdki_f.Button3Click(Sender: TObject);
begin
DBEdit1.ReadOnly:=true;
DBEdit2.ReadOnly:=true;
DBEdit3.ReadOnly:=true;
DBEdit4.ReadOnly:=true;
Button1.Enabled:=true;
Button2.Enabled:=false;
Button3.Enabled:=false;
SpeedButton1.Enabled:=true;
DM_f.ADOTable5.Cancel;
end;
procedure TOformlenie_poezdki_f.Button2Click(Sender: TObject);
begin
if (DBEdit1.Text='') or (DBEdit2.Text='') or
(DBEdit3.Text='') or (DBEdit4.Text='')
then
ShowMessage('Заполните все поля')
else begin
DM_f.ADOTable5.Post;
DBEdit1.ReadOnly:=true;
DBEdit2.ReadOnly:=true;
DBEdit3.ReadOnly:=true;
DBEdit4.ReadOnly:=true;
Button1.Enabled:=true;
Button2.Enabled:=false;
Button3.Enabled:=false;
SpeedButton1.Enabled:=true;
end;
end;
procedure TOformlenie_poezdki_f.Button1Click(Sender: TObject);
begin
DBEdit1.ReadOnly:=false;
DBEdit2.ReadOnly:=false;
DBEdit3.ReadOnly:=false;
DBEdit4.ReadOnly:=false;
Button1.Enabled:=false;
Button2.Enabled:=true;
Button3.Enabled:=true;
SpeedButton1.Enabled:=False;
DM_f.ADOTable5.Insert;
DBEdit1.SetFocus;
end;
procedure TOformlenie_poezdki_f.SpeedButton5Click(Sender: TObject);
begin
DM_f.ADOTable5.Next;
end;
procedure TOformlenie_poezdki_f.SpeedButton4Click(Sender: TObject);
begin
DM_f.ADOTable5.Prior;
end;
procedure TOformlenie_poezdki_f.Button4Click(Sender: TObject);
begin
DM_f.ADOTable6.Insert;
SpeedButton1.Enabled:=False;
Button4.Enabled:=false;
Button5.Enabled:=true;
SpeedButton7.Enabled:=true;
end;
procedure TOformlenie_poezdki_f.Button5Click(Sender: TObject);
begin
DM_f.ADOTable6.Cancel;
Button4.Enabled:=true;
Button5.Enabled:=false;
SpeedButton7.Enabled:=false;
SpeedButton1.Enabled:=true;
end;
procedure TOformlenie_poezdki_f.Button6Click(Sender: TObject);
begin
if
CheckBox2.Checked then
DM_f.ADOTable5.Filtered:=false
else
begin
DM_f.ADOTable5.Filtered:=false;
DM_f.ADOTable5.Filter:='ФИО_Клиента='''
+ (Edit1.Text)+'''';
DM_f.ADOTable5.Filtered:=true;
end;
end;
procedure TOformlenie_poezdki_f.GroupBox5MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
DBEdit6.Text:=TimeToStr(DateTimePicker1.Time);
end;
procedure TOformlenie_poezdki_f.Button7Click(Sender: TObject);
begin
if (DBEdit16.Text='') and (DBEdit15.Text='') then
begin
ShowMessage('В данный момент нет свободных машин'); //Вывод сообщения
Glavnaya_f.Show;
Oformlenie_poezdki_f.Hide;
end
else
if (DBEdit10.Text='') and (DBEdit8.Text='') then
begin
ShowMessage('В данный момент нет свободных водителей'); //Вывод сообщения
Glavnaya_f.Show;
Oformlenie_poezdki_f.Hide;
end;
end;
procedure TOformlenie_poezdki_f.GroupBox1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.GroupBox2MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.FormMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.GroupBox6MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.DBGrid1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.Button6MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.Edit1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.Label10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
procedure TOformlenie_poezdki_f.CheckBox2MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Button7.Click;
end;
end.
unit Operator
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, StdCtrls, Mask, Grids, DBGrids, Buttons;
type
TOperatory_f = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
SpeedButton7: TSpeedButton;
DBGrid1: TDBGrid;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
SpeedButton3: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton1: TSpeedButton;
Label5: TLabel;
DBEdit5: TDBEdit;
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Operatory_f: TOperatory_f;
implementation
uses Glavnaya, DM;
{$R *.dfm}
procedure TOperatory_f.SpeedButton7Click(Sender: TObject);
begin
Operatory_f.Hide;
Glavnaya_f.Show;
end;
procedure TOperatory_f.SpeedButton3Click(Sender: TObject);
begin
SpeedButton3.Enabled:=false;
SpeedButton4.Enabled:=false;
SpeedButton2.Enabled:=false;
SpeedButton1.Enabled:=false;
SpeedButton7.Enabled:=false;
SpeedButton8.Enabled:=false;
SpeedButton5.Enabled:=true;
SpeedButton6.Enabled:=true;
DBEdit1.ReadOnly:=False;
DBEdit2.ReadOnly:=False;
DBEdit3.ReadOnly:=False;
DBEdit4.ReadOnly:=False;
DBEdit5.ReadOnly:=False;
DBEdit1.SetFocus;
DM_f.ADOTable4.Insert;
end;
procedure TOperatory_f.SpeedButton2Click(Sender: TObject);
begin
DM_f.ADOTable4.Prior;
end;
procedure TOperatory_f.SpeedButton8Click(Sender: TObject);
begin
SpeedButton3.Enabled:=false;
SpeedButton4.Enabled:=false;
SpeedButton2.Enabled:=false;
SpeedButton1.Enabled:=false;
SpeedButton7.Enabled:=false;
SpeedButton8.Enabled:=false;
SpeedButton5.Enabled:=true;
SpeedButton6.Enabled:=true;
DBEdit1.ReadOnly:=False;
DBEdit2.ReadOnly:=False;
DBEdit3.ReadOnly:=False;
DBEdit4.ReadOnly:=False;
DBEdit5.ReadOnly:=False;
DM_f.ADOTable4.Edit;
DBEdit1.SetFocus;
end;
procedure TOperatory_f.SpeedButton4Click(Sender: TObject);
begin
DM_f.ADOTable4.Delete;
end;
procedure TOperatory_f.SpeedButton5Click(Sender: TObject);
begin
if (DBEdit1.Text='') or (DBEdit2.Text='') or
(DBEdit3.Text='') or (DBEdit4.Text='')
then
ShowMessage('Заполните все поля')
else begin
DM_f.ADOTable4.Post;
SpeedButton3.Enabled:=true;
SpeedButton4.Enabled:=true;
SpeedButton2.Enabled:=true;
SpeedButton1.Enabled:=true;
SpeedButton7.Enabled:=true;
SpeedButton8.Enabled:=true;
SpeedButton5.Enabled:=False;
SpeedButton6.Enabled:=False;
DBEdit1.ReadOnly:=True;
DBEdit2.ReadOnly:=True;
DBEdit3.ReadOnly:=True;
DBEdit4.ReadOnly:=true;
DBEdit5.ReadOnly:=true;
end;
end;
procedure TOperatory_f.SpeedButton6Click(Sender: TObject);
begin
SpeedButton3.Enabled:=true;
SpeedButton4.Enabled:=true;
SpeedButton2.Enabled:=true;
SpeedButton1.Enabled:=true;
SpeedButton7.Enabled:=true;
SpeedButton8.Enabled:=true;
SpeedButton5.Enabled:=False;
SpeedButton6.Enabled:=False;
DBEdit1.ReadOnly:=True;
DBEdit2.ReadOnly:=True;
DBEdit3.ReadOnly:=True;
DBEdit4.ReadOnly:=true;
DBEdit5.ReadOnly:=true;
DM_f.ADOTable4.Cancel;
end;
procedure TOperatory_f.SpeedButton1Click(Sender: TObject);
begin
DM_f.ADOTable4.Next;
end;
end.
unit Status
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, Buttons;
type
TStatus_f = class(TForm)
GroupBox2: TGroupBox;
GroupBox1: TGroupBox;