PROGRAM SISTEM INFO PENGGAJIAN
KARYAWAN
PROGRAM SISTEM
INFORMASI PENGGAJIAN KARYAWAN
BELAJAR BAHASA PEMPROGRAMAN
Program menggunakan M.acces memakai
MENU STRIP, ada 3 program di dalamnya diantaranya from KARYAWAN,BAGIAN dan
JABATAN..
Listing
Program FORM1
Public Class Form1
Private Sub KARYAWANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KARYAWANToolStripMenuItem.Click
KARYAWAN.Show()
End Sub
Private Sub KELUARPROGRAMToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KELUARPROGRAMToolStripMenuItem.Click
End
End Sub
Private Sub BAGIANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
BAGIANToolStripMenuItem.Click
BAGIAN.Show()
End Sub
Private Sub JABATANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
JABATANToolStripMenuItem.Click
JABATAN.Show()
End Sub
Listing
Program KARYAWAN
Imports System.Data.OleDb
Public Class KARYAWAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\vb2\KARYAWAN1.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
tampilRecordkaryawan()
ADP = New
OleDbDataAdapter("SELECT * FROM KARYAWAN",
DB)
DS = New
DataSet
ADP.Fill(DS, "KARYAWAN")
DataGridView1.DataSource = DS.Tables("KARYAWAN")
End Sub
Sub
butoonbaru()
BTNBARU.Enabled = True
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = false
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = False
BTNKELUAR.Enabled = True
End Sub
Sub
butoonedit()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = True
BTNHAPUS.Enabled = True
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
butoonsimpan()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = True
BTNEDIT.Enabled = False
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
hapustext()
NIK.Text = ""
NAMA.Text = ""
JABATAN.Text = ""
JENISKELAMIN.Text = ""
BAGIAN.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
tampilRecordkaryawan()
JENISKELAMIN.Items.Add("LAKI-LAKI")
JENISKELAMIN.Items.Add("PEREMPUAN")
End Sub
Private Sub BTNHAPUS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNHAPUS.Click
SQL = "DELETE
FROM KARYAWAN Where NIK='" & NIK.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordkaryawan()
End Sub
Private Sub BTNBARU_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBARU.Click
Call
hapustext()
NIK.Focus()
End Sub
Private Sub BTNKELUAR_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles BTNKELUAR.Click
Me.Close()
End Sub
Private Sub NIK_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
NIK.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM KARYAWAN Where NIK='" & NIK.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
NAMA.Text = DR.Item(1)
JABATAN.Text = DR.Item(2)
JENISKELAMIN.Text = DR.Item(3)
BAGIAN.Text = DR.Item(4)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = NIK.Text
Call
hapustext()
NIK.Text = xkode
Call
butoonsimpan()
End
If
NAMA.Focus()
End If
End Sub
Private Sub BTNBATAL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBATAL.Click
Call
hapustext()
NIK.Focus()
End Sub
Private Sub BTNEDIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNEDIT.Click
SQL = "UPDATE
KARYAWAN SET NAMA='" & NAMA.Text & "',"
& _
"JABATAN='" & JABATAN.Text & "'," & _
"JENISKELAMIN='" & JENISKELAMIN.Text
& "'," & _
"BAGIAN='" & BAGIAN.Text & "' " & _
"Where NIK ='" & NIK.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordkaryawan()
End Sub
Private Sub BTNSIMPAN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNSIMPAN.Click
SQL = "INSERT
INTO KARYAWAN (NIK, NAMA, JABATAN, JENISKELAMIN, BAGIAN)" & _
"Values ('" & NIK.Text & "','" & _
NAMA.Text & "','" &
_
JABATAN.Text & "','"
& _
JENISKELAMIN.Text & "','"
& _
BAGIAN.Text & "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordkaryawan()
End Sub
End Class
SISTEM INFO PENGGAJIAN KARYAWAN
(FORM BAGIAN)
PROGRAM SISTEM INFORMASI
PENGGAJIAN KARYAWAN
BELAJAR BAHASA PEMPROGRAMAN
FORM BAGIAN
Listing
Program BAGIAN
Imports
System.Data.OleDb
Public Class BAGIAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\vb2\KARYAWAN1.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
tampilRecordbagian()
ADP = New
OleDbDataAdapter("SELECT * FROM BAGIAN ",
DB)
DS = New
DataSet
ADP.Fill(DS, "BAGIAN")
DataGridView1.DataSource = DS.Tables("BAGIAN")
End Sub
Sub
butoonbaru()
BTNBARU.Enabled = True
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = False
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = False
BTNKELUAR.Enabled = True
End Sub
Sub
butoonedit()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = True
BTNHAPUS.Enabled = True
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
butoonsimpan()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = True
BTNEDIT.Enabled = False
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
hapustext()
KODEBAGIAN.Text = ""
NAMABAGIAN.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
tampilRecordbagian()
End Sub
Private Sub BTNHAPUS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNHAPUS.Click
SQL = "DELETE
FROM BAGIAN Where kdbagian='" & KODEBAGIAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordbagian()
End Sub
Private Sub BTNBARU_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBARU.Click
Call
hapustext()
KODEBAGIAN.Focus()
End Sub
Private Sub BTNKELUAR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNKELUAR.Click
Me.Close()
End Sub
Private Sub KODEBAGIAN_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
KODEBAGIAN.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM BAGIAN Where Kdbagian ='" & KODEBAGIAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
NAMABAGIAN.Text = DR.Item(1)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = KODEBAGIAN.Text
Call
hapustext()
KODEBAGIAN.Text = xkode
Call
butoonsimpan()
End
If
NAMABAGIAN.Focus()
End If
End Sub
Private Sub BTNBATAL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBATAL.Click
Call
hapustext()
NAMABAGIAN.Focus()
End Sub
Private Sub BTNEDIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNEDIT.Click
SQL = "UPDATE
BAGIAN SET NmBagian='" & NAMABAGIAN.Text & "' " & _
"Where Kdbagian ='" &
KODEBAGIAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordbagian()
End Sub
Private Sub BTNSIMPAN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNSIMPAN.Click
SQL = "INSERT
INTO BAGIAN(Kdbagian, Nmbagian)" & _
"Values ('" & KODEBAGIAN.Text & "','" & _
NAMABAGIAN.Text & "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordbagian()
End Sub
End Class
SISTEM INFO PENGGAJIAN KARYAWAN
(FORM JABATAN)
PROGRAM SISTEM INFORMASI
PENGGAJIAN KARYAWAN
BELAJAR BAHASA
PEMPROGRAMAN
FORM JABATAN
Listing
Program JABATAN
Imports System.Data.OleDb
Public Class JABATAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\vb2\KARYAWAN1.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
tampilRecordjabatan()
ADP = New
OleDbDataAdapter("SELECT * FROM JABATAN ",
DB)
DS = New
DataSet
ADP.Fill(DS, "JABATAN")
DataGridView1.DataSource = DS.Tables("JABATAN")
End Sub
Sub
butoonbaru()
BTNBARU.Enabled = True
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = False
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = False
BTNKELUAR.Enabled = True
End Sub
Sub
butoonedit()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = False
BTNEDIT.Enabled = True
BTNHAPUS.Enabled = True
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
butoonsimpan()
BTNBARU.Enabled = False
BTNSIMPAN.Enabled = True
BTNEDIT.Enabled = False
BTNHAPUS.Enabled = False
BTNBATAL.Enabled = True
BTNKELUAR.Enabled = False
End Sub
Sub
hapustext()
KDJABATAN.Text = ""
NMJABATAN.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
tampilRecordjabatan()
End Sub
Private Sub BTNHAPUS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNHAPUS.Click
SQL = "DELETE
FROM JABATAN Where KDJABATAN='" & KDJABATAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordjabatan()
End Sub
Private Sub BTNBARU_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBARU.Click
Call
hapustext()
KDJABATAN.Focus()
End Sub
Private Sub BTNKELUAR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNKELUAR.Click
Me.Close()
End Sub
Private Sub KDJABATAN_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
KDJABATAN.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM JABATAN Where KDJABATAN ='" & KDJABATAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
NMJABATAN.Text = DR.Item(1)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = KDJABATAN.Text
Call
hapustext()
KDJABATAN.Text = xkode
Call
butoonsimpan()
End
If
NMJABATAN.Focus()
End If
End Sub
Private Sub BTNBATAL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNBATAL.Click
Call
hapustext()
NMJABATAN.Focus()
End Sub
Private Sub BTNEDIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNEDIT.Click
SQL = "UPDATE
JABATAN SET NMJABATAN='" & NMJABATAN.Text & "' " & _
"Where KDJABATAN ='" &
KDJABATAN.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordjabatan()
End Sub
Private Sub BTNSIMPAN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNSIMPAN.Click
SQL = "INSERT
INTO JABATAN(KDJABATAN, NMJABATAN)" & _
"Values ('" & KDJABATAN.Text & "','" & _
NMJABATAN.Text & "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BTNBARU_Click(sender, e)
Call
tampilRecordjabatan()
End Sub
End Class