Listing
Sub aktif()
tnip.Enabled = True
tnama.Enabled = True
cmbgol.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
End Sub
Sub nonaktif()
tnip.Enabled = False
tnama.Enabled = False
cmbgol.Enabled = False
ttgl.Enabled = False
tjabatan.Enabled = False
tgapok.Enabled = False
ttj.Enabled = False
ttransport.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
opt3.Enabled = False
tts.Enabled = False
tgakot.Enabled = False
tpph.Enabled = False
tgaber.Enabled = False
End Sub
Sub bersih()
tnip.Text = ""
tnama.Text = ""
cmbgol.Text = ""
tjabatan.Text = ""
tgapok.Text = ""
ttj.Text = ""
ttransport.Text = ""
opt1.Value = 0
opt2.Value = 0
opt3.Value = 0
tts.Text = ""
tgakot.Text = ""
tpph.Text = ""
tgaber.Text = ""
End Sub
Private Sub chitung_Click()
bersih
aktif
tnip.SetFocus
cmbgol.Text = "-Pilih-"
End Sub
Private Sub ckeluar_Click()
x = MsgBox("Yakin Keluar", vbYesNo + vbQuestion,
"Konfirmasi")
If x = vbYes Then
Unload Me
End If
End Sub
Private Sub cmbgol_Click()
If cmbgol.Text = "I" Then
tjabatan.Text = "Paintry"
tgapok.Text = 1000000
ttj.Text = 200000
ttransport.Text = 0
ElseIf cmbgol.Text = "II" Then
tjabatan.Text = "Staff"
tgapok.Text = 1750000
ttj.Text = 300000
ttransport.Text = 200000
ElseIf cmbgol.Text = "III" Then
tjabatan.Text = "Supervisor"
tgapok.Text = 2250000
ttj.Text = 500000
ttransport.Text = 300000
ElseIf cmbgol.Text = "IV" Then
tjabatan.Text = "Manajer"
tgapok.Text = 5000000
ttj.Text = 700000
ttransport.Text = 500000
Else
tjabatan.Text = "Direktur"
tgapok.Text = 10000000
ttj.Text = 1000000
ttransport.Text = 1000000
End If
End Sub
Private Sub Form_Activate()
bersih
nonaktif
ttgl.Text = Date
cmbgol.AddItem "I"
cmbgol.AddItem "II"
cmbgol.AddItem "III"
cmbgol.AddItem "IV"
cmbgol.AddItem "V"
chitung.Enabled = True
ckeluar.Enabled = True
End Sub
Private Sub opt1_Click()
If opt1.Value = True Then
tts.Text = 300000
tgakot.Text = Val(tgapok.Text) + Val(ttj.Text) + Val(ttransport.Text) +
Val(tts.Text)
tpph.Text = 0.1 * Val(tgakot.Text)
tgaber.Text = Val(tgakot.Text) - Val(tpph.Text)
End If
End Sub
Private Sub opt2_Click()
If opt2.Value = True Then
tts.Text = 0
tgakot.Text = Val(tgapok.Text) + Val(ttj.Text) + Val(ttransport.Text) +
Val(tts.Text)
tpph.Text = 0.1 * Val(tgakot.Text)
tgaber.Text = Val(tgakot.Text) - Val(tpph.Text)
End If
End Sub
Private Sub opt3_Click()
If opt3.Value = True Then
tts.Text = 100000
tgakot.Text = Val(tgapok.Text) + Val(ttj.Text) + Val(ttransport.Text) +
Val(tts.Text)
tpph.Text = 0.1 * Val(tgakot.Text)
tgaber.Text = Val(tgakot.Text) - Val(tpph.Text)
End If
End Sub
TUGAS PRA UTS 2
Listing
Sub aktif()
txtnama.Enabled = True
cmbkode.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
opt3.Enabled = True
txtlama.Enabled = True
txtbayar.Enabled = True
End Sub
Sub nonaktif()
txtnama.Enabled = False
txttgl.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
txtbayar.Enabled = False
txtkembali.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 = ""
txtbayar.Text = ""
txtkembali.Text = ""
End Sub
Private Sub cmbkode_Click()
If cmbkode.Text =
"SU01" Then
txtjenis.Text = "Suite"
ElseIf cmbkode.Text =
"BS01" Then
txtjenis.Text =
"Business"
Else
txtjenis.Text =
"President"
End If
End Sub
Private Sub cmdisi_Click()
bersih
aktif
cmbkode.Text =
"-Pilih-"
txtnama.SetFocus
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()
bersih
aktif
txttgl.Text = Date
cmbkode.AddItem "SU01"
cmbkode.AddItem "BS01"
cmbkode.AddItem "PR01"
cmdisi.Enabled = True
cmdkeluar.Enabled = True
End Sub
Private Sub opt1_Click()
If opt1.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 300000
ElseIf txtjenis.Text = "Business"
Then
txtharga.Text = 400000
Else
txtharga.Text = 500000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub
Private Sub opt2_Click()
If opt2.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 500000
ElseIf txtjenis.Text = "Business"
Then
txtharga.Text = 600000
Else
txtharga.Text = 700000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub
Private Sub opt3_Click()
If opt3.Value = True Then
If txtjenis.Text = "Suite" Then
txtharga.Text = 800000
ElseIf txtjenis.Text = "Business"
Then
txtharga.Text = 900000
Else
txtharga.Text = 1000000
End If
Else
txtharga.Text = 0
End If
txtlama.SetFocus
End Sub
Private Sub
txtbayar_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a = Val(txttotal.Text) - Val(txtbayar.Text)
If txtbayar.Text <
txttotal.Text Then
MsgBox "Uang Anda
Kurang" & a, vbOKOnly, "WARNING!"
txtbayar.Text = ""
txtbayar.SetFocus
Else
txtkembali.Text =
Val(txtbayar.Text) - Val(txttotal.Text)
End If
End If
End Sub
Private Sub
txtlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text =
Val(txtharga.Text) * Val(txtlama.Text)
txtbayar.SetFocus
End If
End Sub
TUGAS PRA UTS 3
LISTING
Sub aktif()
tnama.Enabled = True
tumur.Enabled = True
opt1.Enabled = True
opt2.Enabled = True
tlama.Enabled = True
tubay.Enabled = True
End Sub
Sub nonaktif()
tnama.Enabled = False
tumur.Enabled = False
opt1.Enabled = False
opt2.Enabled = False
tharga.Enabled = False
tlama.Enabled = False
ttobay.Enabled = False
tubay.Enabled = False
tukem.Enabled = False
ttgl.Enabled = False
End Sub
Sub bersih()
tnama.Text = ""
tumur.Text = ""
opt1.Value = 0
opt2.Value = 0
tharga.Text = ""
tlama.Text = ""
ttobay.Text = ""
tubay.Text = ""
tukem.Text = ""
End Sub
Private Sub ccancel_Click()
Call Form_Activate
bersih
End Sub
Private Sub cclose_Click()
x = MsgBox("Tutup Program?", vbYesNo +
vbQuestion, "Konfirmasi")
If x = vbYes Then
Unload Me
End If
End Sub
Private Sub cinput_Click()
aktif
bersih
tnama.SetFocus
cinput.Enabled = False
ccancel.Enabled = True
cclose.Enabled = True
End Sub
Private Sub Form_Activate()
nonaktif
bersih
ttgl.Text = Date
cinput.Enabled = True
ccancel.Enabled = False
cclose.Enabled = True
End Sub
Private Sub opt1_Click()
If opt1.Value = True Then
tharga.Text = 500000
End If
tlama.SetFocus
End Sub
Private Sub opt2_Click()
If opt2.Value = True Then
tharga.Text = 350000
End If
tlama.SetFocus
End Sub
Private Sub tlama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
tubay.SetFocus
ttobay.Text = Val(tharga.Text) * Val(tlama.Text)
End If
End Sub
Private Sub tubay_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
tukem.Text = Val(tubay.Text) - Val(ttobay.Text)
End If
End Sub