-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit11.~pas
156 lines (140 loc) · 4.2 KB
/
Unit11.~pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, jpeg, ExtCtrls;
type
TDAvto = class(TForm)
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
DBEdit7: TDBEdit;
Label10: TLabel;
DBEdit10: TDBEdit;
Button1: TButton;
Button2: TButton;
DBComboBox1: TDBComboBox;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
Edit1: TEdit;
Label8: TLabel;
DBEdit2: TDBEdit;
Label2: TLabel;
Label4: TLabel;
DBEdit4: TDBEdit;
Label9: TLabel;
DBEdit5: TDBEdit;
Label1: TLabel;
DBEdit1: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure DBComboBox1Change(Sender: TObject);
procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit7KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DAvto: TDAvto;
implementation
uses Unit5, Unit6, Unit17, Unit20;
var
s:string;
{$R *.dfm}
procedure TDAvto.Button1Click(Sender: TObject);
begin
if ((DBEdit1.Text='') or (DBEdit3.Text='') or (DBEdit4.Text='') or (DBEdit7.Text='') or (DBEdit2.Text='') or (DBEdit10.Text='') or (DBComboBox1.Text='') or (DBLookupComboBox2.Text=''))
then Showmessage('Ââåäèòå ïîëíûå äàííûå îá àâòîìîáèëå!')
else
try
if TAvto.ADOTable1nal_pricepa.text='åñòü'
then
if DAvto.DBLookupComboBox1.Text=''
then begin
TAvto.ADOTable1zp.Text:='0';
TAvto.ADOTable1gosnomer_pricepa.Text:='';
TAvto.ADOTable1obchiy_obem.Text:= inttostr(Strtoint(TAvto.ADOTable1obem_vmechaemogo_gruza.Text));
TAvto.ADOTable1obchaya_gruzopodemnost.Text:= inttostr(Strtoint(TAvto.ADOTable1gruzopodemnost.Text));
TAvto.Adotable1.post;
DAvto.Close;
end
else begin
s:=DAvto.DBLookupComboBox1.Text;
DAvto.DBEdit5.Text:='1';
TAvto.ADOTable1obchiy_obem.Text:= inttostr(Strtoint(TAvto.ADOTable1obem_vmechaemogo_gruza.Text)+strtoint(TPr.ADOTable1.Lookup('gosnomer_pricepa', Tavto.ADOTable1gosnomer_pricepa.Text, 'obem_gruza')));
TAvto.ADOTable1obchaya_gruzopodemnost.Text:= inttostr(Strtoint(TAvto.ADOTable1gruzopodemnost.Text)+strtoint(TPr.ADOTable1.Lookup('gosnomer_pricepa', Tavto.ADOTable1gosnomer_pricepa.Text, 'gruzopodemnost_pricepa')));
TAvto.Adotable1.post;
TPr.ADOTable1.Locate('gosnomer_pricepa',s,[]);
TPr.ADOTable1.Edit;
TPr.ADOTable1zp.Text:='1';
TPr.Adotable1.post;
DAvto.Close;
end
else begin
TAvto.ADOTable1zp.Text:='0';
TAvto.ADOTable1gosnomer_pricepa.Text:='';
TAvto.ADOTable1obchiy_obem.Text:= inttostr(Strtoint(TAvto.ADOTable1obem_vmechaemogo_gruza.Text));
TAvto.ADOTable1obchaya_gruzopodemnost.Text:= inttostr(Strtoint(TAvto.ADOTable1gruzopodemnost.Text));
TAvto.Adotable1.post;
DAvto.Close;
end;
TAvto.ADOTable1.Filtered:=false;
TPr.ADOTable1.Filtered:=false;
TPr.ADOTable1.Active:=false;
TPr.ADOTable1.Active:=true;
except
showmessage('Àâòîìîáèëü ñ äàííûì êîäîì óæå ñóùåñòâóåò!');
end;
end;
procedure TDAvto.Button2Click(Sender: TObject);
begin
TAvto.ADOTable1.Cancel;
DAvto.Close;
TAvto.ADOTable1.Filtered:=false;
end;
procedure TDAvto.DBComboBox1Change(Sender: TObject);
begin
if DAvto.DBComboBox1.Text='åñòü'
then begin
TPr.ADOTable1.Active:=false;
TPr.ADOTable1.Active:=true;
TPr.ADOTable1.Filtered:=false;
TPr.ADOTable1.Filter:='zp=0';
TPr.ADOTable1.Filtered:=true;
DAvto.DBLookupComboBox1.Visible:=true;
end
else
DAvto.DBLookupComboBox1.Visible:=false;
end;
procedure TDAvto.DBEdit4KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0','1','2','3','4','5','6','7','8','9',char(8)])
then
key:=#0;
end;
procedure TDAvto.DBEdit7KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0','1','2','3','4','5','6','7','8','9',char(8)])
then
key:=#0;
end;
procedure TDAvto.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0','1','2','3','4','5','6','7','8','9',',',char(8)])
then
key:=#0;
end;
procedure TDAvto.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0','1','2','3','4','5','6','7','8','9',char(8)])
then
key:=#0;
end;
end.