Menghitung Penggajian Pegawai
Microsoft Visual Basic 2008
Designya sebagai dan hasilnya adalah sebagai berikut :Yang di gunakan dalam design program Penggajian Pegawai ini adalah :
- Label
- Text box
- Combo Box, dan
- Button
PublicClass
Form1
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) HandlesMyBase.Load
nik.Items.Add("PM010")
nik.Items.Add("PS111")
nik.Items.Add("KU101")
nik.Items.Add("GD100")
nik.Items.Add("PM011")
jabatan.Items.Add("Kepala Divisi")
jabatan.Items.Add("Staff")
jabatan.Items.Add("Wakil Kepala")
status.Items.Add("Menikah")
status.Items.Add("Tidak Menikah")
Dim d AsInteger
For d
= 0 To 10
j_anak.Items.Add(d)
Next
EndSub
PrivateSub nik_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
nik.SelectedIndexChanged
Dim n AsString
n =
Microsoft.VisualBasic.Left(nik.Text, 2)
If n
= "PM"Then
bagian.Text
= "Pemasokan"
nama.Text =
"Suhairy Tri Yadhi"
ElseIf n = "PS"Then
bagian.Text
= "Personalia"
nama.Text =
"Robby Azhari Harahap"
ElseIf n = "KU"Then
bagian.Text
= "Keuangan"
nama.Text =
"Lukman Wijaya"
Else
bagian.Text
= "Gudang"
nama.Text =
"Anto"
EndIf
EndSub
PrivateSub jabatan_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles jabatan.SelectedIndexChanged
If
jabatan.Text = "Kepala Divisi"Then
gapok.Text
= "5000000"
pajak.Text
= 0.1 * gapok.Text
ElseIf jabatan.Text = "Staff"Then
gapok.Text
= "2000000"
pajak.Text
= 0.1 * gapok.Text
Else
gapok.Text
= "3500000"
pajak.Text
= 0.1 * gapok.Text
EndIf
EndSub
PrivateSub status_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
status.SelectedIndexChanged
If
status.Text = "Menikah"Then
tunj_kel.Text = 0.15 * gapok.Text
Else
tunj_kel.Text = 0
EndIf
EndSub
PrivateSub ja_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
j_anak.SelectedIndexChanged
If
j_anak.Text = "1"Then
tunj_anak.Text = 0.05 * gapok.Text
ElseIf j_anak.Text = "2"Then
tunj_anak.Text = 0.1 * gapok.Text
Else
tunj_anak.Text = 0
EndIf
total_gaji.Text
= Val(gapok.Text) + Val(tunj_kel.Text) + Val(tunj_anak.Text) - Val(pajak.Text)
EndSub
PrivateSub Buttonhapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Buttonhapus.Click
nik.Text = ""
nama.Text = ""
bagian.Text = ""
jabatan.Text = ""
gapok.Text = ""
pajak.Text = ""
status.Text = ""
j_anak.Text = ""
tunj_kel.Text =
""
tunj_anak.Text
= ""
total_gaji.Text
= ""
EndSub
PrivateSub Buttonkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Buttonkeluar.Click
Dim
tanya AsString
tanya = MsgBox("Apakah Anda Yakin Mau Keluar",
MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If
tanya = vbYes Then
Me.Close()
Else
ExitSub
EndIf
EndSub
Sumber : Belajar Bahasa Program
Terima Kasih Telah Mengunjungi Blog saya dan Berkomentar dengan Sopan :)