Nama
|
Caption
|
Combobox1
|
Combobox1
|
Edit1
|
Edit1
|
Edit2
|
Edit2
|
Edit3
|
Edit3
|
Edit4
|
Edit4
|
Edit5
|
Edit5
|
Edit6
|
Edit6
|
Edit7
|
Edit7
|
Edit8
|
Edit8
|
Edit9
|
Edit9
|
Edit10
|
Edit10
|
Edit11
|
Edit11
|
Listbox1
|
|
Radiobutton1
|
Es Jeruk 5000
|
Radiobutton2
|
Es Teh 3000
|
Radiobutton3
|
Coca Cola 4000
|
Checkbox1
|
Ice Cream 10000
|
Checkbox2
|
Kentang Goreng 8000
|
Checkbox3
|
Burger 12000
|
Button1
|
Hitung
|
Button2
|
Tambah Baru
|
Button3
|
Keluar
|
Combobox1
|
PKT1
|
Ayam Bakar
|
12000
|
|
PKT2
|
Bebek Kaleyo
|
15000
|
|
PKT3
|
Sate Ayam
|
20000
|
ListBox1
|
KD1
|
Bisnis
|
50000
|
|
KD2
|
Premium
|
35000
|
|
KD3
|
Ekonomi
|
20000
|
Ketentuan :
1.
Jika memilih isi combobox , maka nama paket + harga
paket tampil, lalu saat jumlah di isi kemudian di enter maka total harga
(edit4) tampil
2. Jika memilih isi Lisbox,
maka jenis meja dan harga tampil
3. Jika radiobutton di pilih salah satu maka harga
(edit7) akan tampil
4. Jika Chekbox di pilih salah satu atau beberapa di
pilih maka harga (edit8) akan tampil
5. Kemudian jika Hitung (button1) di klik maka total
bayar (edit9) tampil
-ketentuan
total bayar (edit9)= (edit4)+(edit6)+(edit7)+(edit8)
6. Saat uang bayar di ketik, uang kembali tampil otomatis
7. Tambah baru
/ bisa di sebut procedure bersih
8.
Ketika tombol keluar (button3) di klik maka akan
muncul pesan.
unit Unit1;
interface
uses
Windows, Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ListBox1: TListBox;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label5: TLabel;
Label6: TLabel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
GroupBox2: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
Label7: TLabel;
Label8: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure
Button3Click(Sender: TObject);
procedure
Button2Click(Sender: TObject);
procedure
Button1Click(Sender: TObject);
procedure FormCreate(Sender:
TObject);
procedure
ComboBox1Change(Sender: TObject);
procedure
Edit3KeyPress(Sender: TObject; var Key: Char);
procedure
ListBox1Click(Sender: TObject);
procedure
RadioButton1Click(Sender: TObject);
procedure
RadioButton2Click(Sender: TObject);
procedure
RadioButton3Click(Sender: TObject);
procedure
CheckBox1Click(Sender: TObject);
procedure
CheckBox2Click(Sender: TObject);
procedure
CheckBox3Click(Sender: TObject);
procedure
Edit10Change(Sender: TObject);
private
{ Private declarations }
public
procedure bersih;
procedure hitung;
{ Public declarations }
end;
var
Form1: TForm1;
ice,kentang,burger,harga:real;
implementation
{$R *.dfm}
procedure TForm1.hitung;
begin
harga:=ice+kentang+burger;
edit8.text:=floattostr(harga);
end;
procedure TForm1.bersih;
begin
combobox1.text :='-Pilih';
radiobutton1.Checked := false;
radiobutton2.Checked := false;
radiobutton3.Checked := false;
checkbox1.checked := false;
checkbox2.checked := false;
checkbox3.checked := false;
edit1.Text := '';
edit2.Text := '';
edit3.Text := '';
edit4.Text := '0';
edit5.Text := '';
edit6.Text := '0';
edit7.Text := '0';
edit8.Text := '0';
edit9.Text := '0';
edit10.Text := '0';
edit11.Text := '0';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if
(application.MessageBox('Anda ingin Tambah Paket
Lagi?','Information',MB_YESNO)=IDYES) then
begin
bersih;
end
else
begin
close;
end
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
bersih;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,d,e:real;
begin
a:=strtoint(edit4.text);
b:=strtoint(edit6.text);
c:=strtoint(edit7.text);
d:=strtoint(edit8.Text);
e:=a+b+c+d;
edit9.text:=floattostr(e);
edit10.SetFocus;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items.add('PKT1');
combobox1.Items.add('PKT2');
combobox1.Items.add('PKT3');
listbox1.Items.add('KD1');
listbox1.Items.add('KD2');
listbox1.Items.add('KD3');
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if combobox1.Text = 'PKT1' then
begin
edit1.Text :='Ayam Bakar';
edit2.Text :='12000';
end
else
if combobox1.Text = 'PKT2' then
begin
edit1.Text :='Bebek Kaleyo';
edit2.Text :='15000';
end
else
begin
edit1.Text :='Sate Ayam';
edit2.Text :='20000';
end;
edit3.setfocus;
end;
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);
var
a,b,c:real;
begin
if key=#13 then
begin
a:=strtoint(edit2.Text);
b:=strtoint(edit3.Text);
c:=a*b;
edit4.text :=floattostr(c);
end
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
if listbox1.ItemIndex = 0 then
begin
edit5.Text :='Bisnis';
edit6.Text :='50000';
end
else
if listbox1.ItemIndex = 1 then
begin
edit5.Text :='Premium';
edit6.Text :='35000';
end
else
begin
edit5.Text :='Ekonomi';
edit6.Text :='20000';
end;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
if radiobutton1.Checked = true
then
begin
edit7.Text:='5000';
end
else
if radiobutton2.Checked = true
then
begin
edit7.Text:='3000';
end
else
begin
edit7.Text:='4000';
end
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
if radiobutton1.Checked = true then
begin
edit7.Text:='5000';
end
else
if radiobutton2.Checked = true
then
begin
edit7.Text:='3000';
end
else
begin
edit7.Text:='4000';
end
end;
procedure TForm1.RadioButton3Click(Sender: TObject);
begin
if radiobutton1.Checked = true then
begin
edit7.Text:='5000';
end
else
if radiobutton2.Checked = true
then
begin
edit7.Text:='3000';
end
else
begin
edit7.Text:='4000';
end
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked= true then
ice:=10000
else
ice:=0;
hitung;
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if checkbox2.Checked= true then
kentang:=8000
else
kentang:=0;
hitung;
end;
procedure TForm1.CheckBox3Click(Sender: TObject);
begin
if checkbox3.Checked= true then
burger:=10000
else
burger:=0;
hitung;
end;
procedure TForm1.Edit10Change(Sender: TObject);
var
a,b,c:real;
begin
a:=strtoint(edit9.Text);
b:=strtoint(edit10.Text);
c:=b-a;
edit11.Text:=floattostr(c);
end;
end.
Create By : Heey Riku
0 komentar:
Posting Komentar