Senin, 06 Mei 2013

Sistem Informasi Penggajian Karyawan

Sistem Informasi Penggajian Karyawan


FROM MENU UTAMA

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 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

    Private Sub KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


FORM 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 DataSet
    Dim SQL As String
    Public Sub OPENDB()
        Dim LOKASI = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=C:\kiki\DATABASE3.mdb"
        DB = New OleDbConnection(LOKASI)
        If DB.State = ConnectionState.Closed Then
            DB.Open()
        End If
    End Sub
    Sub Recordkaryawan()
        ADP = New OleDbDataAdapter("SELECT*FROM karyawan", DB)
        DS = New DataSet
        ADP.Fill(DS, "karyawan")
        DataGridView1.DataSource = DS.Tables("karyawan")
    End Sub
    Sub BARU()
        Button1.Enabled = True
        Button2.Enabled = False
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
        Button6.Enabled = True
    End Sub
    Sub EDIT()
        Button1.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = True
        Button4.Enabled = True
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub SIMPAN()
        Button1.Enabled = False
        Button2.Enabled = True
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub Hapustext()
        nik.Text = ""
        nama.Text = ""
        Call BARU()
    End Sub
    Private Sub karyawan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call OPENDB()
        Call Hapustext()
        Call Recordkaryawan()
        jenis_kelamin.Items.Add("WANITA")
        jenis_kelamin.Items.Add("LAKI-LAKI")

    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(2)
                bagian.Text = DR.Item(4)
                Call EDIT()
                MsgBox("Data ditemukan!")
            Else
                xkode = nik.Text
                Call Hapustext()
                nik.Text = xkode
                Call SIMPAN()
            End If
            nama.Focus()

        End If
    End Sub

    Private Sub nik_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nik.TextChanged

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call Hapustext()
        nik.Focus()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Call Hapustext()
        nik.Focus()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.Close()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        SQL = "DELETE FROM karyawan where nik='" & nik.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordkaryawan()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SQL = "insert into karyawan (NIK, Nama, Jenis_Kelamin, Bagian)" & _
        " values ('" & nik.Text & "','" & _
                       nama.Text & "','" & _
                       jenis_kelamin.Text & "','" & _
                       bagian.Text & "')"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordkaryawan()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SQL = "UPDATE karyawan SET nama='" & nama.Text & "'," & _
                        "jenis_kelamin ='" & jenis_kelamin.Text & "'," & _
                        "bagian='" & bagian.Text & "' " & _
                        "where nik='" & nik.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordkaryawan()
    End Sub
End Class



FROM 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 DataSet
    Dim SQL As String
    Public Sub OPENDB()
        Dim LOKASI = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=C:\kiki\DATABASE3.mdb"
        DB = New OleDbConnection(LOKASI)
        If DB.State = ConnectionState.Closed Then
            DB.Open()
        End If
    End Sub
    Sub Recordbagian()
        ADP = New OleDbDataAdapter("SELECT*FROM bagian", DB)
        DS = New DataSet
        ADP.Fill(DS, "bagian")
        DataGridView1.DataSource = DS.Tables("bagian")
    End Sub
    Sub BARU()
        Button1.Enabled = True
        Button2.Enabled = False
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
        Button6.Enabled = True
    End Sub
    Sub EDIT()
        Button1.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = True
        Button4.Enabled = True
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub SIMPAN()
        Button1.Enabled = False
        Button2.Enabled = True
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub Hapustext()
        TextBox1.Text = ""
        TextBox2.Text = ""
        Call BARU()
    End Sub
    Private Sub bagian_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call OPENDB()
        Call Hapustext()
        Call Recordbagian()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.Close()
    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        Dim xkode As String
        If tombol = 13 Then
            SQL = "SELECT * FROM bagian where kdbagian='" & TextBox1.Text & "'"
            CMD = New OleDbCommand(SQL, DB)
            DR = CMD.ExecuteReader
            DR.Read()
            If DR.HasRows = True Then
                TextBox2.Text = DR.Item(2)
                Call EDIT()
                MsgBox("Data ditemukan!")
            Else
                xkode = TextBox1.Text
                Call Hapustext()
                TextBox1.Text = xkode
                Call SIMPAN()
            End If
            TextBox2.Focus()

        End If
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Call Hapustext()
        TextBox1.Focus()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call Hapustext()
        TextBox1.Focus()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        SQL = "DELETE FROM bagian where kdbagian='" & TextBox1.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordbagian()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SQL = "insert into bagian (kdbagian, Nmbagian)" & _
" values ('" & TextBox1.Text & "','" & _
               TextBox2.Text & "')"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordbagian()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SQL = "UPDATE bagian SET nmbagian='" & TextBox2.Text & "' " & _
                "where kdbagian='" & TextBox1.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordbagian()
    End Sub
End Class


EROM 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 DataSet
    Dim SQL As String
    Public Sub OPENDB()
        Dim LOKASI = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=C:\kiki\DATABASE3.mdb"
        DB = New OleDbConnection(LOKASI)
        If DB.State = ConnectionState.Closed Then
            DB.Open()
        End If
    End Sub
    Sub Recordjabatan()
        ADP = New OleDbDataAdapter("SELECT*FROM jabatan", DB)
        DS = New DataSet
        ADP.Fill(DS, "jabatan")
        DataGridView1.DataSource = DS.Tables("jabatan")
    End Sub
    Sub BARU()
        Button1.Enabled = True
        Button2.Enabled = False
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
        Button6.Enabled = True
    End Sub
    Sub EDIT()
        Button1.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = True
        Button4.Enabled = True
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub SIMPAN()
        Button1.Enabled = False
        Button2.Enabled = True
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = True
        Button6.Enabled = False
    End Sub
    Sub Hapustext()
        TextBox1.Text = ""
        TextBox2.Text = ""
        Call BARU()
    End Sub
    Private Sub bagian_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call OPENDB()
        Call Hapustext()
        Call Recordjabatan()
    End Sub
    Private Sub jabatan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call Hapustext()
        TextBox1.Focus()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Call Hapustext()
        TextBox1.Focus()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.Close()
    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        Dim xkode As String
        If tombol = 13 Then
            SQL = "SELECT * FROM jabatan where kdjabatan='" & TextBox1.Text & "'"
            CMD = New OleDbCommand(SQL, DB)
            DR = CMD.ExecuteReader
            DR.Read()
            If DR.HasRows = True Then
                TextBox2.Text = DR.Item(2)
                Call EDIT()
                MsgBox("Data ditemukan!")
            Else
                xkode = TextBox1.Text
                Call Hapustext()
                TextBox1.Text = xkode
                Call SIMPAN()
            End If
            TextBox2.Focus()

        End If
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SQL = "insert into jabatan (kdjabatan, Nmjabatan)" & _
" values ('" & TextBox1.Text & "','" & _
       TextBox2.Text & "')"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordjabatan()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SQL = "UPDATE jabatan SET nmjabatan='" & TextBox2.Text & "' " & _
                "where kdjabatan='" & TextBox1.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordjabatan()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        SQL = "DELETE FROM jabatan where kdjabatan='" & TextBox1.Text & "'"
        CMD = New OleDbCommand(SQL, DB)
        CMD.ExecuteNonQuery()
        Call Button1_Click(sender, e)
        Call Recordjabatan()
    End Sub
End Class




DATABASE KARYAWAN DARI ACCESS

TABEL KARYAWAN
NIK
Nama
Jenis_Kelamin
Bagian

2
Heri
LAKI-LAKI
Mandor

5
kichy
WANITA
Kepala keuangan

6
MESRAN
LAKI-LAKI
Kepala yayasan

7
MESRAN
LAKI-LAKI
Kepala bagian






TABEL BAGIAN



ID
KdBagian
nmBagian
1
 b001
Kiki
2
 b002
HRD
3
 b003
Security
6
 b005
Ob
8
 9000
mesran











TABEL JABATAN


ID
kdJabatan
nmJabatan
1
j001
Fsdf
2
j002
Wakil Kepala
3
 j003
Staf
6
 j004
Mesran
5
 j005






Tidak ada komentar:

Poskan Komentar