Kamis, 16 Mei 2013

TUGAS BAHASA PEMROGRAMAN VB 2008

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
        NIK.Items.Add("1111157")
        NIK.Items.Add("1111160")
        NIK.Items.Add("1111988")

        NIK.Items.Add("1111045")
        NIK.Items.Add("1111046")
        NIK.Items.Add("1111047")


        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
            JA.Items.Add(i)
        Next i
        For i = 1 To 10
            JL.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 STATUS.Text
            Case "Menikah" : TI.Text = 0.09 * GAJI.Text
            Case "Tidak Menikah" : TI.Text = 0
        End Select
    End Sub

    Private Sub JA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JA.SelectedIndexChanged
        If JA.Text >= 2 And STATUS.Text = "Menikah" Then
            TA.Text = 0.07 * GAJI.Text
        ElseIf JA.Text = 1 And STATUS.Text = "Tidak Menikah" Then
            TA.Text = 0.03 * GAJI.Text
        Else
            TA.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
            HL.Text = JL.Text * 7500
        ElseIf JABATAN.Text = "Kepala Bagian" Then
            HL.Text = JL.Text * 10000
        ElseIf JABATAN.Text = "Staff" Then
            HL.Text = JL.Text * 5000
        Else
            HL.Text = 0
        End If
        TOTAL.Text = Val(HL.Text) + Val(GAJI.Text) + Val(TI.Text) + Val(TA.Text) + Val(PAJAK.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 ("1111157") : NAMA.Text = " Friska Pratiwi "
            Case ("1111160") : NAMA.Text = " Puji Lestari "
            Case ("1111988") : NAMA.Text = " Suvita Sari "

            Case ("1111045") : NAMA.Text = " Watini "
            Case ("1111046") : NAMA.Text = " Dwi Novira "
            Case ("1111047") : NAMA.Text = " Sukhairani "


        End Select
    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 = ""
        TI.Text = ""
        JA.Text = ""
        TA.Text = ""
        JL.Text = ""
        HL.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", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Gaji", 80, HorizontalAlignment.Center)
        LV.Columns.Add("Status", 100, 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(TI.Text)
        Lst.SubItems.Add(JA.Text)
        Lst.SubItems.Add(TA.Text)
        Lst.SubItems.Add(JL.Text)
        Lst.SubItems.Add(HL.Text)
        Lst.SubItems.Add(PAJAK.Text)
        Lst.SubItems.Add(TOTAL.Text)
        LV.Items.Add(Lst)
    End Sub

    Private Sub BTNSIMPANLV_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSIMPANLV.Click
        IsiTabel()
        NIK.Text = ""
        NAMA.Text = ""
        JABATAN.Text = ""
        GAJI.Text = ""
        STATUS.Text = ""
        TI.Text = ""
        JA.Text = ""
        TA.Text = ""
        JL.Text = ""
        HL.Text = ""
        PAJAK.Text = ""
        TOTAL.Text = ""
    End Sub
End Class






TUGAS BAHASA PEMROGRAMAN 

VISUAL BASIC 2008


Tidak ada komentar:

Posting Komentar