
Заключение
Данный программный продукт является удобным решением для хранения информации о работниках предприятия в бухгалтерии. А также может служить в образовательной сфере в качестве примера , написанного в среде Delphi для студентов, работающих в данной среде разработки.
Для разработки этого программного продукта использовался язык программирования Delphi 7.
Приложение 1
Среда разработки
Приложение 2
Внешний вид приложения
Приложение 3
Листинг программы
program Project1;
uses
Forms,
unit1 in 'unit1.pas' {Form2},
Unit2 in 'Unit2.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
unit unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, Spin;
type
TForm2 = class(TForm)
LastName: TLabeledEdit;
Name: TLabeledEdit;
SurName: TLabeledEdit;
BtnAdd: TBitBtn;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
SpinEdit1: TSpinEdit;
Label1: TLabel;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
LabeledEdit6: TLabeledEdit;
Label2: TLabel;
Label3: TLabel;
procedure BtnAddClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses unit2;
procedure TForm2.BtnAddClick(Sender: TObject);
var
i: Integer;
begin
Reset(f);
kadr.LastName := LastName.Text ;
kadr.Name := Name.Text ;
kadr.SurName := SurName.Text ;
kadr.pasp := LabeledEdit1.Text ;
kadr.date := LabeledEdit2.Text;
kadr.dolg := LabeledEdit4.Text ;
kadr.date2:= LabeledEdit3.Text ;
kadr.stag := SpinEdit1.Value;
kadr.oklad := StrToInt(LabeledEdit5.Text) ;
kadr.zp := StrToInt(LabeledEdit6.Text) ;
Seek(f, FileSize(f));
Write(f,kadr);
CloseFile(f);
for I := 0 to ComponentCount - 1 do
if Components[i] is TLabeledEdit then
(Components[i] as TLabeledEdit).Clear ;
spinedit1.value:=0;
End;
END.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, ComCtrls, Grids, Spin;
type
rec = record
LastName: string[30];
Name: string[30];
SurName: string[30];
pasp: string[30];
date: string[10];
stag: integer;
date2: string[10];
dolg: string[30];
oklad:integer;
zp: integer;
end;
type
TForm1 = class(TForm)
Button2: TButton;
Button1: TButton;
StringGrid1: TStringGrid;
Label6: TLabel;
SurName: TLabeledEdit;
Name: TLabeledEdit;
LastName: TLabeledEdit;
BtnFind: TBitBtn;
LabeledEdit1: TLabeledEdit;
Label1: TLabel;
BitBtn1: TBitBtn;
SpinEdit1: TSpinEdit;
Label2: TLabel;
BitBtn2: TBitBtn;
Label3: TLabel;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnFindClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Kadr: rec;
f : File of rec;
implementation
uses unit1;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
const
mas : array[0..8] of String = ('№', 'ФИО', 'Серия и номер паспорта', 'Дата рождения',
'Стаж(лет)', 'Дата приема на работу', 'Должность','Оклад,руб','З/П за год,руб');
var
j: Integer;
begin
AssignFile(f,'Kadr.dat');
if not FileExists('Kadr.dat') then begin
Rewrite(f);
CloseFile(f)
end ;
for j := 0 to 8 do
StringGrid1.Cells[j,0]:=mas[j];
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var
i,j :Integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
StringGrid1.Rows[i].Clear;
StringGrid1.RowCount:=2;
i:=0;
j:=1;
reset(f);
while not EOF(f) do begin
Seek(f, i);
Read(f,kadr);
if SpinEdit1.Value<=kadr.stag then begin
StringGrid1.Cells[0,j]:= IntToStr(j);
StringGrid1.Cells[1,j]:= kadr.LastName +' '+ kadr.Name+' '+kadr.SurName;
StringGrid1.Cells[2,j]:= kadr.pasp;
StringGrid1.Cells[3,j]:= kadr.date;
StringGrid1.Cells[4,j]:= kadr.dolg ;
StringGrid1.Cells[5,j]:= kadr.date2 ;
StringGrid1.Cells[6,j]:= IntToStr(kadr.stag);
StringGrid1.Cells[7,j]:= IntToStr(kadr.oklad) ;
StringGrid1.Cells[8,j]:= IntToStr(kadr.zp ) ;
StringGrid1.RowCount := j + 1;
inc(j);
end;
inc(i);
end;
end;
procedure TForm1.BtnFindClick(Sender: TObject);
var
i,j :Integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
StringGrid1.Rows[i].Clear;
StringGrid1.RowCount:=2;
i:=0;
j:=1;
reset(f);
while not EOF(f) do begin
Seek(f, i);
Read(f,kadr);
if (LastName.text=kadr.LastName) and (Name.text=kadr.Name)and
(SurName.text=kadr.SurName) then begin
StringGrid1.Cells[0,j]:= IntToStr(j);
StringGrid1.Cells[1,j]:= kadr.LastName +' '+ kadr.Name+' '+kadr.SurName;
StringGrid1.Cells[2,j]:= kadr.pasp;
StringGrid1.Cells[3,j]:= kadr.date;
StringGrid1.Cells[4,j]:= kadr.dolg ;
StringGrid1.Cells[5,j]:= kadr.date2 ;
StringGrid1.Cells[6,j]:= IntToStr(kadr.stag);
StringGrid1.Cells[7,j]:= IntToStr(kadr.oklad) ;
StringGrid1.Cells[8,j]:= IntToStr(kadr.zp ) ;
StringGrid1.RowCount := j + 1;
inc(j);
end;
inc(i);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i :Integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
StringGrid1.Rows[i].Clear;
StringGrid1.RowCount:=2;
i:=1;
reset(f);
while not EOF(f) do begin
Seek(f, i-1);
Read(f,kadr);
StringGrid1.Cells[0,i]:= IntToStr(i);
StringGrid1.Cells[1,i]:= kadr.LastName +' '+ kadr.Name+' '+kadr.SurName;
StringGrid1.Cells[2,i]:= kadr.pasp;
StringGrid1.Cells[3,i]:= kadr.date;
StringGrid1.Cells[4,i]:= kadr.dolg ;
StringGrid1.Cells[5,i]:= kadr.date2 ;
StringGrid1.Cells[6,i]:= IntToStr(kadr.stag);
StringGrid1.Cells[7,i]:= IntToStr(kadr.oklad );
StringGrid1.Cells[8,i]:= IntToStr(kadr.zp ) ;
StringGrid1.RowCount := i + 1;
inc(i);
end;
closefile(f);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
i,j :Integer;
begin
for i := 1 to StringGrid1.RowCount - 1 do
StringGrid1.Rows[i].Clear;
StringGrid1.RowCount:=2;
reset(f);
i:=0;
j:=1;
while not EOF(f) do begin
Seek(f, i);
Read(f,kadr);
if kadr.zp=StrToInt(LabeledEdit1.text) then begin
StringGrid1.Cells[0,j]:= IntToStr(j);
StringGrid1.Cells[1,j]:= kadr.LastName +' '+ kadr.Name+' '+kadr.SurName;
StringGrid1.Cells[2,j]:= kadr.pasp;
StringGrid1.Cells[3,j]:= kadr.date;
StringGrid1.Cells[4,j]:= kadr.dolg ;
StringGrid1.Cells[5,j]:= kadr.date2 ;
StringGrid1.Cells[6,j]:= IntToStr(kadr.stag);
StringGrid1.Cells[7,j]:= IntToStr(kadr.oklad) ;
StringGrid1.Cells[8,j]:= IntToStr(kadr.zp ) ;
StringGrid1.RowCount := j + 1;
inc(j);
end;
inc(i);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form2.ShowModal;
End;
END.