Home » » Jawaban Soal no 3 (Wiaman Sugiyanto)

Jawaban Soal no 3 (Wiaman Sugiyanto)

Written By Waiman Sugiyanto Gea on Minggu, 29 Januari 2012 | 08.15

Kasus : Penggajian Karyawan

Listing Progrma

Public Class Form_Login

Private Sub Pass_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Pass.KeyPress
        If Asc(e.KeyChar) = 13 Then
            If User.Text = "Waiman" And Pass.Text = "123" Then
                Form_Menu_Utama.show()
                Me.Hide()
            Else
                MsgBox("Maaf Username dan Password Salah")
                User.Text = ""
                Pass.Text = ""
                User.Focus()
            End If
        End If
End Sub

Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
        Close()
End Sub
End Class


Public Class Form_Menu_Utama

Private Sub PenggajianKaryawanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PenggajianKaryawanToolStripMenuItem.Click
        Form_Penggajian_Karyawan.Show()
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Close()
End Sub
End Class

Public Class Form_Penggajian_Karyawan

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Jabatan.Items.Add("Mandur")
        Jabatan.Items.Add("Kepala Bagian")
        Jabatan.Items.Add("Staf")

        Status.Items.Add("Menikah")
        Status.Items.Add("Tidak Menikah")
        Call buattabel()
    End Sub

    Private Sub Jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jabatan.SelectedIndexChanged
        If Jabatan.Text = "Mandur" Then
            Gaji_pokok.Text = 1750000
        ElseIf Jabatan.Text = "Kepala Bagian" Then
            Gaji_pokok.Text = 2500000
        ElseIf Jabatan.Text = "Staf" Then
            Gaji_pokok.Text = 1250000
        End If
        Pajak.Text = 0.015 * Gaji_pokok.Text
    End Sub

    Private Sub Status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
        If Status.Text = "Menikah" Then
            Tunjangan_istri.Text = 0.09 * Gaji_pokok.Text
        ElseIf Status.Text = "Tidak Menikah" Then
            Tunjangan_istri.Text = 0
        End If
    End Sub

    Private Sub Jumlah_anak_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Jumlah_anak.KeyPress
        If Asc(e.KeyChar) = 13 Then
            If Jumlah_anak.Text = 1 Then
                Tunjangan_anak.Text = 0.03 * Gaji_pokok.Text
            ElseIf Jumlah_anak.Text = 2 Then
                Tunjangan_anak.Text = 0.07 * Gaji_pokok.Text
            Else
                Tunjangan_anak.Text = 0
            End If
        End If
    End Sub

    Private Sub Jam_lembur_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Jam_lembur.KeyPress
        If Asc(e.KeyChar) = 13 Then
            If Jabatan.Text = "Mandur" Then
                Jam_lembur.Text = 1 : Upah_lembur.Text = 7500
            ElseIf Jabatan.Text = "Kepala Bagian" Then
                Jam_lembur.Text = 1 : Upah_lembur.Text = 10000
            ElseIf Jabatan.Text = "Staf" Then
                Jam_lembur.Text = 1 : Upah_lembur.Text = 5000
            End If

            Total_gaji.Text = Val(Gaji_pokok.Text) + Val(Tunjangan_istri.Text) + Val(Tunjangan_anak.Text) + Val(Upah_lembur.Text) - Val(Pajak.Text)
        End If
    End Sub
    Sub buattabel()
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True
        LV.Columns.Add("Nama", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Jabatan", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Gaji Pokok", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Status", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Tunjangan Istri", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Jumlah Anak", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Tunjangan Anak", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Pajak", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Jam Lembur", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Upah Lembur", 100, HorizontalAlignment.Center)
        LV.Columns.Add("Total Gaji", 100, HorizontalAlignment.Center)
    End Sub
    Sub isitabel()
        Dim lst As New ListViewItem
        lst.Text = Nama.Text
        lst.SubItems.Add(Jabatan.Text)
        lst.SubItems.Add(Gaji_pokok.Text)
        lst.SubItems.Add(Status.Text)
        lst.SubItems.Add(Tunjangan_istri.Text)
        lst.SubItems.Add(Jumlah_anak.Text)
        lst.SubItems.Add(Tunjangan_anak.Text)
        lst.SubItems.Add(Pajak.Text)
        lst.SubItems.Add(Jam_lembur.Text)
        lst.SubItems.Add(Upah_lembur.Text)
        lst.SubItems.Add(Total_gaji.Text)
        LV.Items.Add(lst)
    End Sub

    Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
        Call isitabel()
    End Sub

    Private Sub Btnhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemua.Click
        LV.Items.Clear()
    End Sub

    Private Sub Btnhapusdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdata.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
        Close()
    End Sub

    Private Sub Btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbersih.Click
        Nama.Text = ""
        Gaji_pokok.Text = ""
        Jabatan.Text = ""
        Status.Text = ""
        Tunjangan_anak.Text = ""
        Jumlah_anak.Text = ""
        Tunjangan_anak.Text = ""
        Pajak.Text = ""
        Jam_lembur.Text = ""
        Upah_lembur.Text = ""
        Total_gaji.Text = ""
        Tunjangan_istri.Text = ""
        Nama.Focus()
    End Sub
End Class
 

Hasil Program

Tampilan Form Login






Tampilan Form Menu Utama



Tampilan Form Penggajian Karyawan

 






Share this article :

0 komentar:

Posting Komentar

Diberdayakan oleh Blogger.


 
Support : Your Link | Your Link | Your Link
Copyright © 2013. Knowledge - All Rights Reserved
Template Created by Creating Website Modified by CaraGampang.Com
Proudly powered by Blogger