Selasa, 14 Mei 2013

Tugas Pak Mesran

CODING :


Public Class Form Pegawai
    Private Sub Form Pegawai_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("Staf")
        Status.Items.Add("Menikah")
        Status.Items.Add("Tidak Menikah")
    End Sub
    Sub BuatTabel()
        LV.Columns.Add("NIK", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Nama", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Jabatan", 100, HorizontalAlignment.Left)
        LV.Columns.Add("Gaji", 80, HorizontalAlignment.Left)
        LV.Columns.Add("Status", 100, HorizontalAlignment.Right)
        LV.Columns.Add("Tunjangan", 80, HorizontalAlignment.Right)
        LV.Columns.Add("Pajak", 80, HorizontalAlignment.Left)
        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(Tunjangan.Text)
        lst.SubItems.Add(Pajak.Text)
        lst.SubItems.Add(Total.Text)
        LV.Items.Add(lst)
    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 "Staf" : 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 = "Oncom"
            Case "002" : Nama.Text = "Udin"
            Case "003" : Nama.Text = "Ujang"
        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 "Tidak Menikah" : Tunjangan.Text = 0
        End Select
    End Sub
    Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
        End
    End Sub
    Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
        Total.Text = Val(Gaji.Text) + Val(Tunjangan.Text) - Val(Pajak.Text)
    End Sub
    Private Sub Btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus.Click
        NIK.Text = ""
        Nama.Text = ""
        Jabatan.Text = ""
        Gaji.Text = ""
        Status.Text = ""
        Tunjangan.Text = ""
        Total.Text = ""
        Pajak.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.Text = ""
        Pajak.Text = ""
        Total.Text = ""
    End Sub
    Private Sub Btnhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemua.Click
        LV.Items.Clear()
    End Sub
    End Sub
End Class

0 komentar: