Rabu, 22 Mei 2013

PENGGAJIAN KARYAWAN MENGGUNAKAN LISTVIEW PADA PROGRAM MICROSOFT VISUAL STUDIO 2008

List View Penggajian




Public Class Form1
    Sub buattabel()
        lv.Columns.Add("nik", 80, HorizontalAlignment.Center)
        lv.Columns.Add("nama", 80, HorizontalAlignment.Left)
        lv.Columns.Add("jabatan", 80, HorizontalAlignment.Left)
        lv.Columns.Add("gaji", 80, HorizontalAlignment.Left)
        lv.Columns.Add("status", 80, HorizontalAlignment.Left)
        lv.Columns.Add("tunjkel", 80, HorizontalAlignment.Left)
        lv.Columns.Add("JAnak", 80, HorizontalAlignment.Left)
        lv.Columns.Add("TAnak", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Lembur", 80, HorizontalAlignment.Left)
        lv.Columns.Add("Ulembur", 80, HorizontalAlignment.Left)
        lv.Columns.Add("pajak", 80, HorizontalAlignment.Left)
        lv.Columns.Add("totgaji", 80, 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(tunjkel.Text)
        lst.SubItems.Add(JAnak.Text)
        lst.SubItems.Add(TAnak.Text)
        lst.SubItems.Add(Lembur.Text)
        lst.SubItems.Add(Ulembur.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(totgaji.Text)
        lv.items.add(lst)
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nik.Items.Add("001")
        nik.Items.Add("002")
        nik.Items.Add("003")
        jabatan.Items.Add("mandor")
        jabatan.Items.Add("karyawan")
        jabatan.Items.Add("staf")
        status.Items.Add("menikah")
        status.Items.Add("belum menikah")
        For i = 1 To 4
            JAnak.Items.Add(i)
        Next i
        For i = 1 To 10
            Lembur.Items.Add(i)
        Next i
        buattabel()
    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 = "boy"
            Case "002" : nama.Text = "fernando"
            Case "003" : nama.Text = "silaban"
        End Select
    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 = "1000000"
            Case "karyawan" : gaji.Text = "1500000"
            Case "staf" : gaji.Text = "1250000"
        End Select
        pajak.Text = 0.15 * 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" : tunjkel.Text = 0.15 * gaji.Text
            Case "belum menikah" : tunjkel.Text = 0
        End Select
    End Sub
    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        If jabatan.Text = "Mandor" Then
            Ulembur.Text = 7500
        ElseIf jabatan.Text = "Kepala Bagian" Then
            Ulembur.Text = 10000
        ElseIf jabatan.Text = "Staff" Then
            Ulembur.Text = 500
        Else
            Ulembur.Text = 0
        End If
        totgaji.Text = Val(Ulembur.Text * Lembur.Text) + Val(gaji.Text) + Val(tunjkel.Text) + Val(TAnak.Text) - (pajak.Text)
    End Sub
    Private Sub btnbaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbaru.Click
        End
    End Sub
    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        nik.Text = ""
        nama.Text = ""
        tunjkel.Text = ""
        status.Text = ""
        gaji.Text = ""
        jabatan.Text = ""
        totgaji.Text = ""
        pajak.Text = ""
    End Sub
    Private Sub lst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lst.Click
        isitabel()
        nik.Text = ""
        nama.Text = ""
        jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        tunjkel.Text = ""
        pajak.Text = ""
        totgaji.Text = ""
    End Sub
    Private Sub JAnak_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JAnak.SelectedIndexChanged
        If JAnak.Text >= 2 And status.Text = "menikah" Then
            TAnak.Text = 0.07 * gaji.Text
        ElseIf JAnak.Text = 1 And status.Text = "menikah" Then
            TAnak.Text = 0.03 * gaji.Text
        Else
            TAnak.Text = 0
        End If
    End Sub
    Private Sub Ulembur_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ulembur.TextChanged
    End Sub
    Private Sub nama_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nama.TextChanged
    End Sub
End Class

0 komentar: