Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Nama.Focus()
Jabatan.Items.Add("Mandor")
Jabatan.Items.Add("Kepala Bagian")
Jabatan.Items.Add("Staf")
Status.Items.Add("Menikah")
Status.Items.Add("Belum Menikah")
Call buattabel()
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
Pajak.Text = 0.015 * Val(Gaji.Text)
Case "Staf"
Gaji.Text = 1250000
Pajak.Text = 0.015 * Val(Gaji.Text)
Case "Kepala Bagian"
Gaji.Text = 2500000
Pajak.Text = 0.015 * Val(Gaji.Text)
End Select
Status.Focus()
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
Dim y As String
y = Status.Text = "Menikah"
If Jabatan.Text = "Mandor" Then
Tunjangan.Text = 0.09 * 1750000
ElseIf Jabatan.Text = "Staf" Then
Tunjangan.Text = 0.09 * 1250000
ElseIf Jabatan.Text = "Kepala Bagian" Then
Tunjangan.Text = 0.09 * 2500000
End If
If Status.Text = "Belum Menikah" Then
Tunjangan.Text = 0
End If
Jumlah.Focus()
End Sub
Private Sub jumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah.TextChanged
If Jumlah.Text = "1" Then
Tunjangan_anak.Text = 0.03 * Val(Gaji.Text)
ElseIf Jumlah.Text = "2" Then
Tunjangan_anak.Text = 0.07 * Val(Gaji.Text)
Else
Tunjangan_anak.Text = 0.07 * Val(Gaji.Text)
End If
End Sub
Private Sub jam_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jam.TextChanged
If Jabatan.Text = "Mandor" Then
Upah.Text = 7500 * Val(Jam.Text)
ElseIf Jabatan.Text = "Staf" Then
Upah.Text = 5000 * Val(Jam.Text)
ElseIf Jabatan.Text = "Kepala Bagian" Then
Upah.Text = 10000 * Val(Jam.Text)
End If
End Sub
Private Sub btnhitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhitung.Click
Total.Text = Val(Gaji.Text) + Val(Tunjangan.Text) + Val(Tunjangan_anak.Text) + Val(Upah.Text) - Val(Pajak.Text)
End Sub
Sub buattabel()
LV.Columns.Add("Nama", 100, HorizontalAlignment.Center)
LV.Columns.Add("Jabatan", 100, HorizontalAlignment.Center)
LV.Columns.Add("Status", 100, HorizontalAlignment.Center)
LV.Columns.Add("Gaji Pokok", 100, HorizontalAlignment.Right)
LV.Columns.Add("Tunjangan Istri", 120, HorizontalAlignment.Right)
LV.Columns.Add("Jumlah Anak", 100, HorizontalAlignment.Center)
LV.Columns.Add("Tunjangan anak", 120, HorizontalAlignment.Right)
LV.Columns.Add("Pajak", 100, HorizontalAlignment.Right)
LV.Columns.Add("Jam Lembur", 100, HorizontalAlignment.Center)
LV.Columns.Add("Upah Lembur", 100, HorizontalAlignment.Right)
LV.Columns.Add("Total Gaji", 100, HorizontalAlignment.Center)
LV.View = View.Details
LV.FullRowSelect = True
LV.GridLines = True
End Sub
Sub isitabel()
Dim lst As New ListViewItem
lst.Text = nama.Text
lst.SubItems.Add(Jabatan.Text)
lst.SubItems.Add(Status.Text)
lst.SubItems.Add(Gaji.Text)
lst.SubItems.Add(Tunjangan.Text)
lst.SubItems.Add(Jumlah.Text)
lst.SubItems.Add(Tunjangan_anak.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(jam.Text)
lst.SubItems.Add(Upah.Text)
lst.SubItems.Add(Total.Text)
LV.Items.Add(lst)
End Sub
Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbersih.Click
Nama.Text = ""
Jabatan.Text = ""
Status.Text = ""
Gaji.Text = ""
Tunjangan.Text = ""
Jumlah.Text = ""
Tunjangan_anak.Text = ""
Pajak.Text = ""
Jam.Text = ""
Upah.Text = ""
Total.Text = ""
Nama.Focus()
End Sub
Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
Call isitabel()
Nama.Text = ""
Jabatan.Text = ""
Status.Text = ""
Gaji.Text = ""
Tunjangan.Text = ""
Jumlah.Text = ""
Tunjangan_anak.Text = ""
Pajak.Text = ""
Jam.Text = ""
Upah.Text = ""
Total.Text = ""
Nama.Focus()
End Sub
Private Sub btnhapus_semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus_semua.Click
LV.Items.Clear()
End Sub
Private Sub btnhapus_data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus_data.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
Dim x As String
x = MsgBox("Anda Yakin Ingin Keluar", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Keluar")
If x = vbYes Then
Close()
End If
End Sub
End Class
Harusnya link kasusnya dibuat ke kasus yang saya berikan seperti ini kasusnya
BalasHapusbukan ke link jawaban