Script Dengan Delphi:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, XPMan, sSkinManager, sLabel;
type
TForm1 = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
GroupBox2: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
GroupBox3: TGroupBox;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
GroupBox4: TGroupBox;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Edit16: TEdit;
Edit17: TEdit;
Edit18: TEdit;
Edit19: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
XPManifest1: TXPManifest;
sSkinManager1: TsSkinManager;
Timer1: TTimer;
Label6: TLabel;
Memo1: TMemo;
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
procedure ComboBox5Change(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
hrg1,hrg2,hrg3,hrg4,hrg5,tot1,tot2,tot3,tot4,tot5,totall,
dskn,byr,kmbl,p:currency;
jml1,jml2,jml3,jml4,jml5,j,l,m,n,o:integer;
implementation
uses Math;
{$R *.dfm}
procedure TForm1.Button4Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Text:='Pilih';
ComboBox2.Text:='Pilih';
ComboBox3.Text:='Pilih';
ComboBox4.Text:='Pilih';
ComboBox5.Text:='Pilih';
Edit1.Enabled:=False;
Edit2.Enabled:=False;
Edit3.Enabled:=False;
Edit4.Enabled:=False;
Edit5.Enabled:=False;
Edit11.Enabled:=False;
Edit12.Enabled:=False;
Edit13.Enabled:=False;
Edit14.Enabled:=False;
Edit15.Enabled:=False;
Edit16.Enabled:=False;
Edit17.Enabled:=False;
Edit19.Enabled:=False;
Edit1.Text:='0';
Edit2.Text:='0';
Edit3.Text:='0';
Edit4.Text:='0';
Edit5.Text:='0';
Edit6.Text:='0';
Edit7.Text:='0';
Edit8.Text:='0';
Edit9.Text:='0';
Edit10.Text:='0';
Edit11.Text:='';
Edit12.Text:='';
Edit13.Text:='';
Edit14.Text:='';
Edit15.Text:='';
Edit16.Text:='';
Edit17.Text:='0';
Edit18.Text:='';
Edit19.Text:='';
Button2.Enabled:=False;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
hrg1:=StrToCurr(Edit1.Text);
hrg2:=StrToCurr(Edit2.Text);
hrg3:=StrToCurr(Edit3.Text);
hrg4:=StrToCurr(edit4.Text);
hrg5:=StrToCurr(Edit5.Text);
jml1:=StrToInt(Edit6.Text);
jml2:=StrToInt(Edit7.Text);
jml3:=StrToInt(Edit8.Text);
jml4:=StrToInt(Edit9.Text);
jml5:=StrToInt(Edit10.Text);
tot1:=hrg1*jml1;
tot2:=hrg2*jml2;
tot3:=hrg3*jml3;
tot4:=hrg4*jml4;
tot5:=hrg5*jml5;
Edit11.Text:=CurrToStr(tot1);
Edit12.Text:=CurrToStr(tot2);
Edit13.Text:=CurrToStr(tot3);
Edit14.Text:=CurrToStr(tot4);
Edit15.Text:=CurrToStr(tot5);
totall:=tot1+tot2+tot3+tot4;
Edit16.Text:=CurrToStr(totall);
Memo1.Lines.Add('Rincian');
Memo1.Lines.Add('');
Memo1.Lines.Add('Total Harga = '+CurrToStr(totall));
Memo1.Lines.Add('');
p:=StrToCurr(Edit16.Text);
Memo1.Lines.Add('Diskon = '+FloatToStr(totall*0.1));
Memo1.Lines.Add('');
if p>1 then
Button2.Enabled:=True;
if totall>=100000 then
begin
MessageDlg('Selamat Anda Mendapat Diskon'+#13+'Diskon Anda 10%',mtInformation,[mbOK],0);
dskn:=totall*0.1;
Edit17.Text:=CurrToStr(totall-dskn);
Memo1.Lines.Add('Diskon Anda = '+CurrToStr(totall-dskn))
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label5.Caption:=FormatDateTime('hh:nn:ss ',Now);
Label6.Font.Color:= Trunc(clBlue*Random);
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.ItemIndex=0 then
Edit1.Text:='800000'
else
if ComboBox1.ItemIndex=1 then
Edit1.Text:='350000'
else
if ComboBox1.ItemIndex=2 then
Edit1.Text:='600000'
else
if ComboBox1.ItemIndex=3 then
Edit1.Text:='240000'
else
if ComboBox1.ItemIndex=4 then
Edit1.Text:='100000'
else
if ComboBox1.ItemIndex=5 then
Edit1.Text:='80000'
else
if ComboBox1.ItemIndex=6 then
Edit1.Text:='40000'
else
if ComboBox1.ItemIndex=7 then
Edit1.Text:='320000'
else
if ComboBox1.ItemIndex=8 then
Edit1.Text:='550000'
else
if ComboBox1.ItemIndex=9 then
Edit1.Text:='6000'
else
if ComboBox1.ItemIndex=10 then
Edit1.Text:='60000'
else
if ComboBox1.ItemIndex=11 then
Edit1.Text:='120000'
else
if ComboBox1.ItemIndex=12 then
Edit1.Text:='60000'
else
if ComboBox1.ItemIndex=13 then
Edit1.Text:='15000'
else
if ComboBox1.ItemIndex=14 then
Edit1.Text:='40000'
else
if ComboBox1.ItemIndex=15 then
Edit1.Text:='75000'
else
if ComboBox1.ItemIndex=16 then
Edit1.Text:='15000'
else
if ComboBox1.ItemIndex=17 then
Edit1.Text:='15000'
else
if ComboBox1.ItemIndex=18 then
Edit1.Text:='69000'
else
if ComboBox1.ItemIndex=19 then
Edit1.Text:='5000'
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
if ComboBox2.ItemIndex=0 then
Edit2.Text:='800000'
else
if ComboBox2.ItemIndex=1 then
Edit2.Text:='350000'
else
if ComboBox2.ItemIndex=2 then
Edit2.Text:='600000'
else
if ComboBox2.ItemIndex=3 then
Edit2.Text:='240000'
else
if ComboBox2.ItemIndex=4 then
Edit2.Text:='100000'
else
if ComboBox2.ItemIndex=5 then
Edit2.Text:='80000'
else
if ComboBox2.ItemIndex=6 then
Edit2.Text:='40000'
else
if ComboBox2.ItemIndex=7 then
Edit2.Text:='320000'
else
if ComboBox2.ItemIndex=8 then
Edit2.Text:='550000'
else
if ComboBox2.ItemIndex=9 then
Edit2.Text:='6000'
else
if ComboBox2.ItemIndex=10 then
Edit2.Text:='60000'
else
if ComboBox2.ItemIndex=11 then
Edit2.Text:='120000'
else
if ComboBox2.ItemIndex=12 then
Edit2.Text:='60000'
else
if ComboBox2.ItemIndex=13 then
Edit2.Text:='15000'
else
if ComboBox2.ItemIndex=14 then
Edit2.Text:='40000'
else
if ComboBox2.ItemIndex=15 then
Edit2.Text:='75000'
else
if ComboBox2.ItemIndex=16 then
Edit2.Text:='15000'
else
if ComboBox2.ItemIndex=17 then
Edit2.Text:='15000'
else
if ComboBox2.ItemIndex=18 then
Edit2.Text:='69000'
else
if ComboBox2.ItemIndex=19 then
Edit2.Text:='5000'
end;
procedure TForm1.ComboBox3Change(Sender: TObject);
begin
if ComboBox3.ItemIndex=0 then
Edit3.Text:='800000'
else
if ComboBox3.ItemIndex=1 then
Edit3.Text:='350000'
else
if ComboBox3.ItemIndex=2 then
Edit3.Text:='600000'
else
if ComboBox3.ItemIndex=3 then
Edit3.Text:='240000'
else
if ComboBox3.ItemIndex=4 then
Edit3.Text:='100000'
else
if ComboBox3.ItemIndex=5 then
Edit3.Text:='80000'
else
if ComboBox3.ItemIndex=6 then
Edit3.Text:='40000'
else
if ComboBox3.ItemIndex=7 then
Edit3.Text:='320000'
else
if ComboBox3.ItemIndex=8 then
Edit3.Text:='550000'
else
if ComboBox3.ItemIndex=9 then
Edit3.Text:='6000'
else
if ComboBox3.ItemIndex=10 then
Edit3.Text:='60000'
else
if ComboBox3.ItemIndex=11 then
Edit3.Text:='120000'
else
if ComboBox3.ItemIndex=12 then
Edit3.Text:='60000'
else
if ComboBox3.ItemIndex=13 then
Edit3.Text:='15000'
else
if ComboBox3.ItemIndex=14 then
Edit3.Text:='40000'
else
if ComboBox3.ItemIndex=15 then
Edit3.Text:='75000'
else
if ComboBox3.ItemIndex=16 then
Edit3.Text:='15000'
else
if ComboBox3.ItemIndex=17 then
Edit3.Text:='15000'
else
if ComboBox3.ItemIndex=18 then
Edit3.Text:='69000'
else
if ComboBox3.ItemIndex=19 then
Edit3.Text:='5000'
end;
procedure TForm1.ComboBox4Change(Sender: TObject);
begin
if ComboBox4.ItemIndex=0 then
Edit4.Text:='800000'
else
if ComboBox4.ItemIndex=1 then
Edit4.Text:='350000'
else
if ComboBox4.ItemIndex=2 then
Edit4.Text:='600000'
else
if ComboBox4.ItemIndex=3 then
Edit4.Text:='240000'
else
if ComboBox4.ItemIndex=4 then
Edit4.Text:='100000'
else
if ComboBox4.ItemIndex=5 then
Edit4.Text:='80000'
else
if ComboBox4.ItemIndex=6 then
Edit4.Text:='40000'
else
if ComboBox4.ItemIndex=7 then
Edit4.Text:='320000'
else
if ComboBox4.ItemIndex=8 then
Edit4.Text:='550000'
else
if ComboBox4.ItemIndex=9 then
Edit4.Text:='6000'
else
if ComboBox4.ItemIndex=10 then
Edit4.Text:='60000'
else
if ComboBox4.ItemIndex=11 then
Edit4.Text:='120000'
else
if ComboBox4.ItemIndex=12 then
Edit4.Text:='60000'
else
if ComboBox4.ItemIndex=13 then
Edit4.Text:='15000'
else
if ComboBox4.ItemIndex=14 then
Edit4.Text:='40000'
else
if ComboBox4.ItemIndex=15 then
Edit4.Text:='75000'
else
if ComboBox4.ItemIndex=16 then
Edit4.Text:='15000'
else
if ComboBox4.ItemIndex=17 then
Edit4.Text:='15000'
else
if ComboBox4.ItemIndex=18 then
Edit4.Text:='69000'
else
if ComboBox4.ItemIndex=19 then
Edit4.Text:='5000'
end;
procedure TForm1.ComboBox5Change(Sender: TObject);
begin
if ComboBox5.ItemIndex=0 then
Edit5.Text:='800000'
else
if ComboBox5.ItemIndex=1 then
Edit5.Text:='350000'
else
if ComboBox5.ItemIndex=2 then
Edit5.Text:='600000'
else
if ComboBox5.ItemIndex=3 then
Edit5.Text:='240000'
else
if ComboBox5.ItemIndex=4 then
Edit5.Text:='100000'
else
if ComboBox5.ItemIndex=5 then
Edit5.Text:='80000'
else
if ComboBox5.ItemIndex=6 then
Edit5.Text:='40000'
else
if ComboBox5.ItemIndex=7 then
Edit5.Text:='320000'
else
if ComboBox5.ItemIndex=8 then
Edit5.Text:='550000'
else
if ComboBox5.ItemIndex=9 then
Edit5.Text:='6000'
else
if ComboBox5.ItemIndex=10 then
Edit5.Text:='60000'
else
if ComboBox5.ItemIndex=11 then
Edit5.Text:='120000'
else
if ComboBox5.ItemIndex=12 then
Edit5.Text:='60000'
else
if ComboBox5.ItemIndex=13 then
Edit5.Text:='15000'
else
if ComboBox5.ItemIndex=14 then
Edit5.Text:='40000'
else
if ComboBox5.ItemIndex=15 then
Edit5.Text:='75000'
else
if ComboBox5.ItemIndex=16 then
Edit5.Text:='15000'
else
if ComboBox5.ItemIndex=17 then
Edit5.Text:='15000'
else
if ComboBox5.ItemIndex=18 then
Edit5.Text:='69000'
else
if ComboBox5.ItemIndex=19 then
Edit5.Text:='5000'
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
j:=StrToInt(Edit17.Text);
byr:=l-o;
o:=StrToInt(Edit16.Text);
l:=StrToInt(Edit18.Text);
m:=l-j;
n:=l-o;
if j=0 then
Edit19.Text:=CurrToStr(byr);
Edit19.Text:=CurrToStr(n);
if j>1 then
Edit19.Text:=CurrToStr(m);
if l>j then
MessageDlg('Terima Kasih'+#13+'Selamat Datang Kembali',mtInformation,[mbOK],0);
if l<j then
MessageDlg('Maaf Uang Anda Kurang',mtError,[mbOK],0);
if l<j then
Edit19.Text:='Error' ;
if l=j then
Edit19.Text:='0';
if l=p then
Edit19.Text:='0';
if l=j then
MessageDlg('Terima Kasih'+#13+'Selamat Datang Kembali',mtInformation,[mbOK],0);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ComboBox1.Text:='Pilih';
ComboBox2.Text:='Pilih';
ComboBox3.Text:='Pilih';
ComboBox4.Text:='Pilih';
ComboBox5.Text:='Pilih';
Edit16.Clear;
Edit17.Text:='0';
Edit18.Clear;
Edit19.Clear;
Edit1.Text:='0';
Edit2.Text:='0';
Edit3.Text:='0';
Edit4.Text:='0';
Edit5.Text:='0';
Edit6.Text:='0';
Edit7.Text:='0';
Edit8.Text:='0';
Edit9.Text:='0';
Edit10.Text:='0';
Edit11.Clear;
Edit12.Clear;
Edit13.Clear;
Edit14.Clear;
Edit15.Clear;
Button2.Enabled:=false;
end;
end.
Tidak ada komentar:
Posting Komentar