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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Menus;
const
name_f = 'uchet_postup.dat';
type
TPostup = record
Nnakl: Integer;
ktov: integer;
kgrup: integer;
naimgr: string[25];
Date: TDateTime;
Naimt: string[30];
Post: string[25];
Cena: Real;
Kol: integer;
end;
type
TForm1 = class(TForm)
pnl1: TPanel;
btn1: TButton;
lbl1: TLabel;
pnl2: TPanel;
btn3: TButton;
edt2: TEdit;
btn2: TButton;
RichEdit1: TRichEdit;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
Label5: TLabel;
Label8: TLabel;
Label9: TLabel;
Label2: TLabel;
Label11: TLabel;
Label1: TLabel;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
Button1: TButton;
Edit1: TEdit;
Label10: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
procedure FormCreate(Sender: TObject);
procedure btn3Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure rb2Click(Sender: TObject);
procedure edt2Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure pnl2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
f: file of TPostup;
W: TPostup;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
if FileExists (name_f) then
begin
AssignFile(f,name_f);
Reset(f);
while not Eof(f) do
begin
read(f,w);
richedit1.Lines.Add(' '+w.Nnakl+' '+w.ktov+' '+w.Naimt+' '+w.kgrup+' '+w.naimgr+' '+w.Date+' '+w.Post+' '+w.Cena+' '+w.Kol);
end
end
else
begin
AssignFile(f,name_f);
Rewrite(f);
ShowMessage('ôàéë ñîçäàí');
end;
end;
procedure TForm1.btn3Click(Sender: TObject);
begin
w.Nnakl:=edit2.Text;
w.ktov:=edit3.Text;
w.Naimt:=edit4.Text;
w.kgrup:=edit5.Text;
w.naimgr:=edit6.Text;
w.Post:=edit7.Text;
w.Kol:=edit8.Text;
w.Cena:=edit9.Text;
w.Date:=edit10.Text;
write(F,W);
richedit1.Lines.Add(' '+w.Nnakl+' '+w.ktov+' '+w.Naimt+' '+w.kgrup+' '+w.naimgr+' '+w.Date+' '+w.Post+' '+w.Cena+' '+w.Kol);
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
richedit1.Lines.Clear;
Seek(f,0);
if rb1.Checked Then
while not Eof(f) do
begin
read(f,w);
if w.Naimt=edt2.Text then
begin
richedit1.Lines.Add(' '+w.Nnakl+' '+w.ktov+' '+w.Naimt+' '+w.kgrup+' '+w.naimgr+' '+w.Date+' '+w.Post+' '+w.Cena+' '+w.Kol);
end
else
end
else
end;
procedure TForm1.btn2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
richedit1.Lines.Clear;
Seek(f,0);
if rb1.Checked Then
while not Eof(f) do
begin
read(f,w);
if w.post=edit1.Text then
begin
richedit1.Lines.Add(' '+w.Nnakl+' '+w.ktov+' '+w.Naimt+' '+w.kgrup+' '+w.naimgr+' '+w.Date+' '+w.Post+' '+w.Cena+' '+w.Kol);
end
else
end
else
end;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
if opendialog1.execute then
begin
assignfile(f,opendialog1.FileName);
reset(f);
read(f,w);
end;
closefile(f);
end;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
if savedialog1.Execute then
begin
assignfile(f,savedialog1.filename);
rewrite(f);
closefile(f);
end;
end;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
close;
end;
procedure TForm1.pnl2Click(Sender: TObject);
begin
end;
end. |