Public Class Form1
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
If password.Text = "1002266" Then
Menu_utama.Show()
Me.Hide()
Else
MsgBox("Maaf Password anda masih salah !!!")
End If
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
MsgBox("Anda yakin ingin keluar")
End
End Sub
End Class
hasil formnya :
Public Class Menu_utama
Private Sub KeluarProgramToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarProgramToolStripMenuItem.Click
MsgBox("Anda yakin ingin keluar dari program ini!")
End
End Sub
Private Sub DataGajiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGajiToolStripMenuItem.Click
data.Show()
Me.Hide()
End Sub
End Class
Hasil formnya:
Listing:
Public Class data
Private Sub data_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
jabatan.Items.Add("Staff")
status.Items.Add("Menikah")
status.Items.Add("Belum Menikah")
buat_tabel()
End Sub
Sub proses()
If jabatan.Text = "Mandor" Then
gaji.Text = "1750000"
pajak.Text = 0.015 * Val(gaji.Text)
ElseIf jabatan.Text = "Kepala Bagian" Then
gaji.Text = "2500000"
pajak.Text = 0.015 * Val(gaji.Text)
ElseIf jabatan.Text = "Staff" Then
gaji.Text = "1250000"
pajak.Text = 0.015 * Val(gaji.Text)
End If
Select Case status.Text
Case "Menikah" : tunistri.Text = 0.09 * Val(gaji.Text)
Case "Belum Menikah" : tunistri.Text = 0
End Select
If anak.Text = "1" Then
tunanak.Text = 0.03 * Val(gaji.Text)
ElseIf anak.Text = "2" Then
tunanak.Text = 0.07 * Val(gaji.Text)
ElseIf anak.Text >= "2" Then
tunanak.Text = 0.07 * Val(gaji.Text)
ElseIf anak.Text <= "1" Then
tunanak.Text = 0
End If
If jabatan.Text = "Mandor" Then
If lembur.Text = "0" Then
totlem.Text = 0
ElseIf lembur.Text = "1" Then
totlem.Text = 7500
ElseIf lembur.Text >= "1" Then
totlem.Text = 7500 * Val(lembur.Text)
End If
ElseIf jabatan.Text = "Kepala Bagian" Then
If lembur.Text = "0" Then
totlem.Text = 0
ElseIf lembur.Text = "1" Then
totlem.Text = 10000
ElseIf lembur.Text >= "1" Then
totlem.Text = 10000 * Val(lembur.Text)
End If
ElseIf jabatan.Text = "Staff" Then
If lembur.Text = "0" Then
totlem.Text = 0
ElseIf lembur.Text = "1" Then
totlem.Text = 5000
ElseIf lembur.Text >= "1" Then
totlem.Text = 5000 * Val(lembur.Text)
End If
End If
tgaji.Text = Val(gaji.Text) + Val(tunistri.Text) + Val(tunanak.Text) + Val(totlem.Text) - Val(pajak.Text)
End Sub
Sub buat_tabel()
With LV
.Columns.Add("Nama ", 110, HorizontalAlignment.Left)
.Columns.Add("Jabatan", 90, HorizontalAlignment.Left)
.Columns.Add("Gaji", 80, HorizontalAlignment.Center)
.Columns.Add("Status", 100, HorizontalAlignment.Left)
.Columns.Add("Tunjangan Istri", 98, HorizontalAlignment.Center)
.Columns.Add("Anak", 40, HorizontalAlignment.Center)
.Columns.Add("Tunjangan Anak", 98, HorizontalAlignment.Center)
.Columns.Add("Pajak", 55, HorizontalAlignment.Center)
.Columns.Add("Lembur", 50, HorizontalAlignment.Center)
.Columns.Add("Gaji Lembur/jam", 100, HorizontalAlignment.Center)
.Columns.Add("Total Gaji", 90, HorizontalAlignment.Center)
.View = View.Details
.GridLines = True
.FullRowSelect = True
End With
End Sub
Sub isi_tabel()
Dim lst As New ListViewItem
lst.Text = nama.Text
lst.SubItems.Add(jabatan.Text)
lst.SubItems.Add(gaji.Text)
lst.SubItems.Add(status.Text)
lst.SubItems.Add(tunistri.Text)
lst.SubItems.Add(anak.Text)
lst.SubItems.Add(tunanak.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(lembur.Text)
lst.SubItems.Add(totlem.Text)
lst.SubItems.Add(tgaji.Text)
LV.Items.Add(lst)
End Sub
Private Sub jabatan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
Call proses()
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
Call proses()
End Sub
Private Sub lembur_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lembur.TextChanged
Call proses()
End Sub
Private Sub anak_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles anak.TextChanged
Call proses()
End Sub
Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
isi_tabel()
End Sub
Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
tunistri.Text = ""
anak.Text = ""
tunanak.Text = ""
pajak.Text = ""
lembur.Text = ""
totlem.Text = ""
tgaji.Text = ""
nama.Focus()
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 btnpilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpilih.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
MsgBox("Terima Kasih telah melakukan penginputan")
Menu_utama.Show()
End Sub
End Class
Hasil formnya:
Tidak ada komentar:
Posting Komentar