Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit3;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, Grids, DBGrids, DB, ADODB, Menus, StdCtrls, ExtCtrls, Buttons, unit2,shellapi;
- type
- TForm3 = class(TForm)
- MainMenu1: TMainMenu;
- N1: TMenuItem;
- N3: TMenuItem;
- StringGrid1: TStringGrid;
- BitBtn1: TBitBtn;
- Edit2: TEdit;
- Edit1: TEdit;
- BitBtn2: TBitBtn;
- N4: TMenuItem;
- Label1: TLabel;
- Label2: TLabel;
- N2: TMenuItem;
- BitBtn3: TBitBtn;
- procedure N3Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure BitBtn2Click(Sender: TObject);
- procedure N4Click(Sender: TObject);
- procedure BitBtn3Click(Sender: TObject);
- procedure N2Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form3: TForm3;
- int: integer; // Вводим переменные
- s:real;
- implementation
- {$R *.dfm}
- procedure TForm3.BitBtn1Click(Sender: TObject); // Начало процедуры обработки щелчка
- begin
- s:=0;
- for int:=1 to 4 do begin
- if Stringgrid1.Cells[3,int]=edit1.text
- then s:=s+strtofloat( Stringgrid1.Cells[2,int]);
- end;
- edit2.text:=floattostr (s);
- end;
- procedure TForm3.BitBtn2Click(Sender: TObject); // Процедура очистки данных из полей
- begin
- edit1.clear;
- edit2.clear;
- end;
- procedure TForm3.BitBtn3Click(Sender: TObject); //Процедура вычисления среднемесячного заработка
- begin
- s:=0;
- for int:=1 to 4 do begin
- if Stringgrid1.Cells[3,int]=edit1.text
- then s:=s+strtofloat( Stringgrid1.Cells[2,int])/2;
- end;
- edit2.text:=floattostr (s);
- end;
- procedure TForm3.FormCreate(Sender: TObject); // Процедура при запуске программы
- begin
- StringGrid1.Cells[0,1]:='1'; // При создании формы данные автоматически вводятся в таблицу
- StringGrid1.Cells[0,2]:='2';
- StringGrid1.Cells[0,3]:='3';
- StringGrid1.Cells[0,4]:='4';
- StringGrid1.Cells[1,0]:='Фамилия';
- StringGrid1.Cells[2,0]:='Зарплата';
- StringGrid1.Cells[3,0]:='Наименование цеха' ;
- StringGrid1.Cells[1,1]:='Алексеев';
- StringGrid1.Cells[1,2]:='Борисов';
- StringGrid1.Cells[1,3]:='Гринчук';
- StringGrid1.Cells[1,4]:='Дмитриев';
- StringGrid1.Cells[2,1]:='8000';
- StringGrid1.Cells[2,2]:='12000';
- StringGrid1.Cells[2,3]:='7000';
- StringGrid1.Cells[2,4]:='14000';
- StringGrid1.Cells[3,1]:='Первый';
- StringGrid1.Cells[3,2]:='Второй';
- StringGrid1.Cells[3,3]:='Третий';
- StringGrid1.Cells[3,4]:='Первый';
- end;
- procedure TForm3.N2Click(Sender: TObject); // Подключаем документацию в CHM формате
- begin
- ShellExecute(Handle,
- 'open', PChar('Документация.chm'), nil, nil, SW_SHOWNORMAL);
- end;
- procedure TForm3.N3Click(Sender: TObject); // Процедура выхода через меню
- begin
- close;
- end;
- procedure TForm3.N4Click(Sender: TObject); // Открывает информационное окно
- begin
- form2.showmodal;
- end;
- end.
Add Comment
Please, Sign In to add comment