BAHASA PEMROGRAMAN VB.NET 2008 DENGAN MENGGUNAKAN LISTVIEW (FORM PENGGAJIAN)

Ditulis oleh: -
NB : Untuk Memenuhi Tugas Bahasa Pemrograman 

Tampilan Listview pada saat di jalankan






 Public Class Form1

    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("Kepala Bagian")
        JABATAN.Items.Add("Staff")
        STATUS.Items.Add("Menikah")
        STATUS.Items.Add("Tidak Menikah")
        For i = 1 To 4
            Jlh_Anak.Items.Add(i)
        Next i
        For i = 1 To 10
            Jam_Lembur.Items.Add(i)
        Next i
        BuatTabel()

    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
        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" : Tunjangan_Istri.Text = 0.09 * GAJI.Text
            Case "Tidak Menikah" : Tunjangan_Istri.Text = 0
        End Select

    End Sub

    Private Sub Jlh_Anak_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jlh_Anak.SelectedIndexChanged
        If Jlh_Anak.Text >= 2 And STATUS.Text = "Menikah" Then
            Tunjangan_Anak.Text = 0.07 * GAJI.Text
        ElseIf Jlh_Anak.Text = 1 And STATUS.Text = "Tidak Menikah" Then
            Tunjangan_Anak.Text = 0.03 * GAJI.Text
        Else
            Tunjangan_Anak.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
            Honor_Lembur.Text = Jam_Lembur.Text * 7500
        ElseIf JABATAN.Text = "Kepala Bagian" Then
            Honor_Lembur.Text = Jam_Lembur.Text * 310000
        ElseIf JABATAN.Text = "Staff" Then
            Honor_Lembur.Text = Jam_Lembur.Text * 5000
        Else
            Honor_Lembur.Text = 0
        End If
        Total.Text = Val(Honor_Lembur.Text) + Val(GAJI.Text) + Val(Tunjangan_Istri.Text) + Val(Tunjangan_Anak.Text) + Val(Pajak.Text)

    End Sub

    Private Sub BtnBaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBaru.Click
        NAMA.Text = ""
        NIK.Text = ""
        JABATAN.Text = ""
        GAJI.Text = ""
        STATUS.Text = ""
        Tunjangan_Istri.Text = ""
        Jlh_Anak.Text = ""
        Tunjangan_Anak.Text = ""
        Jam_Lembur.Text = ""
        Honor_Lembur.Text = ""
        Pajak.Text = ""
        Total.Text = ""

    End Sub

    Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
        IsiTabel()
        NIK.Text = ""
        NAMA.Text = ""
        JABATAN.Text = ""
        GAJI.Text = ""
        STATUS.Text = ""
        Tunjangan_Istri.Text = ""
        Jlh_Anak.Text = ""
        Tunjangan_Anak.Text = ""
        Jam_Lembur.Text = ""
        Honor_Lembur.Text = ""
        Pajak.Text = ""
        Total.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 LV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LV.SelectedIndexChanged

    End Sub
    Sub BuatTabel()
        LV.Columns.Add("NIK", 80, HorizontalAlignment.Center)
        LV.Columns.Add("NAMA", 180, HorizontalAlignment.Left)
        LV.Columns.Add("JABATAN", 80, HorizontalAlignment.Center)
        LV.Columns.Add("GAJI", 80, HorizontalAlignment.Center)
        LV.Columns.Add("STATUS", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Tunjangan Istri", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Jumlah Anak", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Tunjangan Anak", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Jam Lembur", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Honor Lembur", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Pajak", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Total", 80, 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(Tunjangan_Istri.Text)
        Lst.SubItems.Add(Jlh_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.Text)
        LV.Items.Add(Lst)
    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 = "Ibnu"
            Case "002" : NAMA.Text = "Kholdun"
            Case "003" : NAMA.Text = "Nur Ritonga"
            Case Else
                NAMA.Text = ""  'Apabila tidak ada yang sama
        End Select

    End Sub

    Private Sub NAMA_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NAMA.TextChanged

    End Sub
End Class

Sekian & Terima kasih
Semoga bermanfaat bagi teman-teman semua.




Comments
0 Comments

0 komentar "BAHASA PEMROGRAMAN VB.NET 2008 DENGAN MENGGUNAKAN LISTVIEW (FORM PENGGAJIAN)", Baca atau Masukkan Komentar

Posting Komentar