Program Transaksi Sederhana dengan Borland Delphi 7

Komponen yang digunakan :

- Komponen Standart : Panel, Edit, Label, Memo, Button
Listing Program :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;

Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Memo4: TMemo;
Memo5: TMemo;
Edit7: TEdit;
Memo6: TMemo;
Timer1: TTimer;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
var harga1,harga2,harga3,tot1,tot2,tot3,total,diskon,uang,bayar,kembali: currency;
jml1,jml2,jml3:integer;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Text:=’ -Pilih-’;
ComboBox2.Text:=’ -Pilih-’;
ComboBox3.Text:=’ -Pilih-’;
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit7.Clear;
Memo1.Clear;
Memo2.Clear;
Memo3.Clear;
Memo4.Clear;
Memo5.Clear;
Memo6.Clear;
Button2.Visible:=false;
Button3.Visible:=false;
Button4.Visible:=false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
harga1:=StrToCurr(Edit1.Text);
harga2:=StrToCurr(Edit2.Text);
harga3:=StrToCurr(Edit3.Text);
jml1:=StrToInt(Edit4.Text);
jml2:=StrToInt(Edit5.Text);
jml3:=StrToInt(Edit6.Text);
tot1:=harga1*jml1;
tot2:=harga2*jml2;
tot3:=harga3*jml3;
Memo1.Text:=CurrToStr(tot1);
Memo2.Text:=CurrToStr(tot2);
Memo3.Text:=CurrToStr(tot3);
total:=tot1+tot2+tot3;
Memo4.Text:=CurrToStr(total);
Button2.Visible:=True;
Button3.Visible:=True;
Button4.Visible:=True;

total:=StrToCurr(Memo4.Text);
if total>=2000000 then
diskon:=100000
else diskon:=50000;
Memo5.Text:=CurrToStr(diskon);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
uang:=StrToCurr(Edit7.Text);
bayar:=total-diskon;
kembali:=uang-bayar;
Memo6.Text:=CurrToStr(kembali);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ComboBox1.Text:=’ -Pilih-’;
ComboBox2.Text:=’ -Pilih-’;
ComboBox3.Text:=’ -Pilih-’;
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit7.Clear;
Memo1.Clear;
Memo2.Clear;
Memo3.Clear;
Memo4.Clear;
Memo5.Clear;
Memo6.Clear;
Button2.Visible:=false;
Button3.Visible:=false;
Button4.Visible:=false;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.ItemIndex=0 then
harga1:=2000000
else if ComboBox1.ItemIndex=1 then
harga1:=1000000
else if ComboBox1.ItemIndex=2 then
harga1:=500000;

Edit1.Text:=CurrToStr(harga1);
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
if ComboBox2.ItemIndex=0 then
harga2:=200000
else if ComboBox2.ItemIndex=1 then
harga2:=100000
else if ComboBox2.ItemIndex=2 then
harga2:=50000;


Edit2.Text:=CurrToStr(harga2);
end;

procedure TForm1.ComboBox3Change(Sender: TObject);
begin
if ComboBox3.ItemIndex=0 then
harga3:=250000
else if ComboBox3.ItemIndex=1 then
harga3:=150000
else if ComboBox3.ItemIndex=2 then
harga3:=100000;


Edit3.Text:=CurrToStr(harga3);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label7.Caption:=TimeToStr(now);
Label6.Caption:=DateToStr(now);
end;
end.

Program Transaksi Sederhana dengan Borland Delphi 7

2 komentar

Assalamualaikum..
referensi project2 delphi silahkan kunjungi blog saya :
http://energi08pnup.blogspot.com/

mungkin saya bisa membantu..

smoga bermanfaat

Terima Kasih Sobat Sudah:
1. Berkomentar Dengan Sopan
2. Tidak Memasukkan Link Aktif Dalam Form Komentar
3. Berkomentar Sesuai Artikel/Postingan
4. Berilah Informasi Kepada Admin Jika ada script yang Sudah tidak berfungsi
5. komentar Jorok/kasar /berbau Sara/Porno /saya anggap sebagai SPAM
Jika Sudah Mematuhi Peraturan diatas Anda Sudah dianggap SOPAN.
Thanks
EmoticonEmoticon