Sabtu, 28 Januari 2012

jawaban soal no.3

 KASUS
soal no.3(penggajian karyawan)

LISTING PROGRAM

Public Class PEGAWAI

    Private Sub PEGAWAI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BuatTabel()
        JABATAN.Items.Add("MANDOR")
        JABATAN.Items.Add("KABAG")
        JABATAN.Items.Add("STAFF")
        STATUS.Items.Add("MENIKAH")
        STATUS.Items.Add("TIDAK MENIKAH")
    End Sub
    Sub BuatTabel()
        With LV()
            .Columns.Add("NAMA", 100, HorizontalAlignment.Center)
            .Columns.Add("JABATAN", 120, HorizontalAlignment.Left)
            .Columns.Add("GAJI", 100, HorizontalAlignment.Left)
            .Columns.Add("STATUS", 100, HorizontalAlignment.Left)
            .Columns.Add("JUMLAH ANAK", 80, HorizontalAlignment.Left)
            .Columns.Add("TUNJANGAN ANAK", 120, HorizontalAlignment.Left)
            .Columns.Add("JAM", 80, HorizontalAlignment.Left)
            .Columns.Add("LEMBUR", 110, HorizontalAlignment.Left)
            .Columns.Add("TUNJANGAN ISTRI", 120, HorizontalAlignment.Left)
            .Columns.Add("PAJAK", 80, HorizontalAlignment.Left)
            .Columns.Add("TOTAL GAJI", 80, HorizontalAlignment.Left)
            .GridLines = True
            .FullRowSelect = True
            .View = View.Details
        End With
    End Sub
    Sub IsiTabel()
        Dim Lst As New ListViewItem
        With Lst
            .Text = NAMA.Text
            .SubItems.Add(JABATAN.Text)
            .SubItems.Add(GAJI.Text)
            .SubItems.Add(STATUS.Text)
            .SubItems.Add(JLHANAK.Text)
            .SubItems.Add(TUNJANGANANAK.Text)
            .SubItems.Add(JAM.Text)
            .SubItems.Add(LEMBUR.Text)
            .SubItems.Add(TUNJANGANISTRI.Text)
            .SubItems.Add(PAJAK.Text)
            .SubItems.Add(TTLGAJI.Text)
            LV.Items.Add(Lst)
        End With
    End Sub

    Private Sub JABATAN_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JABATAN.SelectedIndexChanged
        If JABATAN.Text = "MANDOR" Then
            GAJI.Text = 175000
        ElseIf JABATAN.Text = "KABAG" Then
            GAJI.Text = 2500000
        ElseIf JABATAN.Text = "STAFF" Then
            GAJI.Text = 1250000
        Else
            GAJI.Text = " "
        End If
    End Sub

    Private Sub STATUS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STATUS.SelectedIndexChanged
        If STATUS.Text = "MENIKAH" Then
            TUNJANGANISTRI.Text = 9 * GAJI.Text / 100
            PAJAK.Text = 1.5 * GAJI.Text / 100
        ElseIf STATUS.Text = "TIDAK MENIKAH" Then
            TUNJANGANANAK.Text = 0
            TUNJANGANISTRI.Text = 0
            PAJAK.Text = 1.5 * GAJI.Text / 100
        Else
            STATUS.Text = " "
        End If
    End Sub
   
    Private Sub JAM_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JAM.TextChanged
        If JABATAN.Text = "MANDOR" Then
            LEMBUR.Text = Val(JAM.Text) * 7500
        ElseIf JABATAN.Text = "KABAG" Then
            LEMBUR.Text = Val(JAM.Text) * 10000
        ElseIf JABATAN.Text = "STAFF" Then
            LEMBUR.Text = Val(JAM.Text) * 5000
        End If
    End Sub

    Private Sub JLANAK_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JLHANAK.TextChanged
        If Val(JLHANAK.Text) = 1 Then
            TUNJANGANANAK.Text = 3 * GAJI.Text / 100
        ElseIf Val(JLHANAK.Text) >= 2 Then
            TUNJANGANANAK.Text = 7 * GAJI.Text / 100
        End If
    End Sub
    Sub PROSES()
        TTLGAJI.Text = Val(GAJI.Text) + Val(TUNJANGANISTRI.Text) + Val(TUNJANGANANAK.Text) + Val(LEMBUR.Text) - Val(PAJAK.Text)
    End Sub
    Private Sub BTNTOTAL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNTOTAL.Click
        Call PROSES()
    End Sub

    Private Sub BTNSIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSIMPAN.Click
        IsiTabel()
    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 BTNDATA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNDATA.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub

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

    Private Sub BTNBERSIH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBERSIH.Click
        NAMA.Text = ""
        JABATAN.Text = ""
        STATUS.Text = ""
        GAJI.Text = ""
        JLHANAK.Text = ""
        TUNJANGANANAK.Text = ""
        JAM.Text = ""
        LEMBUR.Text = ""
        TUNJANGANISTRI.Text = ""
        PAJAK.Text = ""
        TTLGAJI.Text = ""
    End Sub
End Class

HASIL PROGRAM




Tidak ada komentar:

Posting Komentar