Rabu, 18 Mei 2011

Coding Visual Basic Menghitung Gaji Pegawai

Public Class Hitung_Gaji

    Private Sub BtnHitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHitung.Click
        If Me.RadA.Checked = True Then
            If TxtLamaKerja.Text < 6 Then
                LblBonus.Text = Val(TxtGaji.Text) * 0.05
            End If
            If Me.RadA.Checked = True Then
                If TxtLamaKerja.Text > 5 And TxtLamaKerja.Text <= 10 Then
                    LblBonus.Text = Val(TxtGaji.Text) * 0.1
                End If
                If Me.RadA.Checked = True Then
                    If TxtLamaKerja.Text > 10 And TxtLamaKerja.Text <= 15 Then
                        LblBonus.Text = Val(TxtGaji.Text) * 0.15
                    End If
                    If Me.RadA.Checked = True Then
                        If TxtLamaKerja.Text > 15 And TxtLamaKerja.Text <= 20 Then
                            LblBonus.Text = Val(TxtGaji.Text) * 0.2
                        End If
                        If Me.RadA.Checked = True Then
                            If TxtLamaKerja.Text > 20 And TxtLamaKerja.Text <= 25 Then
                                LblBonus.Text = Val(TxtGaji.Text) * 0.25
                            End If
                            If Me.RadA.Checked = True Then
                                If TxtLamaKerja.Text > 25 Then
                                    LblBonus.Text = Val(TxtGaji.Text) * 0.3
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
        If Me.RadB.Checked = True Then
            If TxtLamaKerja.Text < 6 Then
                LblBonus.Text = Val(TxtGaji.Text) * 0.1
            End If
            If Me.RadB.Checked = True Then
                If TxtLamaKerja.Text > 5 And TxtLamaKerja.Text <= 10 Then
                    LblBonus.Text = Val(TxtGaji.Text) * 0.15
                End If
                If Me.RadB.Checked = True Then
                    If TxtLamaKerja.Text > 10 And TxtLamaKerja.Text <= 15 Then
                        LblBonus.Text = Val(TxtGaji.Text) * 0.2
                    End If
                    If Me.RadB.Checked = True Then
                        If TxtLamaKerja.Text > 15 And TxtLamaKerja.Text <= 20 Then
                            LblBonus.Text = Val(TxtGaji.Text) * 0.25
                        End If
                        If Me.RadB.Checked = True Then
                            If TxtLamaKerja.Text > 20 And TxtLamaKerja.Text <= 25 Then
                                LblBonus.Text = Val(TxtGaji.Text) * 0.3
                            End If
                            If Me.RadB.Checked = True Then
                                If TxtLamaKerja.Text > 25 Then
                                    LblBonus.Text = Val(TxtGaji.Text) * 0.35
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
        LblTotalGaji.Text = Val(TxtGaji.Text) + Val(LblBonus.Text)

    End Sub

    Private Sub BtnKosong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKosong.Click
        TxtGaji.Clear()
        TxtLamaKerja.Clear()
        LblBonus.Text = ""
        LblTotalGaji.Text = ""
        Me.RadA.Checked = False
        Me.RadB.Checked = False
        TxtGaji.Focus()

    End Sub

    Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
        Me.Close()
    End Sub
End

Tidak ada komentar:

Posting Komentar

Berkomentarlah yang baik..