SIMULATOR PENGGAJIAN KARYAWAN MENGGUNAKAN LISTVIEW
FROM SEBELUMNYA:
CODDING PROGRAMNYA :
Public Class Form1
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
BuatTabel()
nik.Items.Add("001")
nik.Items.Add("002")
nik.Items.Add("003")
For i =
1 To 4
jumlah_anak.Items.Add(i)
Next i
For i =
1 To 10
jam_lembur.Items.Add(i)
Next i
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("Staf")
status.Items.Add("Menikah")
status.Items.Add("Tidak Menikah")
Me.Text
= "Rahmi Rasfanny"
End Sub
Sub
BuatTabel()
LV.Columns.Add("Nik",
50, HorizontalAlignment.Left)
LV.Columns.Add("Nama",
150, HorizontalAlignment.Left)
LV.Columns.Add("Jabatan",
120, HorizontalAlignment.Left)
LV.Columns.Add("Gaji",
120, HorizontalAlignment.Left)
LV.Columns.Add("Status",
120, HorizontalAlignment.Left)
LV.Columns.Add("tunjangan
istri", 120, HorizontalAlignment.Left)
LV.Columns.Add("jumlah
anak", 120, HorizontalAlignment.Left)
LV.Columns.Add("tunjangan
anak", 120, HorizontalAlignment.Left)
LV.Columns.Add("jam
lembur", 120, HorizontalAlignment.Left)
LV.Columns.Add("honor
lembur", 120, HorizontalAlignment.Left)
LV.Columns.Add("Pajak",
90, HorizontalAlignment.Left)
LV.Columns.Add("Total
Gaji", 90, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub
IsiTabel()
Dim Lst
As New
ListViewItem
Lst.Text = nik.Text
Lst.SubItems.Add(nama.Text)
Lst.SubItems.Add(jabatan.Text)
Lst.SubItems.Add(gaji.Text)
Lst.SubItems.Add(status.Text)
Lst.SubItems.Add(tunjangan_istri.Text)
Lst.SubItems.Add(jumlah_anak.Text)
Lst.SubItems.Add(tunjangan_anak.Text)
Lst.SubItems.Add(jam_lembur.Text)
Lst.SubItems.Add(honor_lembur.Text)
Lst.SubItems.Add(pajak.Text)
Lst.SubItems.Add(total_gaji.Text)
LV.Items.Add(Lst)
End Sub
Private Sub jabatan_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
jabatan.SelectedIndexChanged
Select Case jabatan.Text
Case
"Mandor" : gaji.Text = 1750000
Case
"Kepala Bagian" : gaji.Text =
2500000
Case
"Staf" : gaji.Text = 1250000
End Select
pajak.Text = 0.15 * gaji.Text
End Sub
Private Sub nik_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles nik.SelectedIndexChanged
Select Case nik.Text
Case
"001" : nama.Text = "Rahmi Rasfanny"
Case
"002" : nama.Text = "Nita Rahmayuni"
Case
"003" : nama.Text = "forever"
End Select
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
status.SelectedIndexChanged
Dim x As String
x =
Microsoft.VisualBasic.Mid(status.Text, 2)
Select Case (status.Text)
Case
"Menikah" : tunjangan_istri.Text =
0.09 * gaji.Text
Case
"tidak menikah" :
tunjangan_istri.Text = 0
End Select
status.Text = Val(tunjangan_istri.Text)
* Val(status.Text)
End Sub
Private Sub btnsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnsimpan.Click
IsiTabel()
End Sub
Private Sub btnhapussemua_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapussemua.Click
LV.Items.Clear()
End Sub
Private Sub btnhapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapus.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub btnproses_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles btnproses.Click
If
jabatan.Text = "Mandor" Then
honor_lembur.Text = "7500"
ElseIf
jabatan.Text = "Kepala Bagian" Then
honor_lembur.Text = "1000"
ElseIf
jabatan.Text = "Staf" Then
honor_lembur.Text = "5000"
Else
honor_lembur.Text = 0
End If
total_gaji.Text = Val(jam_lembur.Text)
+ Val(gaji.Text) + Val(tunjangan_istri.Text) + Val(tunjangan_anak.Text) -
Val(pajak.Text)
End Sub
Private Sub btnkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
Me.Close()
End Sub
Private Sub jumlah_anak_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
jumlah_anak.SelectedIndexChanged
Dim x As String
x =
Microsoft.VisualBasic.Mid(status.Text, 2)
If
jumlah_anak.Text >= 2 And status.Text = "Menikah" Then
tunjangan_anak.Text = 0.07 *
gaji.Text
ElseIf
jumlah_anak.Text = 1 And status.Text = "menikah" Then
tunjangan_anak.Text = 0.03 *
gaji.Text
End If
jumlah_anak.Text =
Val(tunjangan_anak.Text) * Val(jumlah_anak.Text)
End Sub
Private Sub Botton1Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_hapus.Click
nik.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
tunjangan_istri.Text = ""
jumlah_anak.Text = ""
tunjangan_anak.Text = ""
jam_lembur.Text = ""
honor_lembur.Text = ""
pajak.Text = ""
total_gaji.Text = ""
End Sub
End Class
HASIL PROGRAMNYA :