unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls;

type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
tworker=record
fio:string[40];
tabnum:word;
hours:word;
tarif:word;
zarplata:extended;
end;
const
nalog=12;
sverh=144;
var
fz:file of tworker;
ft:textfile;
work:array[1..100] of tworker;
nzap:integer;
filenamez,filenamet:string;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
memo1.Clear;
button1.Hide;
nzap:=0;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
nzap:=nzap+1;
with work[nzap] do begin
fio:=edit1.Text;
tabnum:=strtoint(edit2.Text);
hours:=strtoint(edit3.Text);
tarif:=strtoint(edit4.Text);
If hours<=144 then zarplata:=hours*tarif/100*(100-nalog)
else zarplata:=(hours-sverh)*2*tarif/100*(100-nalog)+sverh*tarif/100*(100-nalog);

memo1.Lines.Add(fio+' '+inttostr(tabnum)+' '+floattostrf(zarplata,fffixed,8,0));
end;
write(fz,work[nzap]);
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
opendialog1.Title:='Создать новый файл';
if opendialog1.Execute then
begin
filenamez:=opendialog1.FileName;
assignfile(fz,filenamez);
rewrite(fz);
end;
button1.Show;
end;



procedure TForm1.Button3Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
filenamez:=opendialog1.FileName;
assignfile(fz,filenamez);
reset(fz);
end;
while not eof(fz) do begin
nzap:=nzap+1;
read(fz,work[nzap]);
with work[nzap] do
memo1.Lines.Add(fio+' '+inttostr(tabnum)+' '+floattostr(zarplata));
end;
button1.show;
end;


procedure TForm1.Button4Click(Sender: TObject);
var i:word;
begin
if savedialog1.Execute then
begin
filenamet:=savedialog1.FileName;
assignfile(ft,filenamet);
rewrite(ft);
end;
for i:=1 to nzap do with work[i] do writeln(ft,i:4,'.',fio,zarplata:8:0);
closefile(ft);
end;

end.
Соседние файлы в папке Сотрудики фирмы 2
  • #
    15.06.2014188 б67project1.dpr
  • #
    15.06.2014876 б67project1.res
  • #
    15.06.20147.74 Кб68unit1.dcu
  • #
    15.06.201451 б67unit1.ddp
  • #
    15.06.20141.68 Кб69unit1.dfm
  • #
    15.06.20142.84 Кб69unit1.pas