ListView Penggajian Karyawan
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattabel()
nik.Items.Add("1111307")
nik.Items.Add("1111360")
nik.Items.Add("1111488")
nik.Items.Add("1111485")
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("Staff")
jabatan.Items.Add("Kurir")
status.Items.Add("Menikah")
status.Items.Add("Tidak Menikah")
For i = 1 To 6
jumlahanak.Items.Add(i)
Next i
For i = 1 To 10
jamlembur.Items.Add(i)
Next i
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 "Staff" : gaji.Text = 1250000
Case "Kurir" : gaji.Text = 1000000
End Select
pajak.Text = 0.015 * gaji.Text
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
Select Case status.Text
Case "Menikah" : tunjanganistri.Text = 0.09 * gaji.Text
Case "Tidak Menikah" : tunjanganistri.Text = 0
End Select
End Sub
Private Sub jumlahanak_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlahanak.SelectedIndexChanged
If jumlahanak.Text = 1 And status.Text = "Menikah" Then
tunjangananak.Text = 0.03 * gaji.Text
ElseIf jumlahanak.Text >= 2 And status.Text = "Menikah" Then
tunjangananak.Text = 0.07 * gaji.Text
Else
tunjangananak.Text = 0
End If
End Sub
Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
If jabatan.Text = "Mandor" Then
honorlembur.Text = 7500
ElseIf jabatan.Text = "Kepala Bagian" Then
honorlembur.Text = 10000
ElseIf jabatan.Text = "Staff" Then
honorlembur.Text = 8000
ElseIf jabatan.Text = "Kurir" Then
honorlembur.Text = 5000
Else
honorlembur.Text = 0
End If
total.Text = Val(honorlembur.Text * jamlembur.Text) + Val(gaji.Text) + Val(tunjanganistri.Text) + Val(tunjangananak.Text)
End Sub
Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
End
End Sub
Private Sub Btnbaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbaru.Click
nik.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
tunjanganistri.Text = ""
jumlahanak.Text = ""
tunjangananak.Text = ""
jamlembur.Text = ""
honorlembur.Text = ""
pajak.Text = ""
total.Text = ""
End Sub
Sub buattabel()
ListView1.Columns.Add("Nik", 50, HorizontalAlignment.Left)
ListView1.Columns.Add("Nama", 80, HorizontalAlignment.Left)
ListView1.Columns.Add("Jabatan", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Gaji", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Status", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Tunjangan istri", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Jumlah Anak", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Tunjangan Anak", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Jam Lembur", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Honor lembur", 120, HorizontalAlignment.Left)
ListView1.Columns.Add("Pajak", 90, HorizontalAlignment.Left)
ListView1.Columns.Add("Total", 90, HorizontalAlignment.Left)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.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(TunjanganIstri.Text)
lst.SubItems.Add(JumlahAnak.Text)
lst.SubItems.Add(TunjanganAnak.Text)
lst.SubItems.Add(JamLembur.Text)
lst.SubItems.Add(HonorLembur.Text)
lst.SubItems.Add(Pajak.Text)
lst.SubItems.Add(Total.Text)
ListView1.Items.Add(lst)
End Sub
Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
isitabel()
End Sub
Private Sub Btnhapusdataygdipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdataygdipilih.Click
ListView1.Items.Remove(ListView1.SelectedItems(0))
End Sub
Private Sub Btnhapussemuadata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemuadata.Click
ListView1.Items.Clear()
End Sub
Private Sub nik_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nik.SelectedIndexChanged
Select nik.Text
Case "1111307" : nama.Text = "Michael"
Case "1111360" : nama.Text = "Mulyadin"
Case "1111488" : nama.Text = "Rijun Angkat"
Case "1111485" : nama.Text = "M.Iqdam "
End Select
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
End Class
Sumber :
http://mulyadin22.blogspot.com/2013/05/listview-penggajian-karyawan-visual.html