unit beras;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
GroupBox1: TGroupBox;
lokal: TRadioButton;
impor: TRadioButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
harga: TEdit;
ComboBox1: TComboBox;
potongan: TEdit;
beli: TEdit;
total: TEdit;
bayar: TEdit;
kembali: TEdit;
lagi: TButton;
keluar: TButton;
GroupBox2: TGroupBox;
cb1: TCheckBox;
cb2: TCheckBox;
cb3: TCheckBox;
Edit1: TEdit;
Label2: TLabel;
Label9: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
procedure lokalClick(Sender: TObject);
procedure imporClick(Sender: TObject);
procedure keluarClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure beliChange(Sender: TObject);
procedure bayarChange(Sender: TObject);
procedure lagiClick(Sender: TObject);
procedure cb1Click(Sender: TObject);
procedure cb2Click(Sender: TObject);
procedure cb3Click(Sender: TObject);
private
{ Private declarations }
public
procedure hitung;
{ Public declarations }
end;
var
Form1: TForm1;
hrg,a,b,c: real;
implementation
{$R *.dfm}
procedure tform1.hitung;
begin
hrg:=a+b+c;
edit1.Text:=floattostr(hrg);
end;
procedure TForm1.lokalClick(Sender: TObject);
begin
if lokal.Checked = true then
harga.Text :='8000'
end;
procedure TForm1.imporClick(Sender: TObject);
begin
if impor.Checked = true then
harga.Text :='10000'
end;
procedure TForm1.keluarClick(Sender: TObject);
begin
close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items.Add('grosir');
combobox1.Items.Add('kg');
combobox1.Items.Add('liter');
edit2.Items.Add('Novia Valintina');
edit3.Items.Add('12.4H.03');
edit6.Items.Add('12094502');
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
var a,b:real;
begin
if combobox1.Text ='grosir' then
begin
a := strtofloat(harga.Text);
b := a*0.15;
potongan.Text :=floattostr(b);
end
else
if combobox1.Text ='kg' then
begin
a:=strtofloat(harga.Text );
b:=a*0.10 ;
potongan.Text :=floattostr(b);
end
else
begin
potongan.Text :='0';
end
end;
procedure TForm1.beliChange(Sender: TObject);
var a,b,c,d:double;
begin
a:=strtofloat(potongan.Text );
b:=strtofloat(beli.Text );
c:=strtofloat(harga.Text );
d:=(c*b)-a;
total.Text :=floattostr(d);
end;
procedure TForm1.bayarChange(Sender: TObject);
var
a,b,c:double;
begin
a:=strtofloat(total.Text );
b:=strtofloat(bayar.Text );
c:=(b-a);
kembali.Text :=floattostr(c);
end;
procedure TForm1.lagiClick(Sender: TObject);
begin
lokal.Checked :=false ;
impor.Checked :=false ;
harga.Text :='0';
potongan.Text :='0';
beli.Text :='0';
total.Text :='0';
bayar.Text :='0';
kembali.Text :='0';
end;
procedure TForm1.cb1Click(Sender: TObject);
begin
if cb1.Checked=true then
a:=strtofloat(harga.Text)*0.1
else
a:=0 ;
hitung ;
end;
procedure TForm1.cb2Click(Sender: TObject);
begin
if cb2.Checked=true then
b:=strtofloat(harga.Text)*0.05
else
b:=0 ;
hitung ;
end;
procedure TForm1.cb3Click(Sender: TObject);
begin
if cb3.Checked=true then
c:=strtofloat(harga.Text)*0
else
c:=0 ;
hitung ;
end;
end.