Program sebelum dijalankan seperti dibawah ini
program setelah dijalankan spt di bawah ini
Objek property
objek | Name | caption | Text |
Label1 | Label1 | Took sepatu unaki mart | - |
Label2 | Label2 | Tanggal sekarang | - |
Label3 | Label3 | Kode sepatu | - |
Label4 | Label4 | Merek sepatu | - |
Label5 | Label5 | Harga spatu | - |
Label6 | Label6 | Jumlah beli | - |
Label7 | Label7 | Bonus | - |
Label8 | Label8 | Total | - |
Edit1 | Etanggal | - | - |
Edit2 | Ekode | - | - |
Edit3 | Emerek | - | - |
Edit4 | Ehargasepatu | - | - |
Edit5 | Ejumlah | - | - |
Edit6 | Ebonus | - | - |
Edit7 | Etotal | - | - |
Groupbox | Groupbox1 | Ukuran sepatu | - |
Radio button1 | R40 | 40 | - |
Radio button2 | R38 | 38 | - |
Radio button3 | R36 | 36 | - |
Combobox | ckode | - | - |
Button1 | Blagi | Lagi | - |
Button2 | Bselesai | Selesai | - |
| | | |
Listing program
unit percobaan4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
GroupBox1: TGroupBox;
Label5: TLabel;
r40: TRadioButton;
r38: TRadioButton;
r36: TRadioButton;
ehargasepatu: TEdit;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
blagi: TButton;
bselesai: TButton;
etotal: TEdit;
ebonus: TEdit;
ejumlah: TEdit;
ckode: TComboBox;
emerek: TEdit;
etanggal: TEdit;
procedure r40Click(Sender: TObject);
procedure r38Click(Sender: TObject);
procedure r36Click(Sender: TObject);
procedure ckodeClick(Sender: TObject);
procedure bselesaiClick(Sender: TObject);
procedure blagiClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ejumlahKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
procedure bersih;
procedure hitung;
{ Public declarations }
end;
var
Form2: TForm2;
implementation
procedure TForm2.hitung;
var
a,b,c,d:real;
begin
a := strtofloat(ehargasepatu.Text);
c := strtofloat (ejumlah.Text);
b :=a*strtofloat(ejumlah.Text) ;
etotal.Text :=floattostr (b);
if c >5 then
ebonus.Text :='payung'
else
ebonus.Text :='topi'
end;
procedure TForm2.bersih;
begin
ejumlah.Text :='';
ckode.Text := '';
etotal.Text :='';
ebonus.Text:='' ;
emerek.Text :='';
etanggal.Text:='';
ehargasepatu.Text :='';
r40.checked :=false;
r36.checked :=false;
r38.checked :=false;
Form2.ActiveControl :=ckode;
end;
{$R *.dfm}
procedure TForm2.r40Click(Sender: TObject);
begin
if r40.Checked =true then
ehargasepatu.Text:='150000'
else
ehargasepatu.Text :='0'
end;
procedure TForm2.r38Click(Sender: TObject);
begin
if r38.Checked =true then
ehargasepatu.Text:='120000'
else
ehargasepatu.Text :='0'
end;
procedure TForm2.r36Click(Sender: TObject);
begin
if r36.Checked =true then
ehargasepatu.Text:='100000'
else
ehargasepatu.Text :='0'
end;
procedure TForm2.ckodeClick(Sender: TObject);
begin
if ckode.Text = 'HP002' then
emerek.Text :='hommyped'
else
if ckode.Text ='CV001' then
emerek.Text := 'carvil'
else
if ckode.Text ='NE003' then
emerek.Text := 'New Era'
else
emerek.Text :='0'
end;
procedure TForm2.bselesaiClick(Sender: TObject);
begin
if (application.MessageBox('anda yakin ingin keluar??','Informasi',MB_YESNO)=IDYES)
then
close
else
bersih;
end;
procedure TForm2.blagiClick(Sender: TObject);
begin
ejumlah.Text :='';
ckode.Text := '';
etotal.Text :='';
ebonus.Text:='' ;
emerek.Text :='';
etanggal.Text :='';
ehargasepatu.Text :='';
r40.checked :=false;
r36.checked :=false;
r38.checked :=false;
Form2.ActiveControl :=ckode;
end;
procedure TForm2.FormActivate(Sender: TObject);
begin
etanggal.Text:=formatdatetime('dd/mm/yyyy',date( ));
end;
procedure TForm2.ejumlahKeyPress(Sender: TObject; var Key: Char);
begin
If Key=#13 then
begin
hitung;
end;
end;
end.
Tidak ada komentar:
Posting Komentar