Selasa, 24 Januari 2012

Program Penggajian Karywan


PublicClass Form1

PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load

        Nama.Focus()
        Jabatan.Items.Add("Mandor")
        Jabatan.Items.Add("Kepala Bagian")
        Jabatan.Items.Add("Staf")
        Status.Items.Add("Menikah")
        Status.Items.Add("Belum Menikah")
Call buattabel()


EndSub

PrivateSub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jabatan.SelectedIndexChanged
SelectCase Jabatan.Text
Case"Mandor"
                Gaji.Text = 1750000
                Pajak.Text = 0.015 * Val(Gaji.Text)
Case"Staf"
                Gaji.Text = 1250000
                Pajak.Text = 0.015 * Val(Gaji.Text)
Case"Kepala Bagian"
                Gaji.Text = 2500000
                Pajak.Text = 0.015 * Val(Gaji.Text)

EndSelect
        Status.Focus()

EndSub

PrivateSub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
Dim y AsString
        y = Status.Text = "Menikah"
If Jabatan.Text = "Mandor"Then
            tunj_istri.Text = 0.09 * 1750000
ElseIf Jabatan.Text = "Staf"Then
            tunj_istri.Text = 0.09 * 1250000
ElseIf Jabatan.Text = "Kepala Bagian"Then
            tunj_istri.Text = 0.09 * 2500000

EndIf
If Status.Text = "Belum Menikah"Then
            tunj_istri.Text = 0

EndIf
        jumlah_anak.Focus()
EndSub

PrivateSub Jumlah_anak_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah_anak.TextChanged
If jumlah_anak.Text = "1"Then
            tunj_anak.Text = 0.03 * Val(gaji.Text)
ElseIf jumlah_anak.Text = "2"Then
            tunj_anak.Text = 0.07 * Val(gaji.Text)
Else
            tunj_anak.Text = 0.07 * Val(gaji.Text)

EndIf
EndSub
PrivateSub lembur_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lembur.TextChanged
If jabatan.Text = "Mandor"Then
            upah_lembur.Text = 7500 * Val(lembur.Text)
ElseIf jabatan.Text = "Staf"Then
            upah_lembur.Text = 5000 * Val(lembur.Text)
ElseIf jabatan.Text = "Kepala Bagian"Then
            upah_lembur.Text = 10000 * Val(lembur.Text)

EndIf

EndSub
PrivateSub btnhitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhitung.Click
        total_gaji.Text = Val(gaji.Text) + Val(tunj_istri.Text) + Val(tunj_anak.Text) + Val(upah_lembur.Text) - Val(pajak.Text)

EndSub
Sub buattabel()
        LV.Columns.Add("Nama", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Jabatan", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Status", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Gaji Pokok", 100, HorizontalAlignment.Right)
        LV.Columns.Add("Tunjangan Istri", 120, HorizontalAlignment.Right)
        LV.Columns.Add("Jumlah Anak", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Tunjangan anak", 120, HorizontalAlignment.Right)
        LV.Columns.Add("Pajak", 100, HorizontalAlignment.Right)
        LV.Columns.Add("Jam Lembur", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Upah Lembur", 100, HorizontalAlignment.Right)
        LV.Columns.Add("Total Gaji", 100, HorizontalAlignment.Center)
        LV.View = View.Details
        LV.FullRowSelect = True
        LV.GridLines = True

EndSub
Sub isitabel()
Dim lst AsNew ListViewItem
        lst.Text = nama.Text
        lst.SubItems.Add(Jabatan.Text)
        lst.SubItems.Add(Status.Text)
        lst.SubItems.Add(Gaji.Text)
        lst.SubItems.Add(tunj_istri.Text)
        lst.SubItems.Add(jumlah_anak.Text)
        lst.SubItems.Add(tunj_anak.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(lembur.Text)
        lst.SubItems.Add(upah_lembur.Text)
        lst.SubItems.Add(total_gaji.Text)
        LV.Items.Add(lst)

EndSub

PrivateSub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbersih.Click
        Nama.Text = ""
        Jabatan.Text = ""
        Status.Text = ""
        Gaji.Text = ""
        tunj_istri.Text = ""
        jumlah_anak.Text = ""
        tunj_anak.Text = ""
        Pajak.Text = ""
        lembur.Text = ""
        upah_lembur.Text = ""
        total_gaji.Text = ""

        Nama.Focus()
EndSub

PrivateSub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
Call isitabel()
        Nama.Text = ""
        Jabatan.Text = ""
        Status.Text = ""
        Gaji.Text = ""
        tunj_istri.Text = ""
        jumlah_anak.Text = ""
        tunj_istri.Text = ""
        Pajak.Text = ""
        lembur.Text = ""
        upah_lembur.Text = ""
        total_gaji.Text = ""

        Nama.Focus()

EndSub

PrivateSub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        LV.Items.Clear()


EndSub

PrivateSub btnhapuspilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapuspilih.Click
        LV.Items.Remove(LV.SelectedItems(0))

EndSub

PrivateSub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
Dim x AsString
        x = MsgBox("Anda Yakin Ingin Keluar", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Keluar")
If x = vbYes Then
            Close()

EndIf
EndSub
EndClass




Hasilnya akan seperti gambar di bawah ini :

Tidak ada komentar:

Posting Komentar