Program berikut ini latihan penggajian karyawan menggunakan bahasa pemrograman visual basic/vb 6
Program ini termasuk memiliki logika yang sedang/sedikit rumit. :) masih sedikit yah :) hehehe
Program ini termasuk memiliki logika yang sedang/sedikit rumit. :) masih sedikit yah :) hehehe
Silahkan design tampilan program seperti dibawah ini :
Berikut listing program penggajian karyawan.
Dim lembur As Double
Private Sub cmdBaru_Click()
NIK.Text = ""
Nama.Text = ""
Status.Text = ""
Jabatan.Text = ""
Pajak.Text = ""
Total.Text = ""
Gaji.Text = ""
TunjIstri.Text = ""
TunjAnak.Text = ""
JAnak.Text = ""
Honor.Text = ""
JLembur.Text = ""
TunjAnak.Text = ""
End Sub
Private Sub CmdKeluar_Click()
Unload Me
End Sub
Private Sub CmdProses_Click()
Total.Text = Val(Gaji.Text) + Val(TunjIstri.Text) + Val(TunjAnak.Text) + Val(Honor.Text) - Val(Pajak.Text)
End Sub
Private Sub Form_Load()
NIK.AddItem "001"
NIK.AddItem "002"
NIK.AddItem "003"
Jabatan.AddItem "Mandor"
Jabatan.AddItem "Kepala Bagian"
Jabatan.AddItem "Staf"
Status.AddItem "Menikah"
Status.AddItem "Tidak Menikah"
For i = 1 To 5
JAnak.AddItem i
Next i
For i = 1 To 15
JLembur.AddItem i
Next i
Call cmdBaru_Click
End Sub
Private Sub Jabatan_Click()
Select Case Jabatan.Text
Case "Mandor":
Gaji.Text = 1750000
lembur = 7500
Case "Kepala Bagian": Gaji.Text = 2500000
lembur = 10000
Case "Staf": Gaji.Text = 1250000
lembur = 5000
End Select
Pajak.Text = 0.015 * Gaji.Text
End Sub
Private Sub JAnak_Click()
If JAnak.Text >= 2 Then
TunjAnak.Text = 0.07 * Gaji.Text
ElseIf JAnak.Text = 1 Then
TunjAnak.Text = 0.03 * Gaji.Text
Else
TunjAnak.Text = 0
End If
End Sub
Private Sub JLembur_Click()
Honor.Text = JLembur.Text * lembur
End Sub
Private Sub NIK_Click()
Select Case NIK.Text
Case "001": Nama.Text = "Oncom"
Case "002": Nama.Text = "Udin"
Case "003": Nama.Text = "Ujang"
End Select
End Sub
Private Sub Status_Click()
Select Case Status.Text
Case "Menikah":
TunjIstri.Text = 0.09 * Gaji.Text
JAnak.Enabled = True
Case "Tidak Menikah":
JAnak.Text = 0
JAnak.Enabled = False
TunjIstri.Text = 0
TunjAnak.Text = 0
End Select
End Sub
Untuk hasilnya silahkan aja lihat tampilan berikut ini :
Dim lembur As Double
Private Sub cmdBaru_Click()
NIK.Text = ""
Nama.Text = ""
Status.Text = ""
Jabatan.Text = ""
Pajak.Text = ""
Total.Text = ""
Gaji.Text = ""
TunjIstri.Text = ""
TunjAnak.Text = ""
JAnak.Text = ""
Honor.Text = ""
JLembur.Text = ""
TunjAnak.Text = ""
End Sub
Private Sub CmdKeluar_Click()
Unload Me
End Sub
Private Sub CmdProses_Click()
Total.Text = Val(Gaji.Text) + Val(TunjIstri.Text) + Val(TunjAnak.Text) + Val(Honor.Text) - Val(Pajak.Text)
End Sub
Private Sub Form_Load()
NIK.AddItem "001"
NIK.AddItem "002"
NIK.AddItem "003"
Jabatan.AddItem "Mandor"
Jabatan.AddItem "Kepala Bagian"
Jabatan.AddItem "Staf"
Status.AddItem "Menikah"
Status.AddItem "Tidak Menikah"
For i = 1 To 5
JAnak.AddItem i
Next i
For i = 1 To 15
JLembur.AddItem i
Next i
Call cmdBaru_Click
End Sub
Private Sub Jabatan_Click()
Select Case Jabatan.Text
Case "Mandor":
Gaji.Text = 1750000
lembur = 7500
Case "Kepala Bagian": Gaji.Text = 2500000
lembur = 10000
Case "Staf": Gaji.Text = 1250000
lembur = 5000
End Select
Pajak.Text = 0.015 * Gaji.Text
End Sub
Private Sub JAnak_Click()
If JAnak.Text >= 2 Then
TunjAnak.Text = 0.07 * Gaji.Text
ElseIf JAnak.Text = 1 Then
TunjAnak.Text = 0.03 * Gaji.Text
Else
TunjAnak.Text = 0
End If
End Sub
Private Sub JLembur_Click()
Honor.Text = JLembur.Text * lembur
End Sub
Private Sub NIK_Click()
Select Case NIK.Text
Case "001": Nama.Text = "Oncom"
Case "002": Nama.Text = "Udin"
Case "003": Nama.Text = "Ujang"
End Select
End Sub
Private Sub Status_Click()
Select Case Status.Text
Case "Menikah":
TunjIstri.Text = 0.09 * Gaji.Text
JAnak.Enabled = True
Case "Tidak Menikah":
JAnak.Text = 0
JAnak.Enabled = False
TunjIstri.Text = 0
TunjAnak.Text = 0
End Select
End Sub
Untuk hasilnya silahkan aja lihat tampilan berikut ini :
Sumber : Mesran.net