Kamis, 19 April 2012

TAMPILAN DAN LISTING PRA UTS_2

Private Sub ckode_Click()
If ckode.Text = "SU01" Then
tjenis.Text = "Suite"
ElseIf ckode.Text = "BS01" Then
tjenis.Text = "Business"
Else
tjenis.Text = "President"
End If
End Sub

Sub aktif()
tnama.Enabled = True
ckode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
tlama.Enabled = True
tubay.Enabled = True
End Sub

Sub nonaktif()
tnama.Enabled = False
ttgl.Enabled = False
ckode.Enabled = False
tjenis.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
tharga.Enabled = False
tlama.Enabled = False
ttotal.Enabled = False
tubay.Enabled = False
tukem.Enabled = False
End Sub

Sub bersih()
tnama.Text = ""
ckode.Text = ""
tjenis.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
tharga.Text = ""
tlama.Text = ""
ttotal.Text = ""
tubay.Text = ""
tukem.Text = ""
End Sub

Private Sub cisidata_Click()
bersih
aktif
ckode.Text = "-Pilih-"
tnama.SetFocus
End Sub

Private Sub ckeluar_Click()
X = MsgBox("TutupForm?", vbYesNo + vbQuestion, "Konfirmasi")
If X = vbYes Then
Unload Me
End If
End Sub

Private Sub Form_Activate()
bersih
nonaktif
ttgl.Text = Date
ckode.AddItem "SU01"
ckode.AddItem "BS01"
ckode.AddItem "PR01"
cisidata.Enabled = True
ckeluar.Enabled = True
End Sub


Private Sub opt1_Click()
If opt1.Value = True Then
If tjenis.Text = "Suite" Then
tharga.Text = 300000
ElseIf tjenis.Text = "Business" Then
tharga.Text = 400000
Else
tharga.Text = 500000
End If
Else
tharga.Text = 0
End If
tlama.SetFocus
End Sub

Private Sub opt2_Click()
If opt2.Value = True Then
If tjenis.Text = "Suite" Then
tharga.Text = 500000
ElseIf tjenis.Text = "Business" Then
tharga.Text = 600000
Else
tharga.Text = 700000
End If
Else
tharga.Text = 0
End If
tlama.SetFocus
End Sub

Private Sub opt3_Click()
If opt3.Value = True Then
If tjenis.Text = "Suite" Then
tharga.Text = 800000
ElseIf tjenis.Text = "Business" Then
tharga.Text = 900000
Else
tharga.Text = 1000000
End If
Else
tharga.Text = 0
End If
tlama.SetFocus
End Sub


Private Sub tlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
ttotal.Text = Val(tharga.Text) * Val(tlama.Text)
tubay.SetFocus
End If
End Sub

Private Sub tubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(ttotal.Text) - Val(tubay.Text)
If tubay.Text < ttotal.Text Then
MsgBox "Uang Anda Kurang RP." & Val(ttotal.Text) - Val(tubay.Text) & " Input Uang Kembali", vbOKOnly, "Warning!"
tubay.Text = ""
tubay.SetFocus
Else
tukem.Text = Val(tubay.Text) - Val(ttotal.Text)
End If
End If
End Sub

Tidak ada komentar:

Posting Komentar