Contoh Skrip-nya
Menentukan Tipe Data Terlebih dahulu:
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
GroupBox1: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
GroupBox2: TGroupBox;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
GroupBox3: TGroupBox;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Label7: TLabel;
Edit13: TEdit;
Label8: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label9: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Edit14: TEdit;
Edit15: TEdit;
Edit16: TEdit;
Label25: TLabel;
Label26: TLabel;
Timer1: TTimer;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
Skrip Selanjutnya
procedure TForm1.Button1Click(Sender: TObject);
var hrgDasBRS,hrgDasGLR,hrgDasMYG,hrgDasTT:Currency;
jmlBRS,jmlGLR,jmlMYG,jmlTT:integer;
TotBRS,TotGLR,TotMYG,TotTT:Currency;
begin
//Mendeklarasikan Harga Satuan Barang
hrgDasBRS:=StrToCurr(Edit1.Text);
hrgDasGLR:=StrToCurr(Edit2.Text);
hrgDasMYG:=StrToCurr(Edit3.Text);
hrgDasTT:=StrToCurr(Edit4.Text);
//Mendeklarasikan Jumlah Pembelian
jmlBRS:=StrToInt(Edit5.Text);
jmlGLR:=StrToInt(Edit6.Text);
jmlMYG:=StrToInt(Edit7.Text);
jmlTT:=StrToInt(Edit8.Text);
//Menghitung Harga Dasar x Jumlah Beli
TotBRS:=hrgDasBRS*jmlBRS;
TotGLR:=hrgDasGLR*jmlGLR;
TotMYG:=hrgDasMYG*jmlMYG;
TotTT:=hrgDasTT*jmlTT;
//Menulis Hasil Ke Komponen Total
Edit9.Text:=CurrToStr(TotBRS );
Edit10.Text:=CurrToStr(TotGLR );
Edit11.Text:=CurrToStr(TotMYG );
Edit12.Text:=CurrToStr(TotTT );
Edit13.Text:=CurrToStr(TotBRS+TotGLR+TotMYG+TotTT);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit7.Clear;
Edit8.Clear;
Edit9.Clear;
Edit10.Clear;
Edit11.Clear;
Edit12.Clear;
Edit13.Clear;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var a:Integer;
begin
if Label1.Visible=True then
Label1.Visible:=False
else
if Label1.Visible=False then
Label1.Visible:=True;
Label27.Caption:=FormatDateTime('dd/mm/yyyy',now);
Label28.Caption:=FormatDateTime('hh:mm:ss',now);
//menampilkan jam dan tangggal
Label29.Caption:=TimeToStr(time)+' '+DateTimeToStr(date);
//menampilkan tulisan berjalan
Label2.Left:=Label2.Left-18;
//mengulang tulisan berjalan
Label26.Left:=Label26.Left-3;
end;
end.
Tidak ada komentar:
Posting Komentar