pole1 := 'id';
pole2 := 'Raion_dvizh';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Vagon';
Button1.SetFocus;
end;
procedure TForm6.addExecute(Sender: TObject);
begin
Form7.Caption := 'Информация по вагону';
Tbl := 'Operations_s_vagonom';
pole1 := 'id';
pole2 := 'key_station_otpr';
pole3 := 'key_front_otpr';
pole4 := 'key_sttion_naznach';
pole5 := 'key_front_naznach';
pole6 := 'date';
pole7 := 'time';
pole8 := 'key_operation';
pole9 := 'key_gruz';
pole10 := 'weight';
pole11 := 'n_dor_ved';
pole12 := 'n_ved';
pole13 := 'key_vagon';
Form7.ShowModal;
if ((EditMode2=false)and(EditIns2)) then
begin
EditMode2:=true;
Form7.ShowModal;
end;
end;
procedure TForm6.editExecute(Sender: TObject);
begin
if (DataModule2.QOSV['OSV.id']=Null) then
begin
ShowMessage('Нечего редактировать');
EditMode2 := false;
end
else
begin
EditMode2 := True;
Form7.ShowModal;
end;
end;
procedure TForm6.delExecute(Sender: TObject);
begin
if (DataModule2.QOSV['OSV.id']=Null) then
begin
ShowMessage('Нечего удалять');
EditMode2 := false;
end
else
begin
Tbl := 'Operations_s_vagonom';
pole1 := 'id';
pole2 := 'key_station_otpr';
pole3 := 'key_front_otpr';
pole4 := 'key_station_naznach';
pole5 := 'key_front_naznach';
pole6 := 'mydate';
pole7 := 'mytime';
pole8 := 'key_operation';
pole9 := 'key_gruz';
pole10 := 'weight';
pole11 := 'n_dor_ved';
pole12 := 'n_ved';
pole13 := 'key_vagon';
ForDel := DataModule2.QOSV['OSV.id'];
DelZapros;
ShowZapros();
TBL:='Vagon';
end;
end;
procedure TForm6.Edit2Exit(Sender: TObject);
begin
try
strtoint(Edit2.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit2.SetFocus;
end;
end;
procedure TForm6.Edit3Exit(Sender: TObject);
begin
try
strtoint(Edit3.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit3.SetFocus;
end;
end;
procedure TForm6.Edit5Exit(Sender: TObject);
begin
try
strtoint(Edit5.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit5.SetFocus;
end;
end;
procedure TForm6.Edit8Exit(Sender: TObject);
begin
try
strtoint(Edit8.Text);
//----далее команды если введённая вещь - число
except
ShowMessage('Здесь должно быть число!!');
Edit8.SetFocus;
end;
end;
end.
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, TabNotBk, Grids, DBGrids, Menus, ActnList;
type
TForm7 = class(TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Edit6: TEdit;
Edit4: TEdit;
Edit3: TEdit;
Button1: TButton;
GroupBox2: TGroupBox;
DBGrid1: TDBGrid;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
Edit1: TEdit;
Edit2: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
ActionList1: TActionList;
PopupMenu1: TPopupMenu;
add: TAction;
edit: TAction;
del: TAction;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure Edit2Enter(Sender: TObject);
procedure Edit9Enter(Sender: TObject);
procedure Edit10Enter(Sender: TObject);
procedure Edit7Enter(Sender: TObject);
procedure Edit8Enter(Sender: TObject);
procedure addExecute(Sender: TObject);
procedure editExecute(Sender: TObject);
procedure delExecute(Sender: TObject);
procedure Edit6Exit(Sender: TObject);
procedure Edit4Exit(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
implementation
Uses Unit2, Unit4, Unit3, Unit8, DateUtils;
{$R *.dfm}
procedure TForm7.FormShow(Sender: TObject);
begin
if EditMode2 then
begin
DBGrid1.Visible := true;
Edit6.Text := DataModule2.QOSV['n_ved'];
Edit4.Text := DataModule2.QOSV['n_dor_ved'];
DateTimePicker1.Date := StrToDate(DataModule2.QOSV['mydate']);
DateTimePicker2.DateTime := StrToTime(DataModule2.QOSV['mytime']);
Edit1.Text := DataModule2.QOSV['SNACH.station'];
Edit1.Tag := StrToInt(DataModule2.QOSV['key_station_otpr']);
Edit2.Text := DataModule2.QOSV['FNACH.front'];
Edit2.Tag := StrToInt(DataModule2.QOSV['key_front_otpr']);
Edit7.Text := DataModule2.QOSV['SKON.station'];
Edit7.Tag := StrToInt(DataModule2.QOSV['key_station_naznach']);
Edit8.Text := DataModule2.QOSV['FKON.front'];
Edit8.Tag := StrToInt(DataModule2.QOSV['key_front_naznach']);
Edit9.Text := DataModule2.QOSV['operation'];
Edit9.Tag := StrToInt(DataModule2.QOSV['key_operation']);
Edit10.Text := DataModule2.QOSV['gruz'];
Edit10.Tag := StrToInt(DataModule2.QOSV['key_gruz']);
Edit3.Text := DataModule2.QOSV['weight'];
Tbl:='Uslugi_sv';
ShowZapros();
end
else
begin
Edit6.Text := '';
Edit4.Text := '';
Edit1.Text := '';
Edit1.Tag := 0;
Edit2.Text := '';
Edit2.Tag := 0;
Edit7.Text := '';
Edit7.Tag := 0;
Edit8.Text := '';
Edit8.Tag := 0;
Edit9.Text := '';
Edit9.Tag := 0;
Edit10.Text := '';
Edit10.Tag := 0;
Edit3.Text := '';
DBGrid1.Visible := false;
DateTimePicker1.Date := Date;
DateTimePicker2.Time := Time;
end;
TBL:='Operations_s_vagonom';
end;
procedure TForm7.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if EditMode2 then
begin
EditMode2:=false;
end;
TBL:='Vagon';
end;
procedure TForm7.Button1Click(Sender: TObject);
var qtmp : string;
begin
ToIns := IntToStr(Edit1.Tag);
ToIns2 := IntToStr(Edit2.Tag);
ToIns3 := IntToStr(Edit7.Tag);
ToIns4 := IntToStr(Edit8.Tag);
ToIns5 := DateToStr(DateTimePicker1.Date);
ToIns6 := TimeToStr(DateTimePicker2.Time);
ToIns7 := IntToStr(Edit9.Tag);
ToIns8 := IntToStr(Edit10.Tag);
ToIns9 := Edit3.Text;
ToIns10 := Edit6.Text;
ToIns11 := Edit4.Text;
ToIns12 := DataModule2.QShow['V.id'];
if ((Edit6.Text<>'')and(Edit4.Text<>'')and(Edit3.Text<>'')and
(Edit1.Text<>'')and(Edit2.Text<>'')and(Edit7.Text<>'')and
(Edit8.Text<>'')and(Edit9.Text<>'')and(Edit10.Text<>'')) then
begin
if EditMode2 then
begin
ForEdit := DataModule2.QOSV['OSV.id'];
InsEdit4 := true;
InsertZapros();
ShowZapros();
end
else
begin
EditIns2 := true;
InsertZapros();
QueryString:='SELECT top 1 id from '+ TBL+' order by id desc';
with DataModule2.Qtmp do
begin
Close;
SQL.Clear;
SQL.Add(QueryString);
Open;
end;
qtmp := DataModule2.Qtmp['id'];
Form7.Close;
ShowZapros();
DataModule2.QShow.Locate('v.id',qtmp,[]);
ForEdit := '-1';
end;
Form7.Close;
end
else
ShowMessage('Все поля обязательны к заполнению!');
end;
procedure TForm7.Edit1Enter(Sender: TObject);
begin
Form3.Caption := 'Станция отправитель';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Station';
pole1 := 'id';
pole2 := 'Station';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit2.SetFocus;
end;
procedure TForm7.Edit2Enter(Sender: TObject);
begin
Form3.Caption := 'Фронт отправитель';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Front';
pole1 := 'id';
pole2 := 'Front';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit7.SetFocus;
end;
procedure TForm7.Edit9Enter(Sender: TObject);
begin
Form3.Caption := 'Операции';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Operation';
pole1 := 'id';
pole2 := 'Operation';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit10.SetFocus;
end;
procedure TForm7.Edit10Enter(Sender: TObject);
begin
Form3.Caption := 'Груз';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Gruz';
pole1 := 'id';
pole2 := 'Gruz';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit3.SetFocus;
end;
procedure TForm7.Edit7Enter(Sender: TObject);
begin
Form3.Caption := 'Станция получатель';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Station';
pole1 := 'id';
pole2 := 'Station';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit8.SetFocus;
end;
procedure TForm7.Edit8Enter(Sender: TObject);
begin
Form3.Caption := 'Фронт получатель';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Front';
pole1 := 'id';
pole2 := 'Front';
pole3 := '';
pole4 := '';
pole5 := '';
pole6 := '';
pole7 := '';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
pole13 := '';
ShowZapros;
Form3.ShowModal;
Tbl := 'Operations_s_vagonom';
Edit9.SetFocus;
end;
procedure TForm7.addExecute(Sender: TObject);
begin
Form8.ShowModal;
end;
procedure TForm7.editExecute(Sender: TObject);
begin
if (DataModule2.Quslugi['USV.id']=Null) then
begin
ShowMessage('Нечего редактировать');
EditMode3 := false;
end
else
begin
EditMode3 := True;
Form8.ShowModal;
end;
end;
procedure TForm7.delExecute(Sender: TObject);
begin
if (DataModule2.Quslugi['USV.id']=Null) then
begin
ShowMessage('Нечего удалять');
EditMode3 := false;
end
else
begin
Tbl := 'Uslugi_sv';
pole1 := 'id';
pole2 := 'zakaz';
pole3 := 'key_vagon';
pole4 := 'key_uslugi';
pole5 := 'key_na';
pole6 := 'key_s';
pole7 := 'cena';
pole8 := '';
pole9 := '';
pole10 := '';
pole11 := '';
pole12 := '';
ForDel := DataModule2.Quslugi['USV.id'];
DelZapros;
ShowZapros();
TBL:='Operations_s_vagonom';
end;
end;
procedure TForm7.Edit6Exit(Sender: TObject);
begin
try
strtoint(Edit6.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit6.SetFocus;
end;
end;
procedure TForm7.Edit4Exit(Sender: TObject);
begin
try
strtoint(Edit4.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit4.SetFocus;
end;
end;
procedure TForm7.Edit3Exit(Sender: TObject);
begin
try
strtoint(Edit3.Text);
except
ShowMessage('Здесь должно быть число!!');
Edit3.SetFocus;
end;
end;
end.
unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, ActnList, Menus;
type
TForm8 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Label2: TLabel;
Label3: TLabel;
DBGrid1: TDBGrid;
Label4: TLabel;
ActionList1: TActionList;
PopupMenu1: TPopupMenu;
add: TAction;
edit: TAction;
del: TAction;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
procedure Edit2Enter(Sender: TObject);
procedure Edit3Enter(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure addExecute(Sender: TObject);
procedure editExecute(Sender: TObject);
procedure delExecute(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Edit1Exit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
Uses unit2, unit4, Unit3, Unit5, Unit7;
{$R *.dfm}
procedure TForm8.Edit2Enter(Sender: TObject);
begin
Form3.Caption := 'Цех заказчик';
Form3.Label1.Caption:= Form3.Caption;
Tbl := 'Ceha';
pole1 := 'id';
pole2 := 'n_ceha';
pole3 := 'bal_schet';
pole4 := '';
pole5 := '';
pole6 := '';