KETENTUAN SOAL :
- pada saat form dijalankan,semua objek dalam kondisi aktif .textbox tanggal berisi tanggal hari ini.kursor berada pada textbox nama penyewa.
- pilih kode kamar,jenis kamar akan tampil sesuai dengan ketentuan berikut:
Kode kamar
|
JENIS KAMAR
|
SU01
|
SUITE
|
BS01
|
BUSSINES
|
PR01
|
PRESIDENT
|
3 3.
pilih type kamar,akan tampil harga sewa sesuai
dengan ketentuan berikut:
Jenis kamar
|
Type kamar
|
Harga sewa
|
suite
|
Single
|
300000
|
Double
|
400000
|
|
family
|
500000
|
|
bussines
|
Single
|
500000
|
Double
|
600000
|
|
family
|
700000
|
|
president
|
Single
|
800000
|
Double
|
900000
|
|
family
|
1000000
|
4 4.
lama sewa
di input ,tekan enter maka ;
total harga = harga sewa * lama sewa
5 5.uang bayar diinput,tekan enter maka ;
uang kembali= uang bayar – total harga,
jika uang bayar kurang,tampil:
warning
? UANG ANDA KURANG
|
6 6. klik tombol isi data,bersih & kursor di nama
penyewa..tombol keluar u/ keluar dari form dan tampil pesan
KONFIRMASI
TUTUP FORM ?
|
LISTING:
Private Sub cmbkode_Click()
If cmbkode.Text = "SU01" Then
txtjenis.Text = "Suit"
ElseIf cmbkode.Text = "BS01" Then
End If
End Sub
Private Sub cmdisi_Click()
aktif
bersih
txtnama.SetFocus
cmbkode.Text = "-Pilih-"
cmdisi.Enabled = True
cmdkeluar.Enabled = True
End Sub
Private Sub cmdkeluar_Click()
x = MsgBox("Tutup Form?", vbYesNo + vbQuestion,
"konfirmasi")
If x = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Activate()
nonaktif
bersih
txttgl.Text = Date
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
cmdisi.Enabled = True
cmdkeluar.Enabled = True
End Sub
Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtlama.Enabled = True
txtubay.Enabled = True
End Sub
Sub nonaktif()
txtnama.Enabled = False
cmbkode.Enabled = False
txtjenis.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
txtharga.Enabled = False
txtlama.Enabled = False
txttotal.Enabled = False
txtubay.Enabled = False
txtukem.Enabled = False
txttgl.Enabled = False
End Sub
Sub bersih()
txtnama.Text = ""
cmbkode.Text = ""
txtjenis.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
txtharga.Text = ""
txtlama.Text = ""
txttotal.Text = ""
txtubay.Text = ""
txtukem.Text = ""
End Sub
Private Sub opt1_Click()
If opt1.Value = True And txtjenis.Text = "Suit"
Then
txtharga.Text = 300000
ElseIf opt1.Value = True And txtjenis.Text =
"Bussines" Then
txtharga.Text = 500000
Elsetxtharga.Text = 800000
End If
txtlama.SetFocus
End Sub
Private Sub opt2_Click()
If opt2.Value = True And txtjenis.Text = "Suit"
Then
txtharga.Text = 400000
ElseIf opt2.Value = True And txtjenis.Text =
"Bussines" Then
txtharga.Text = 600000
Elsetxtharga.Text = 900000
End If
txtlama.SetFocus
End Sub
Private Sub opt3_Click()
If opt3.Value = True And txtjenis.Text = "Suit"
Then
txtharga.Text = 500000
ElseIf opt3.Value = True And txtjenis.Text =
"Bussines" Then
txtharga.Text = 7000000
Elsetxtharga.Text = 1000000
End If
txtlama.SetFocus
End Sub
Private Sub txtlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txtharga.Text) * Val(txtlama.Text)
End If
End Sub
Private Sub txttotal_Change()
txtubay.SetFocus
End Sub
Private Sub txtubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(txttotal.Text) - Val(txtubay.Text)
If txtubay.Text < txttotal.Text Then
MsgBox "Uang Anda Kurang" & a, vbOKOnly,
"WARNING!"
txtubay.Text = ""
txtubay.SetFocus
Else
txtukem.Text = Val(txtubay.Text) - Val(txttotal.Text)
End If
End If
End Sub
Private Sub txtukem_Change()
If Val(txtukem.Text) < 0 Then
txtukem.Enabled = "False"
End If
End Sub
Tidak ada komentar:
Posting Komentar