Senin, 20 Mei 2013

pemograman 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.Center)
        lv.Columns.Add("gaji", 80, HorizontalAlignment.Left)
        lv.Columns.Add("status", 80, HorizontalAlignment.Center)
        lv.Columns.Add("tunjangan", 80, HorizontalAlignment.Left)
        lv.Columns.Add("pajak", 80, HorizontalAlignment.Center)
        lv.Columns.Add("total", 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(tunj.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(total.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("manager")
        jabatan.Items.Add("wakase")
        jabatan.Items.Add("staff")

        status.Items.Add("menikah")
        status.Items.Add("tidak menikah")

    End Sub

    Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
        isitabel()
        nik.Text = ""
        nama.Text = ""
        jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        tunj.Text = ""
        pajak.Text = ""
        total.Text = ""
    End Sub

    Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
        Select Case jabatan.Text
            Case "manager" : gaji.Text = 5000000
            Case "wakase" : gaji.Text = 3500000
            Case "staff" : gaji.Text = 16000000
        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 = "Alexander p"
            Case "002" : nama.Text = "Alex Keceng"
            Case "003" : nama.Text = "Alex keceng coyy"
        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" : tunj.Text = 0.15 * gaji.Text
            Case "tidak menikah" : tunj.Text = 0
        End Select
    End Sub

    Private Sub proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proses.Click
        total.Text = Val(gaji.Text) + Val(tunj.Text) - Val(pajak.Text)
    End Sub

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
        End
    End Sub

    Private Sub baru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles baru.Click
        nik.Text = ""
        nama.Text = ""
        jabatan.Text = ""
        gaji.Text = ""
        status.Text = ""
        tunj.Text = ""
        pajak.Text = ""
        total.Text = ""
    End Sub

    Private Sub pajak_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pajak.TextChanged

    End Sub

    Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click

    End Sub

    Private Sub total_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles total.TextChanged

    End Sub
End Class















Tidak ada komentar:

Posting Komentar