Thursday, 16 May 2013

Program Penggajian Menggunakan Listview

http://www.mesran.blogspot.com/2013/05/tugas-ti-p1104.html
Desain Awal

Listing Program

Public Class Form1
    Sub buattabel()
        ListView1.Columns.Add("nik", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("nama", 180, HorizontalAlignment.Center)
        ListView1.Columns.Add("jabatan", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("gaji", 100, HorizontalAlignment.Center)
        ListView1.Columns.Add("status", 80, HorizontalAlignment.Center)
        ListView1.Columns.Add("tunjangan", 100, HorizontalAlignment.Center)
        ListView1.Columns.Add("pajak", 100, HorizontalAlignment.Center)
        ListView1.Columns.Add("total", 100, HorizontalAlignment.Center)
        ListView1.View = View.Details
        ListView1.GridLines = True
        ListView1.FullRowSelect = True
    End Sub
    Sub isitabel()
        Dim hh As New ListViewItem
        hh.Text = nik.Text
        hh.SubItems.Add(nama.Text)
        hh.SubItems.Add(jabatan.Text)
        hh.SubItems.Add(gaji.Text)
        hh.SubItems.Add(status.Text)
        hh.SubItems.Add(tunjangan.Text)
        hh.SubItems.Add(pajak.Text)
        hh.SubItems.Add(total.Text)
        ListView1.Items.Add(hh)
    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("Babu")
        jabatan.Items.Add("Staff")

        status.Items.Add("Menikah")
        status.Items.Add("Belum Menikah")

        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 = "Ngatimen"
            Case "002" : nama.Text = "Parmen"
            Case "003" : nama.Text = "Ali Muda"
        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" : tunjangan.Text = 0.15 * gaji.Text
            Case "Belum Menikah" : tunjangan.Text = 0
        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 = 1750000
            Case "Babu" : gaji.Text = 2500000
            Case "Staff" : gaji.Text = 3500000
        End Select
        pajak.Text = 0.15 * gaji.Text
    End Sub

    Private Sub Bproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bproses.Click
        total.Text = Val(gaji.Text) + Val(tunjangan.Text) + Val(pajak.Text)
        isitabel()
    End Sub

    Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
        End
    End Sub
 Private Sub Bbaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bbaru.Click
        nik.Text = ""
        nama.Text = ""
        jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        tunjangan.Text = ""
        pajak.Text = ""
        total.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListView1.Items.Remove(ListView1.SelectedItems(0))
    End Sub
End Class


Hasil Program

Categories:

0 komentar:

Post a Comment