Tugas Pemrograman Delphi 7
Biaya Rumah Sakit Bakti Insan
Desain Form
.
Listing program nya
procedure TForm12.kodedClick(Sender: TObject);
begin
//www.mamangsuryadi.blogspot.com
if koded.Text = 'DRD01' then
begin
namad.Text := 'dr Okta';
spesialis.Text := 'Penyakit Dalam';
biaya.Text := '200000';
end
else if koded.Text = 'DRJ02' then
begin
//www.mamangsuryadi.blogspot.com
namad.Text := 'dr Yondra';
spesialis.Text := 'Gangguan Jiwa';
biaya.Text := '150000';
end
else if koded.Text = 'DRM03' then
begin
namad.Text := 'dr Wulan';
spesialis.Text := 'Mata';
biaya.Text := '100000';
end
else
begin
namad.Text := '-';
spesialis.Text := '-';
biaya.Text := '0';
//www.mamangsuryadi.blogspot.com
end
end;
procedure TForm12.kodeoKeyPress(Sender: TObject; var Key: Char);
begin
if kodeo.Text = 'B001' then
begin
namao.Text := 'Paracetamol';
hargao.Text := '10000';
end
else if kodeo.Text = 'B002' then
begin
namao.Text := 'Paratusin';
hargao.Text := '12000';
end
else if kodeo.Text = 'B003' then
begin
namao.Text := 'Amoxilin';
hargao.Text := '15000';
end
else
begin
namao.Text := '-';
hargao.Text := '0';
end
end;
procedure TForm12.totalClick(Sender: TObject);
var by,hrg,tot : longint;
begin
by := strtoint(biaya.Text);
hrg := strtoint (hargao.Text);
tot := by + hrg;
totalb.Text := inttostr(tot);
bayar.SetFocus;
end;
procedure TForm12.bayarKeyPress(Sender: TObject; var Key: Char);
var tot,bay,kem : longint;
begin
if key = #13 then
begin
tot := strtoint(totalb.Text);
bay := strtoint(bayar.Text);
kem := bay - tot;
if (bay < tot) then
begin
//www.mamangsuryadi.blogspot.com
showmessage('Maaf Uang Anda Kurang Rp.' + inttostr(tot - bay));
bayar.Text := '';
bayar.setfocus;
end
else
kembali.Text := inttostr(kem);
end
end;
procedure TForm12.bersihClick(Sender: TObject);
begin
koded.Text := 'Pilih';
namad.Text := '';
spesialis.Text := '';
biaya.Text := '';
kodeo.Text := '';
namao.Text := '';
hargao.Text := '';
totalb.Text := '';
bayar.Text := '';
kembali.Text := '';
end;
procedure TForm12.keluarClick(Sender: TObject);
begin
//www.mamangsuryadi.blogspot.com
if (application.MessageBox('Yakin Anda Mau Keluar ?','Konfirmasi',MB_YESNO)=ID_YES) then
close;
end;
end.