Minggu, 13 Januari 2019

tugas 3.5


Private Sub Cmdbatal_Click()
Txtnk.SetFocus
Txtgol = ""
Txtks = ""
Txtst = ""
Txtth = ""
Txtjb = ""
Txtbag = ""
Txtgp = ""
Txttjg = ""
Txttg = ""
Txtterbilang = ""
Txtnk = ""
Txtnik = ""
End Sub

Private Sub Cmdkeluar_Click()

End
End Sub

Private Sub Cmdlagi_Click()

Txtnk.SetFocus
Txtgol = ""
Txtks = ""
Txtst = ""
Txtth = ""
Txtjb = ""
Txtbag = ""
Txtgp = ""
Txttjg = ""
Txttg = ""
Txtterbilang = ""
Txtnk = ""
Txtnik = ""
End Sub

Private Sub Cmdproses_Click()
Dim s As String
s = Mid(Txtnik, 5, 1)
If s = "A" Then
Txtgol = "A"
Txtjb = "Manager"
Txtgp = "4000000"
Txttjg = "1025000"
ElseIf s = "B" Then
Txtgol = "B"
Txtjb = "Ka. Seksi"
Txtgp = "3500000"
Txttjg = "975000"
ElseIf s = "C" Then
Txtgol = "C"
Txtjb = "Staff"
Txtgp = "3000000"
Txttjg = "925000"
End If
s = Mid(Txtnik, 7, 1)
If s = "S" Then
Txtks = "S"
Txtst = "Single"
ElseIf s = "M" Then
Txtks = "M"
Txtst = "Menikah"
ElseIf s = "J" Then
Txtks = "J"
Txtst = "Janda"
ElseIf s = "D" Then
Txtks = "D"
Txtst = "Duda"
End If
s = Right(Txtnik, 3)
If s = "KEU" Then
Txtbag = "Accounting"
ElseIf s = "ADM" Then
Txtbag = "Administrasi"
ElseIf s = "SDM" Then
Txtbag = "General Affair"
ElseIf s = "EDP" Then
Txtbag = "IT Unit"
ElseIf s = "SPM" Then
Txtbag = "Security"
End If
Txtth = Left(Txtnik, 4)
Txttg = Val(Txtgp) + Val(Txttjg)
Txtterbilang.Text = Terbilang(Txttg.Text)
Txtnk.SetFocus
End Sub

Function Terbilang(Angka As String) As String

Dim n1 As String
Dim nangka, Strjmlhuruf$, intpecahan As Integer, strpecahan$, urai$, Bil1$, strtot$, bil2$
Dim x, Y, z, i As Integer
    
For i = 1 To Len(Angka)
If Not Mid(Angka, i, 1) = "." Then
nangka = nangka + Mid(Angka, i, 1)
End If
Next
    
If Len(LTrim(nangka)) = 0 Then
terbit = "Nol Rupiah"
Exit Function
End If
Strjmlhuruf = LTrim(RTrim((nangka)))
intpecahan = Val(Right(Mid(Angka, 15, 2), 2))
If (intpecahan = 0) Then
strpecahan = ""
End If
x = 0
Y = 0
urai = ""
    
While (x < Len(Strjmlhuruf))
x = x + 1
strtot = Mid(Strjmlhuruf, x, 1)
Y = Y + Val(strtot)
z = Len(Strjmlhuruf) - x + 1
    
Select Case Val(strtot)
Case 1
If (z = 1 Or z = 7 Or z = 10 Or z = 13) Then
Bil1 = "Satu "
ElseIf (z = 4) Then
If (x = 1) Then
Bil1 = "Se"
Else
Bil1 = "Satu "
End If
ElseIf (z = 2 Or z = 5 Or z = 8 Or z = 11 Or z = 14) Then
x = x + 1
strtot = Mid(Strjmlhuruf, x, 1)
z = Len(Strjmlhuruf) - x + 1
bil2 = ""
    
Select Case Val(strtot)
Case 0
Bil1 = "Sepuluh "
Case 1
Bil1 = "Sebelas "
Case 2
Bil1 = "Dua Belas "
Case 3
Bil1 = "Tiga Belas "
Case 4
Bil1 = "Empat Belas "
Case 5
Bil1 = "Lima Belas "
Case 6
Bil1 = "Enam Belas "
Case 7
Bil1 = "Tujuh Belas "
Case 8
Bil1 = "Delapan Belas "
Case 9
Bil1 = "Sembilan Belas "
End Select
Else
Bil1 = "Se"
End If
    
Case 2
Bil1 = "Dua "
Case 3
Bil1 = "Tiga "
Case 4
Bil1 = "Empat "
Case 5
Bil1 = "Lima "
Case 6
Bil1 = "Enam "
Case 7
Bil1 = "Tujuh "
Case 8
Bil1 = "Delapan "
Case 9
Bil1 = "Sembilan "
Case Else
Bil1 = ""
End Select
    
If (Val(strtot) > 0) Then
If (z = 2 Or z = 5 Or z = 8 Or z = 11 Or z = 14) Then
bil2 = "Puluh "
ElseIf (z = 3 Or z = 6 Or z = 9 Or z = 12 Or z = 15) Then
bil2 = "Ratus "
Else
bil2 = ""
End If
Else
bil2 = ""
End If
If (Y > 0) Then
Select Case z
Case 4
bil2 = bil2 + "Ribu "
Y = 0
Case 7
bil2 = bil2 + "Juta "
Y = 0
Case 10
bil2 = bil2 + "Milyar "
Y = 0
Case 13
bil2 = bil2 + "Trilyun "
Y = 0
End Select
End If
urai = urai + Bil1 + bil2
Wend
    
urai = urai + strpecahan
Terbilang = urai & "Rupiah "
Terbilang = LCase(Terbilang)
n1 = UCase(Left(Terbilang, 1))
Terbilang = n1 & Mid(Terbilang, 2, Len(Terbilang) - 1)
End Function

tugas 3.4


Private Sub Command1_Click()
Dim s As String          
Txttt = "20" & Mid(Cbokode, 2)
s = Right(Cbokode, 1)
If s = "A" Then
Txtpenerbit = "Andi Offset Yogyakarta"
ElseIf s = "I" Then
Txtpenerbit = "Indah Surabaya"
ElseIf s = "S" Then
Txtpenerbit = "Salema Empat"
ElseIf s = "E" Then
Txtpenerbit = "Elek Media Komputindo"
ElseIf s = "M" Then
Txtpenerbit = "Maxicom"
End If
s = Left(Cbokode, 3)
If s = "SIM" Then
Txtjb = "Sistem Informasi Manajemen"
Txtpengarang = "Fadiya Ulfa"
Txtharga = "75900"
ElseIf s = "EDP" Then
Txtjb = "Elektronik Data Processing"
Txtpengarang = "Nurul Agustin"
Txtharga = "62000"
ElseIf s = "MNJ" Then
Txtjb = "Manajemen"
Txtpengarang = "Riyan Hidayat"
Txtharga = "42000"
ElseIf s = "CDR" Then
Txtjb = "Corel Draw"
Txtpengarang = "Siti Nur Khotimah"
Txtharga = "53000"
ElseIf s = "RPL" Then
Txtjb = "Rekayasa Perangkat Lunak"
Txtpengarang = "Winda Erlianti"
Txtharga = "83000"
End If
End Sub


Private Sub Command2_Click()
Cbokode.SetFocus
Cbokode = ""
Txtjb = ""
Txtpengarang = ""
Txttt = ""
Txtpenerbit = ""
Txtharga = ""
End Sub

Private Sub Command3_Click()
Cbokode.SetFocus
Cbokode = ""
Txtjb = ""
Txtpengarang = ""
Txttt = ""
Txtpenerbit = ""
Txtharga = ""
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()
Cbokode.AddItem "SIM-09-A"
Cbokode.AddItem "EDP-10-I"
Cbokode.AddItem "MNJ-11-S"
Cbokode.AddItem "CDR-12-E"
Cbokode.AddItem "RPL-13-M"
End Sub

tugas 3.3

Private Sub Cmdproses_Click()
Dim s As String
s = Left(Txtkode, 3)
If s = "BIM" Then
Txtjk = "BIMA"
Txtht = "50000"
Txtjb = "16.00"
ElseIf s = "EKO" Then
Txtjk = "EKONOMI"
Txtht = "35000"
Txtjb = "19.00"
ElseIf s = "MUT" Then
Txtjk = "MUTIARA"
Txtht = "23000"
Txtjb = "17.00"
ElseIf s = "SEN" Then
Txtjk = "SENJA"
Txtht = "15000"
Txtjb = "20.00"
End If
Txttp = Val(Txtjt) * Val(Txtht)
Txtjt.SetFocus
End Sub

Private Sub Command2_Click()
Txtkode.SetFocus
Txtkode = ""
Txtht = ""
Txtjk = ""
Txtjb = ""
Txtjt = ""
Txttp = ""
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Txtjt_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txttp = Val(Txtjt) * Val(Txtht)
End If
End Sub

tugas 3.2

Private Sub Command1_Click()
Dim s As String
Txttt = "20" & Mid(Cbokode, 2)
s = Right(Cbokode, 1)
If s = "A" Then
Txtpenerbit = "Andi Offset Yogyakarta"
ElseIf s = "I" Then
Txtpenerbit = "Indah Surabaya"
ElseIf s = "S" Then
Txtpenerbit = "Salema Empat"
ElseIf s = "E" Then
Txtpenerbit = "Elek Media Komputindo"
ElseIf s = "M" Then
Txtpenerbit = "Maxicom"
End If
s = Left(Cbokode, 3)
If s = "SIM" Then
Txtjb = "Sistem Informasi Manajemen"
Txtpengarang = "Fadiya Ulfa"
Txtharga = "75900"
ElseIf s = "EDP" Then
Txtjb = "Elektronik Data Processing"
Txtpengarang = "Nurul Agustin"
Txtharga = "62000"
ElseIf s = "MNJ" Then
Txtjb = "Manajemen"
Txtpengarang = "Riyan Hidayat"
Txtharga = "42000"
ElseIf s = "CDR" Then
Txtjb = "Corel Draw"
Txtpengarang = "Siti Nur Khotimah"
Txtharga = "53000"
ElseIf s = "RPL" Then
Txtjb = "Rekayasa Perangkat Lunak"
Txtpengarang = "Winda Erlianti"
Txtharga = "83000"
End If
End Sub


Private Sub Command2_Click()
Cbokode.SetFocus
Cbokode = ""
Txtjb = ""
Txtpengarang = ""
Txttt = ""
Txtpenerbit = ""
Txtharga = ""
End Sub

Private Sub Command3_Click()
Cbokode.SetFocus
Cbokode = ""
Txtjb = ""
Txtpengarang = ""
Txttt = ""
Txtpenerbit = ""
Txtharga = ""
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()
Cbokode.AddItem "SIM-09-A"
Cbokode.AddItem "EDP-10-I"
Cbokode.AddItem "MNJ-11-S"
Cbokode.AddItem "CDR-12-E"
Cbokode.AddItem "RPL-13-M"
End Sub