Minggu, 03 April 2011

Tugas VB 2

 

Dalam tugas ini saya membuat slip gaji.

ada 5 tingkatan jabatan, yaitu :

Manager, Supervisor, Staff, Assistan Staff, Junior Staff,

gaji mereka pun berbeda – beda.

ada juga 5 status, yakni :

1. K0 = Kawin, tanpa anak

2. K1 = Kawin, dengan 1 anak

3. K2 = Kawin, dengan 2 anak

4. K3 = Kawin, dengan 3 anak

5. BK = Belum kawin

Dalam status tersebut menyimpan tambahan gaji dan pajak tersendiri.

inilah screenshot programnya :

tgs2.1

Ada beberapa button yang mempunyai fungsi masing – masing, antara lain :

1. Button Hitung digunakan untuk menghitung gaji bersih.

2. Button Start untuk menghapus semua TextBox atau ComboBox

3. Button Cetak untuk mencetak slip gaji tersebut.

 

Ini contoh program yang sudah di isi :

tgs2.2

ini screenshot dari button cetak

tgs2.3

 

Inilah source code :

Public Class Form1


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Select Case ComboBox1.Text
            Case "Manager"
                TextBox3.Text = 10000000
            Case "Supervisor"
                TextBox3.Text = 8500000
            Case "Staff"
                TextBox3.Text = 7500000
            Case "Ass. Staff"
                TextBox3.Text = 5500000
            Case "Junior. Staff"
                TextBox3.Text = 4000000
        End Select
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Select Case ComboBox2.Text
            Case "K0"
                TextBox4.Text = 300000
                TextBox5.Text = (TextBox3.Text + +TextBox4.Text) * 7 / 100
            Case "K1"
                TextBox4.Text = 400000
                TextBox5.Text = (TextBox3.Text + +TextBox4.Text) * 5 / 100
            Case "K2"
                TextBox4.Text = 500000
                TextBox5.Text = (TextBox3.Text + +TextBox4.Text) * 4 / 100
            Case "K3"
                TextBox4.Text = 600000
                TextBox5.Text = (TextBox3.Text + +TextBox4.Text) * 3 / 100
            Case "BK"
                TextBox4.Text = 250000
                TextBox5.Text = (TextBox3.Text + +TextBox4.Text) * 10 / 100
        End Select
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox2.Text = (TextBox3.Text + +TextBox4.Text) - TextBox5.Text
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As String
        x = MsgBox("Cetak Slip", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Konfirmasi")
        If x = vbYes Then
            Me.Close()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = " "
        TextBox2.Text = " "
        TextBox3.Text = "-"
        TextBox4.Text = "-"
        TextBox5.Text = "-"
        ComboBox1.Text = " "
        ComboBox2.Text = " "
    End Sub
End Class

Terima Kasih

Febriawan Indra W ( 1006724362 )