Selasa, 13 April 2010

PROGRAM CLASS





Public Class Class_payroll

Private payroll As Integer

Public Function total(ByVal gaji As Integer, ByVal istri As Integer, ByVal jabatan As Integer)

Dim jumlah As Integer

jumlah = gaji + istri + jabatan

total = jumlah

End Function

Public Function pph(ByVal salary As Integer)

Dim pajak As Integer

If salary >= 1000000 Then

pajak = 0.03 * salary

Else

pajak = 0

End If

pph = pajak

End Function

Public Function net_salary(ByVal gaji As Integer, ByVal pajak As Integer)

Dim gaji_bersih As Integer

gaji_bersih = gaji - pajak

net_salary = gaji_bersih

End Function

Public Property gaji_pegawai() As Integer

Get

gaji_pegawai = payroll

End Get

Set(ByVal value As Integer)

payroll = value

End Set

End Property

End Class

Public Class Form_payroll

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.CenterToScreen()

Dim a As Integer

For a = 1 To 5

ComboBox1.Items.Add(a)

Next

TextBox4.TextAlign = HorizontalAlignment.Center

TextBox5.TextAlign = HorizontalAlignment.Center

TextBox6.TextAlign = HorizontalAlignment.Center

TextBox7.TextAlign = HorizontalAlignment.Center

TextBox8.TextAlign = HorizontalAlignment.Center

TextBox9.TextAlign = HorizontalAlignment.Center

mulai.Focus()

mulai.Focus()

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

Select Case ComboBox1.Text

Case Is = "1"

TextBox3.Text = "Manager"

TextBox4.Text = 20000000

Case Is = "2"

TextBox3.Text = "Supervisor"

TextBox4.Text = 15000000

Case Is = "3"

TextBox3.Text = "Staff"

TextBox4.Text = 10000000

Case Is = "4"

TextBox3.Text = "Ass. Staff"

TextBox4.Text = 7500000

Case Is = "5"

TextBox3.Text = "Junior Staff"

TextBox4.Text = 5000000

End Select

Select Case ComboBox1.Text

Case Is = "1"

TextBox6.Text = 0.15 * TextBox4.Text

Case Is = "2"

TextBox6.Text = 0.15 * TextBox4.Text

Case Is = "3"

TextBox6.Text = 0.05 * TextBox4.Text

Case Is = "4"

TextBox6.Text = 0.05 * TextBox4.Text

Case Else

TextBox6.Text = 0

End Select

End Sub

Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged

If ComboBox2.Text = "Menikah" And ComboBox3.Text = "Laki-laki" Then

TextBox5.Text = 0.1 * TextBox4.Text

Else : TextBox5.Text = 0

End If

Dim total_gaji As Integer

Dim objek As New Class_payroll

total_gaji = objek.total(TextBox4.Text, TextBox5.Text, TextBox6.Text)

TextBox7.Text = total_gaji

Dim pajak As Integer

Dim salary As New Class_payroll

pajak = salary.pph(TextBox7.Text)

TextBox8.Text = pajak

Dim gaji_bersih As Integer

Dim income As New Class_payroll

gaji_bersih = income.net_salary(TextBox7.Text, TextBox8.Text)

TextBox9.Text = gaji_bersih

TextBox4.ReadOnly = True

TextBox5.ReadOnly = True

TextBox6.ReadOnly = True

TextBox7.ReadOnly = True

TextBox8.ReadOnly = True

TextBox9.ReadOnly = True

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mulai.Click

TextBox1.Focus()

TextBox1.Enabled = True

TextBox2.Enabled = True

TextBox3.Enabled = True

TextBox4.Enabled = True

TextBox5.Enabled = True

TextBox6.Enabled = True

TextBox7.Enabled = True

TextBox8.Enabled = True

TextBox9.Enabled = True

ComboBox1.Enabled = True

ComboBox2.Enabled = True

ComboBox3.Enabled = True

TextBox1.Focus()

End Sub

Private Sub reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reset.Click

TextBox1.Focus()

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

TextBox5.Text = ""

TextBox6.Text = ""

TextBox7.Text = ""

TextBox8.Text = ""

TextBox9.Text = ""

ComboBox1.Text = ""

ComboBox2.Text = ""

ComboBox3.Text = ""

TextBox4.ReadOnly = False

TextBox5.ReadOnly = False

TextBox6.ReadOnly = False

TextBox7.ReadOnly = False

TextBox8.ReadOnly = False

TextBox9.ReadOnly = False

End Sub

Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click

Dim x As Integer

x = MsgBox("Apakah anda ingin keluar?", MsgBoxStyle.OkCancel, "EXIT")

If x = vbOK Then

MsgBox("Terima kasih telah menggunakan program kami...", MsgBoxStyle.MsgBoxRight, "Informasi")

End

End If

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Label13.Text = My.Computer.Clock.LocalTime.ToLongDateString

Label14.Text = My.Computer.Clock.LocalTime.ToLongTimeString

End Sub

End Class


Tidak ada komentar:

Posting Komentar