Kamis, 16 Mei 2013

Listview Cantika Al Fitrah Sianturi



CODING PROGRAM

Public Class Form1
    Sub buatTabel()
        LV.Columns.Add("NIK", 150, HorizontalAlignment.Center)
        LV.Columns.Add("NAMA KARYAWAN", 150, HorizontalAlignment.Center)
        LV.Columns.Add("JABATAN", 150, HorizontalAlignment.Center)
        LV.Columns.Add("GAJI POKOK", 150, HorizontalAlignment.Center)
        LV.Columns.Add("STATUS", 150, HorizontalAlignment.Center)
        LV.Columns.Add("TUNJANGAN keluarga", 150, HorizontalAlignment.Center)
        LV.Columns.Add("PAJAK", 150, HorizontalAlignment.Center)
        LV.Columns.Add("TOTAL GAJI", 150, HorizontalAlignment.Center)
        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(tunjangankeluarga.Text)
        Lst.SubItems.Add(pajak.Text)
        Lst.SubItems.Add(totalgaji.Text)
        LV.Items.Add(Lst)
    End Sub
    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")
        jabatan.Items.Add("Mandor")
        jabatan.Items.Add("Kepala Bagian")
        jabatan.Items.Add("Staff")
        status.Items.Add("Menikah")
        status.Items.Add("Tidak Menikah")
    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 = 17500000
            Case "Kepala Bagian" : gaji.Text = 2500000
            Case "Staff" : 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 = "Cantika Al Fitrah Sianturi"
            Case "002" : nama.Text = "Omega"
            Case "003" : nama.Text = "Nova"

        End Select
    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" : tunjangankeluarga.Text = 0.15 * gaji.Text
            Case "Tidak Menikah" : tunjangankeluarga.Text = 0
        End Select
    End Sub

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        totalgaji.Text = Val(gaji.Text) + Val(tunjangankeluarga.Text) - Val(pajak.Text)
    End Sub

    Private Sub btnsimpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpn.Click
        IsiTabel()
        nik.Text = ""
        nama.Text = ""
        jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        tunjangankeluarga.Text = ""
        pajak.Text = ""
        totalgaji.Text = ""
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        lv.Items.Clear()
    End Sub

    Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
        lv.Items.Remove(lv.SelectedItems(0))
    End Sub
End Class


Tidak ada komentar: