Private Sub cmdBatal_Click()
txtNama = ""
txtNik = ""
txtGol = ""
txtKode = ""
txtStatus = ""
txtTahun = ""
txtJabatan = ""
txtBagian = ""
txtGapok = ""
txtTunjangan = ""
txtTotalg = ""
txtTerbilang = ""
End Sub
Private Sub cmdKeluar_Click()
End
End Sub
Private Sub cmdLagi_Click()
txtNama = ""
txtNik = ""
txtGol = ""
txtKode = ""
txtStatus = ""
txtTahun = ""
txtJabatan = ""
txtBagian = ""
txtGapok = ""
txtTunjangan = ""
txtTotalg = ""
txtTerbilang = ""
End Sub
Private Sub cmdProses_Click()
Dim kode As String
txtTahun = Left(txtNik.Text, 4)
txtKode = Mid(txtNik, 7, 1)
kode = Mid(txtNik.Text, 5, 1)
If kode = "A" Then
txtGol = "A"
txtJabatan = "Manager"
txtGapok = "4000000"
txtTunjangan.Text = "1025000"
ElseIf kode = "B" Then
txtGol = "B"
txtJabatan = "Ka. Seksi"
txtGapok = "3500000"
txtTunjangan = "975000"
ElseIf kode = "C" Then
txtGol = "C"
txtJabatan = "Staff"
txtGapok = "Ka. Seksi"
txtTunjangan = "925000"
End If
kode = Right(txtNik, 3)
If kode = "KEU" Then
txtBagian = "Accounting"
ElseIf kode = "ADM" Then
txtBagian = "Administrasi"
ElseIf kode = "SDM" Then
txtBagian = "General Affair"
ElseIf kode = "EDP" Then
txtBagian = "IT Unit"
ElseIf kode = "SPM" Then
txtBagian = "Security"
End If
kode = Mid(txtNik, 7, 1)
If kode = "S" Then
txtStatus = "Single"
ElseIf kode = "M" Then
txtStatus = "Menikah"
ElseIf kode = "J" Then
txtStatus = "Janda"
ElseIf kode = "D" Then
txtStatus = "Duda"
End If
txtTotalg = Val(txtGapok) + Val(txtTunjangan)
If txtTotalg.Text <> "" Then
txtTerbilang.Text = AngkaTerbilang(txtTotalg.Text) + "Rupiah"
Else
txtTerbilang.Text = ""
End If
End Sub
Private Sub Form_Load()
txtGol.Enabled = False
txtKode.Enabled = False
txtStatus.Enabled = False
txtTahun.Enabled = False
txtJabatan.Enabled = False
txtBagian.Enabled = False
txtGapok.Enabled = False
txtTunjangan.Enabled = False
txtTerbilang.Enabled = False
End Sub
Private Sub txtTotalg_Change()
On Error Resume Next
If txtTotalg.Text <> "" Then
txtTerbilang.Text = AngkaTerbilang(txtTotalg.Text) + "Rupiah"
Else
txtTerbilang.Text = ""
End If
End Sub
'membuat fungsi angka terbilang
Public Function AngkaTerbilang(ByVal nilai As Currency) As String
Dim satuan As Variant
satuan = Array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas")
Select Case nilai
Case 0 To 11
AngkaTerbilang = "" + satuan(Fix(nilai))
Case 12 To 19
AngkaTerbilang = AngkaTerbilang(nilai Mod 10) + "Belas"
Case 20 To 99
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 10)) + "Puluh" + AngkaTerbilang(nilai Mod 10)
Case 100 To 199
AngkaTerbilang = "Seratus" + AngkaTerbilang(nilai - 100)
Case 200 To 999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 100)) + "Ratus" + AngkaTerbilang(nilai Mod 100)
Case 1000 To 1999
AngkaTerbilang = "Seribu" + AngkaTerbilang(nilai - 1000)
Case 2000 To 999999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000)) + "Ribu" + AngkaTerbilang(nilai Mod 1000)
Case 1000000 To 999999999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000000)) + "Juta" + AngkaTerbilang(nilai Mod 1000000)
Case Else
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000000000)) + "Milyar" + AngkaTerbilang(nilai Mod 1000000000)
End Select
End Function
txtNama = ""
txtNik = ""
txtGol = ""
txtKode = ""
txtStatus = ""
txtTahun = ""
txtJabatan = ""
txtBagian = ""
txtGapok = ""
txtTunjangan = ""
txtTotalg = ""
txtTerbilang = ""
End Sub
Private Sub cmdKeluar_Click()
End
End Sub
Private Sub cmdLagi_Click()
txtNama = ""
txtNik = ""
txtGol = ""
txtKode = ""
txtStatus = ""
txtTahun = ""
txtJabatan = ""
txtBagian = ""
txtGapok = ""
txtTunjangan = ""
txtTotalg = ""
txtTerbilang = ""
End Sub
Private Sub cmdProses_Click()
Dim kode As String
txtTahun = Left(txtNik.Text, 4)
txtKode = Mid(txtNik, 7, 1)
kode = Mid(txtNik.Text, 5, 1)
If kode = "A" Then
txtGol = "A"
txtJabatan = "Manager"
txtGapok = "4000000"
txtTunjangan.Text = "1025000"
ElseIf kode = "B" Then
txtGol = "B"
txtJabatan = "Ka. Seksi"
txtGapok = "3500000"
txtTunjangan = "975000"
ElseIf kode = "C" Then
txtGol = "C"
txtJabatan = "Staff"
txtGapok = "Ka. Seksi"
txtTunjangan = "925000"
End If
kode = Right(txtNik, 3)
If kode = "KEU" Then
txtBagian = "Accounting"
ElseIf kode = "ADM" Then
txtBagian = "Administrasi"
ElseIf kode = "SDM" Then
txtBagian = "General Affair"
ElseIf kode = "EDP" Then
txtBagian = "IT Unit"
ElseIf kode = "SPM" Then
txtBagian = "Security"
End If
kode = Mid(txtNik, 7, 1)
If kode = "S" Then
txtStatus = "Single"
ElseIf kode = "M" Then
txtStatus = "Menikah"
ElseIf kode = "J" Then
txtStatus = "Janda"
ElseIf kode = "D" Then
txtStatus = "Duda"
End If
txtTotalg = Val(txtGapok) + Val(txtTunjangan)
If txtTotalg.Text <> "" Then
txtTerbilang.Text = AngkaTerbilang(txtTotalg.Text) + "Rupiah"
Else
txtTerbilang.Text = ""
End If
End Sub
Private Sub Form_Load()
txtGol.Enabled = False
txtKode.Enabled = False
txtStatus.Enabled = False
txtTahun.Enabled = False
txtJabatan.Enabled = False
txtBagian.Enabled = False
txtGapok.Enabled = False
txtTunjangan.Enabled = False
txtTerbilang.Enabled = False
End Sub
Private Sub txtTotalg_Change()
On Error Resume Next
If txtTotalg.Text <> "" Then
txtTerbilang.Text = AngkaTerbilang(txtTotalg.Text) + "Rupiah"
Else
txtTerbilang.Text = ""
End If
End Sub
'membuat fungsi angka terbilang
Public Function AngkaTerbilang(ByVal nilai As Currency) As String
Dim satuan As Variant
satuan = Array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas")
Select Case nilai
Case 0 To 11
AngkaTerbilang = "" + satuan(Fix(nilai))
Case 12 To 19
AngkaTerbilang = AngkaTerbilang(nilai Mod 10) + "Belas"
Case 20 To 99
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 10)) + "Puluh" + AngkaTerbilang(nilai Mod 10)
Case 100 To 199
AngkaTerbilang = "Seratus" + AngkaTerbilang(nilai - 100)
Case 200 To 999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 100)) + "Ratus" + AngkaTerbilang(nilai Mod 100)
Case 1000 To 1999
AngkaTerbilang = "Seribu" + AngkaTerbilang(nilai - 1000)
Case 2000 To 999999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000)) + "Ribu" + AngkaTerbilang(nilai Mod 1000)
Case 1000000 To 999999999
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000000)) + "Juta" + AngkaTerbilang(nilai Mod 1000000)
Case Else
AngkaTerbilang = AngkaTerbilang(Fix(nilai / 1000000000)) + "Milyar" + AngkaTerbilang(nilai Mod 1000000000)
End Select
End Function
Komentar
Posting Komentar