Design form seperti dibawah ini
setelah selesai mendisign ketikan perintah sesuai dengan sub sub yang ditentukan dibawah ini
Public Class Form1
Sub buatTabel()
LV.Columns.Add("NIK", 150, HorizontalAlignment.Center)
LV.Columns.Add("NAMA KARYAWAN", 150, HorizontalAlignment.Center)
LV.Columns.Add("JABATAN", 150, HorizontalAlignment.Center)
LV.Columns.Add("GAJI POKOK", 150, HorizontalAlignment.Center)
LV.Columns.Add("STATUS", 150, HorizontalAlignment.Center)
LV.Columns.Add("TUNJANGAN keluarga", 150, HorizontalAlignment.Center)
LV.Columns.Add("PAJAK", 150, HorizontalAlignment.Center)
LV.Columns.Add("TOTAL GAJI", 150, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = NIK.Text
Lst.SubItems.Add(nama.Text)
Lst.SubItems.Add(jabatan.Text)
Lst.SubItems.Add(gaji.Text)
Lst.SubItems.Add(status.Text)
Lst.SubItems.Add(istri.Text)
Lst.SubItems.Add(pajak.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
status.Items.Add("Menikah")
status.Items.Add("Tidak Menikah")
NIK.Items.Add("001")
NIK.Items.Add("002")
NIK.Items.Add("003")
NIK.Items.Add("004")
NIK.Items.Add("005")
NIK.Items.Add("006")
NIK.Items.Add("007")
NIK.Items.Add("008")
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("staff")
End Sub
Private Sub gaji_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gaji.TextChanged
pajak.Text = 0.015 * Val(gaji.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnselesai.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
total.Text = Val(gaji.Text) + Val(istri.Text) - Val(pajak.Text)
End Sub
Private Sub istri_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles istri.TextChanged
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
Select Case status.Text
Case "Menikah" : istri.Text = 0.15 * gaji.Text
Case "Tidak Menikah" : istri.Text = 0
End Select
End Sub
Private Sub NIK_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NIK.SelectedIndexChanged
If NIK.Text = "001" Then
nama.Text = "AGUS ARYA"
ElseIf NIK.Text = "002" Then
nama.Text = "AGUS KURNIAWAN"
ElseIf NIK.Text = "003" Then
nama.Text = "DAMAYANTI"
ElseIf NIK.Text = "004" Then
nama.Text = "DIANA"
ElseIf NIK.Text = "005" Then
nama.Text = "NANDA WAHYU"
ElseIf NIK.Text = "006" Then
nama.Text = "MUHAMMAD ARIFIN"
Else
nama.Text = "NUR JANNAH"
End If
End Sub
Private Sub btnsimpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpn.Click
IsiTabel()
NIK.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
istri.Text = ""
pajak.Text = ""
total.Text = ""
End Sub
Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
LV.Items.Clear()
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
Select Case jabatan.Text
Case "Mandor" : gaji.Text = 1750000
Case "Kepala Bagian" : gaji.Text = 2500000
Case " staff" : gaji.Text = 1250000
End Select
pajak.Text = 0.15 * gaji.Text
End Sub
End Class
dan hasil akhir akan muncul seperti dibawah ini
trianiarista.blogspot.com
Public Class Form1
Sub buatTabel()
LV.Columns.Add("NIK", 150, HorizontalAlignment.Center)
LV.Columns.Add("NAMA KARYAWAN", 150, HorizontalAlignment.Center)
LV.Columns.Add("JABATAN", 150, HorizontalAlignment.Center)
LV.Columns.Add("GAJI POKOK", 150, HorizontalAlignment.Center)
LV.Columns.Add("STATUS", 150, HorizontalAlignment.Center)
LV.Columns.Add("TUNJANGAN keluarga", 150, HorizontalAlignment.Center)
LV.Columns.Add("PAJAK", 150, HorizontalAlignment.Center)
LV.Columns.Add("TOTAL GAJI", 150, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = NIK.Text
Lst.SubItems.Add(nama.Text)
Lst.SubItems.Add(jabatan.Text)
Lst.SubItems.Add(gaji.Text)
Lst.SubItems.Add(status.Text)
Lst.SubItems.Add(istri.Text)
Lst.SubItems.Add(pajak.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
status.Items.Add("Menikah")
status.Items.Add("Tidak Menikah")
NIK.Items.Add("001")
NIK.Items.Add("002")
NIK.Items.Add("003")
NIK.Items.Add("004")
NIK.Items.Add("005")
NIK.Items.Add("006")
NIK.Items.Add("007")
NIK.Items.Add("008")
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("staff")
End Sub
Private Sub gaji_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gaji.TextChanged
pajak.Text = 0.015 * Val(gaji.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnselesai.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
total.Text = Val(gaji.Text) + Val(istri.Text) - Val(pajak.Text)
End Sub
Private Sub istri_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles istri.TextChanged
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
Select Case status.Text
Case "Menikah" : istri.Text = 0.15 * gaji.Text
Case "Tidak Menikah" : istri.Text = 0
End Select
End Sub
Private Sub NIK_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NIK.SelectedIndexChanged
If NIK.Text = "001" Then
nama.Text = "AGUS ARYA"
ElseIf NIK.Text = "002" Then
nama.Text = "AGUS KURNIAWAN"
ElseIf NIK.Text = "003" Then
nama.Text = "DAMAYANTI"
ElseIf NIK.Text = "004" Then
nama.Text = "DIANA"
ElseIf NIK.Text = "005" Then
nama.Text = "NANDA WAHYU"
ElseIf NIK.Text = "006" Then
nama.Text = "MUHAMMAD ARIFIN"
Else
nama.Text = "NUR JANNAH"
End If
End Sub
Private Sub btnsimpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpn.Click
IsiTabel()
NIK.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
istri.Text = ""
pajak.Text = ""
total.Text = ""
End Sub
Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
LV.Items.Clear()
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
Select Case jabatan.Text
Case "Mandor" : gaji.Text = 1750000
Case "Kepala Bagian" : gaji.Text = 2500000
Case " staff" : gaji.Text = 1250000
End Select
pajak.Text = 0.15 * gaji.Text
End Sub
End Class
dan hasil akhir akan muncul seperti dibawah ini
trianiarista.blogspot.com
0 komentar:
Posting Komentar