Public Class Form1
Private Sub Masuk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Masuk.Click
If Nama.Text = "Mawarni Siregar" And Password.Text = "456789" Then
formmenu.Show()
Me.Hide()
Else
MsgBox("Maaf! Password salah!")
Nama.Text = ""
Password.Text = ""
End If
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
Private Sub Password_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Password.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
Masuk_Click(sender, e)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class formmenu
Private Sub DataPenggajianToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataPenggajianToolStripMenuItem.Click
penggajian.show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub DanaMasukToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DanaMasukToolStripMenuItem.Click
End Sub
End Class
Public Class penggajian
Private Sub pegawai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
nip.Items.Add("00007")
nip.Items.Add("00231")
nip.Items.Add("98765")
jabatan.Items.Add("Staf")
jabatan.Items.Add("Mandor")
jabatan.Items.Add("Kepala Bagian")
status.Items.Add("Belum Menikah")
status.Items.Add("Menikah")
lembur.Items.Add("Tidak")
lembur.Items.Add("Ya")
nip.Focus()
Call buattabel()
End Sub
Private Sub nip_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nip.SelectedIndexChanged
If nip.Text = "00007" Then
nama.Text = "Saprol"
ElseIf nip.Text = "00231" Then
nama.Text = "Sweet Cat"
ElseIf nip.Text = "98765" Then
nama.Text = "asri"
End If
End Sub
Private Sub jabatan_SelectedIndexChaenged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jabatan.SelectedIndexChanged
If jabatan.Text = "Staf" Then
gaji.Text = 1250000
ElseIf jabatan.Text = "Mandor" Then
gaji.Text = 1750000
ElseIf jabatan.Text = "Kepala Bagian" Then
gaji.Text = 2500000
End If
End Sub
Private Sub status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles status.SelectedIndexChanged
If status.Text = "Menikah" Then
tjgistri.Text = gaji.Text * 9 / 100
jlhanak.Enabled = True
ElseIf status.Text = "Belum Menikah" Then
tjgistri.Text = 0
jlhanak.Enabled = False
pajak.Text = gaji.Text * 1.5 / 100
total.Text = Val(gaji.Text) + Val(tjganak.Text) + Val(tjgistri.Text) + Val(gjlmbr.Text) - Val(pajak.Text)
End If
End Sub
Private Sub jlhanak_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jlhanak.TextChanged
If jlhanak.Text <> "" Then
If jlhanak.Text = 0 Then
tjganak.Text = 0
ElseIf jlhanak.Text = 1 Then
tjganak.Text = gaji.Text * 3 / 100
ElseIf jlhanak.Text >= 2 Then
tjganak.Text = gaji.Text * 7 / 100
End If
End If
pajak.Text = gaji.Text * 1.5 / 100
total.Text = Val(gaji.Text) + Val(tjganak.Text) + Val(tjgistri.Text) + Val(gjlmbr.Text) - Val(pajak.Text)
End Sub
Sub buattabel()
ListView1.Columns.Add("N.I.P", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Nama", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("jabatan", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Status", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Jumlah Anak", 80, HorizontalAlignment.Left)
ListView1.Columns.Add("Gaji", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Gaji Lembur", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Tunjangan Anak", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Tunjangan Keluarga", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Pajak", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Total Gaji", 100, HorizontalAlignment.Left)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.FullRowSelect = True
End Sub
Sub isitabel()
Dim isi As New ListViewItem
isi.Text = nip.Text
isi.SubItems.Add(nama.Text)
isi.SubItems.Add(jabatan.Text)
isi.SubItems.Add(status.Text)
isi.SubItems.Add(jlhanak.Text)
isi.SubItems.Add(gaji.Text)
isi.SubItems.Add(gjlmbr.Text)
isi.SubItems.Add(tjganak.Text)
isi.SubItems.Add(tjgistri.Text)
isi.SubItems.Add(pajak.Text)
isi.SubItems.Add(total.Text)
ListView1.Items.Add(isi)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call isitabel()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
nip.Text = ""
nama.Text = ""
jabatan.Text = ""
status.Text = ""
jlhanak.Text = ""
gaji.Text = ""
tjganak.Text = ""
tjgistri.Text = ""
pajak.Text = ""
total.Text = ""
lembur.Text = ""
jmljam.Text = 0
perjam.Text = ""
gjlmbr.Text = ""
jmljam.Enabled = False
perjam.Enabled = False
gjlmbr.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
nip.Text = ""
nama.Text = ""
jabatan.Text = ""
status.Text = ""
jlhanak.Text = ""
gaji.Text = ""
tjganak.Text = ""
tjgistri.Text = ""
pajak.Text = ""
total.Text = ""
lembur.Text = ""
jmljam.Text = 0
perjam.Text = ""
gjlmbr.Text = ""
jmljam.Enabled = False
perjam.Enabled = False
gjlmbr.Enabled = False
ListView1.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ListView1.Items.Remove(ListView1.SelectedItems(0))
End Sub
Private Sub lembur_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lembur.SelectedIndexChanged
If lembur.Text = "Ya" Then
jmljam.Enabled = True
perjam.Enabled = True
gjlmbr.Enabled = True
If jabatan.Text = "Staf" Then
If perjam.Text = "" Then
perjam.Text = 5000
End If
ElseIf jabatan.Text = "Mandor" Then
If perjam.Text = "" Then
perjam.Text = 7500
End If
ElseIf jabatan.Text = "Kepala Bagian" Then
If perjam.Text = "" Then
perjam.Text = 10000
End If
End If
End If
If lembur.Text = "Tidak" Then
gjlmbr.Text = 0
jmljam.Text = 0
jmljam.Enabled = False
perjam.Enabled = False
gjlmbr.Enabled = False
If jabatan.Text = "Staf" Then
If perjam.Text <> 0 Then
perjam.Text = ""
End If
ElseIf jabatan.Text = "Mandor" Then
If perjam.Text <> 0 Then
perjam.Text = ""
End If
ElseIf jabatan.Text = "Kepala Bagian" Then
If perjam.Text <> 0 Then
perjam.Text = ""
End If
End If
End If
End Sub
Private Sub jmljam_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jmljam.TextChanged
gjlmbr.Text = perjam.Text * jmljam.Text
End Sub
End Class