TUGAS VB 1,2,3,4,5
Private Sub cbogolongan_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case cbogolongan.Text
Case “I”
gapok = 1500000
tunjangan = 150000
Case “II”
gapok = 2000000
tunjangan = 200000
Case “III”
gapok = 2500000
tunjangan = 250000
Case “IV”
gapok = 3000000
tunjangan = 300000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
txtgapok.Text = gapok
txttunjangan.Text = tunjangan
txtpajak.Text = pajak
txttotal.Text = total – pajak
End Sub
Public Sub kosong()
txtnidn.SetFocus
txtnidn.Text = “”
txtnama.Text = “”
cbogolongan.Text = “”
txtgapok.Text = “”
txttunjangan.Text = “”
txtpajak.Text = “”
txttotal.Text = “”
End Sub
Private Sub cmdbatal_Click()
kosong
End Sub
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub cmdlagi_Click()
kosong
End Sub
Private Sub Form_Load()
cbogolongan.AddItem “I”
cbogolongan.AddItem “II”
cbogolongan.AddItem “III”
cbogolongan.AddItem “IV”
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub txtnidn_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub
Private Sub Cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjurusan.Text = “”
txtpstudi.Text = “”
txttmasuk.Text = “”
txtnurut.Text = “”
End Sub
Private Sub Cmdkeluar_Click()
Unload Me
End Sub
Private Sub Cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjurusan.Text = “”
txtpstudi.Text = “”
txttmasuk.Text = “”
txtnurut.Text = “”
End Sub
Private Sub Cmdproses_Click()
Dim S As String
txttmasuk.Text = “20” & Left(txtnpm.Text, 2)
S = Mid(txtnpm.Text, 3, 1)
If S = “1” Then
txtjurusan.Text = “Sistem Informasi”
ElseIf S = “2” Then
txtjurusan.Text = “Manajemen Informatika”
ElseIf S = “3” Then
txtjurusan.Text = “Tehnik Informatika”
ElseIf S = “4” Then
txtjurusan.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(txtnpm.Text, 4, 2)
If S = “01” Then
txtpstudi.Text = “Strata Satu”
ElseIf S = “02” Then
txtpstudi.Text = “Diploma Tiga”
ElseIf S = “03” Then
txtpstudi.Text = “Diploma Empat”
ElseIf S = “04” Then
txtpstudi.Text = “Diploma Dua”
End If
txtnurut.Text = Right(txtnpm.Text, 3)
End Sub
Private Sub Form_Load()
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub cbokode_Change()
Case “APPLE MC965”
Txtmerk.Text = “APPLE MACBOOK AIR MC965”
Txths.Text = “12800000”
Case “APPLE MC966”
Txtmerk.Text = “APPLE MACBOOK AIR MC966”
Txths.Text = “15800000”
Case “APPLE MC968”
Txtmerk.Text = “APPLE MCBOOK AIR MC968”
Txths.Text = “9900000”
Case “APPLE MC969”
Txtmerk.Text = “APPLE MCBOOK AIR MC969”
Txths.Text = “11900000”
Case “APPLE MC700”
Txtmerk.Text = “APPLE MACBOOK PRO MC700”
Txths.Text = “10800000”
Case “APPLE MC721”
Txtmrek.Text = “Apple MacBook PRO MC721”
Txths.Text = “15900000”
Case “APPLE MC723”
Txtmerk.Text = “APPLE MACBOOK PRO MC723”
Txths.Text = “19300000”
Case “APPLE MC724”
Txtmerk.Text = “Apple MacBook Pro MC724”
Txths.Text = “13700000”
Case “APPLE MC311”
Txtmerk.Text = “APPLE MACBOOK PRO MC311”
Txths.Text = “24200000”
Case “APPLE MC313”
Txtmerk.Text = “APPLE MACBOOK PRO MC313”
Txths.Text = “11900000”
Case “APPLE MC314”
Txtmerk.Text = “APPLE MACBOOK PRO MC314”
Txths.Text = “14700000”
Case “APPLE MC318”
Txtmerk.Text = “APPLE MACBOOK PRO MC318”
Txths.Text = “17600000”
Case “APPLE MC322”
Txtmerk.Text = “APPLE MACBOOK PRO MC322”
Txths.Text = “21300000”
Case “APPLE MC965”
Txtmerk.Text = “Apple MacBook Air MC965”
Txths.Text = “12800000”
Case “APPLE MC966”
Txtmerk.Text = “Apple MacBook Air MC966”
Txths.Text = “15800000”
End Select
Txtjj.SetFocus
End Sub
Private Sub Cmdhitunglagi_Click()
cbokode.Text = “”
Txtmerk.Text = “”
Txths.Text = “”
Txtjj.Text = “”
Txthp.Text = “”
Txtdis.Text = “”
Txttb.Text = “”
End Sub
Private Sub Cmdkeluar_Click()
End
End Sub
Private Sub Cmdproses_Click()
Dim merk As String
Dim harga, a, b, s, e As Variant
kode = Mid(cbokode.Text, 7, 5)
If kode = “MC965” Then
merk = “Apple MacBook Air MC965”
harga = “12800000”
ElseIf kode = “MC966” Then
merk = “Apple MacBook Air MC966”
harga = “15800000”
ElseIf kode = “MC968” Then
merk = “Apple MacBook Air MC968”
harga = “9900000”
ElseIf kode = “MC969” Then
merk = “Apple MacBook Air MC969”
harga = “11900000”
ElseIf kode = “MC700” Then
merk = “Apple MacBook Pro MC700”
harga = “10800000”
ElseIf kode = “MC721” Then
merk = “Apple MacBook Pro MC721”
harga = “15900000”
ElseIf kode = “MC723” Then
merk = “Apple MacBook Pro MC723”
harga = “19300000”
ElseIf kode = “MC724” Then
merk = “Apple MacBook Pro MC724”
harga = “13700000”
ElseIf kode = “MC311” Then
merk = “Apple MacBook Pro MC311”
harga = “24200000”
ElseIf kode = “MC313” Then
merk = “Apple MacBook Pro MC313”
harga = “11900000”
ElseIf kode = “MC314” Then
merk = “Apple MacBook Pro MC314”
harga = “14700000”
ElseIf kode = “MC318” Then
merk = “Apple MacBook Pro MC318”
harga = “17600000”
ElseIf kode = “MC322” Then
merk = “Apple MacBook Pro MC322”
harga = “21300000”
ElseIf kode = “MC965” Then
merk = “Apple MacBook Ari MC965”
harga = “12800000”
ElseIf kode = “MC966” Then
merk = “Apple MacBook Ari MC966”
harga = “15800000”
End If
Txtmerk.Text = merk
Txths.Text = harga
a = Val(Txths.Text)
b = Val(Txtjj.Text)
penjualan = a * b
Txthp.Text = penjualan
Select Case Txthp.Text
Case Is > 140000000
discount = 0.15 * penjualan
Case Is > 135000000
discount = 0.1 * penjualan
Case Is > 130000000
discount = 0.05 * penjualan
Case Is > 125000000
discount = 0.02 * penjualan
End Select
Txtdis.Text = discount
Txthp.Text = penjualan
s = Val(Txthp.Text)
e = Val(Txtdis.Text)
total = s + e
Txttb.Text = total
End Sub
Private Sub Form_Load()
cbokode.AddItem “Apple MC965 MacBook Air”
cbokode.AddItem “Apple MC966 MacBook Air”
cbokode.AddItem “Apple MC968 MacBook Air”
cbokode.AddItem “Apple MC969 MacBook Air”
cbokode.AddItem “Apple MC700 MacBook Pro”
cbokode.AddItem “Apple MC721 MacBook Pro”
cbokode.AddItem “Apple MC723 MacBook Pro”
cbokode.AddItem “Apple MC724 MacBook Pro”
cbokode.AddItem “Apple MC311 MacBook Pro”
cbokode.AddItem “Apple MC313 MacBook Pro”
cbokode.AddItem “Apple MC314 MacBook Pro”
cbokode.AddItem “Apple MC318 MacBook Pro”
cbokode.AddItem “Apple MC322 MacBook Pro”
cbokode.AddItem “Apple MC965 MacBook Air”
cbokode.AddItem “Apple MC966 MacBook Air”
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Txtmerk_Change()
End Sub
Private Sub txtnama_keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNik.SetFocus
End If
End Sub
Private Sub cmdproses_Click()
Txttahun = Left(TxtNik.Text, 4)
G = Mid(TxtNik.Text, 5, 1)
If G = “A” Then
Txtgol = “A”
txtjabatan = “Manager”
txtgapok = “4000000?”
txttun = “1025000?”
ElseIf G = “B” Then
Txtgol = “B”
txtjabatan = “Ka. Seksi”
txtgapok = “3500000?”
txttun = “975000?”
ElseIf G = “C” Then
Txtgol = “C”
txtjabatan = “Staff”
txtgapok = “3000000?”
txttun = “925000?”
End If
S = Mid(TxtNik.Text, 7, 1)
If S = “S” Then
txtkode = “S”
Txtstatus = “Single”
ElseIf S = “M” Then
txtkode = “M”
Txtstatus = “Menikah”
ElseIf S = “J” Then
txtkode = “J”
Txtstatus = “Janda”
ElseIf S = “D” Then
txtkode = “D”
Txtstatus = “Duda”
End If
B = Right(TxtNik.Text, 3)
If B = “KEU” Then
txtbagian = “Accounting”
ElseIf B = “ADM” Then
txtbagian = “Administrasi”
ElseIf B = “SDM” Then
txtbagian = “General Affair”
ElseIf B = “EDP” Then
txtbagian = “IT Unit”
ElseIf B = “SPM” Then
txtbagian = “Security”
End If
txttotal = Val(txtgapok.Text) + Val(txttun.Text)
End Sub
Private Sub cmdlagi_Click()
Txtnama.SetFocus
Txtnama = “”
TxtNik = “”
Txtgol = “”
txtkode = “”
Txtstatus = “”
Txttahun = “”
txtjabatan = “”
txtbagian = “”
txtgapok = “”
txttun = “”
txttotal = “”
End Sub
Private Sub cmdbatal_Click()
Txtnama.SetFocus
Txtnama = “”
TxtNik = “”
Txtgol = “”
txtkode = “”
Txtstatus = “”
Txttahun = “”
txtjabatan = “”
txtbagian = “”
txtgapok = “”
txttun = “”
txttotal = “”
End Sub
Private Sub cmdkeluar_Click()
p = MsgBox(“Anda yakin akan keluar?”, vbQuestion + vbOKCancel, “informasi”)
If p = vbOK Then
End
End If
End Sub
Perhitungan gaji dosen
Private Sub txtnidn_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtnama.SetFocus
End If
End Sub
Private Sub Form_Load()
cbogol.AddItem “I”
cbogol.AddItem “II”
cbogol.AddItem “III”
cbogol.AddItem “IV”
End Sub
Private Sub cbogol_Click()
Dim gapok, tunjangan, pajak, total As Variant
Select Case cbogol.Text
Case “I”
gapok = 2000000
tunjangan = 200000
Case “II”
gapok = 3000000
tunjangan = 300000
Case “III”
gapok = 4000000
tunjangan = 400000
Case “IV”
gapok = 5000000
tunjangan = 500000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
txtgapok.Text = gapok
txttunj.Text = tunjangan
txtpajak.Text = pajak
txtterima.Text = total – pajak
End Sub
Private Sub cmdbatal_Click()
txtnidn.SetFocus
txtnidn.Text = “”
Txtnama.Text = “”
cbogol.Text = “”
txtgapok.Text = “”
txttunj.Text = “”
txtpajak.Text = “”
txtterima.Text = “”
End Sub
Private Sub cmdlagi_Click()
txtnidn.SetFocus
txtnidn.Text = “”
Txtnama.Text = “”
cbogol.Text = “”
txtgapok.Text = “”
txttunj.Text = “”
txtpajak.Text = “”
txtterima.Text = “”
End Sub
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub
Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub
Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
End Sub
Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub
Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub













