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
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