Sistem informasi penggajian karyawan

Standar

BELAJAR BAHASA PEMROGRAMAN

Design from menu

Image

listing program

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 FILEToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FILEToolStripMenuItem.Click

    End Sub

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

    End Sub

End Class

design menu karyawan

Image

listing program

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:\VB6\DATABASE141.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 butoonbaru()

        Button1.Enabled = True

        Button2.Enabled = False

        Button3.Enabled = False

        Button4.Enabled = False

        Button5.Enabled = False

        Button6.Enabled = True

    End Sub

    Sub butoonedit()

        Button1.Enabled = False

        Button2.Enabled = False

        Button3.Enabled = True

        Button4.Enabled = True

        Button5.Enabled = True

        Button6.Enabled = False

    End Sub

    Sub butoonsimpan()

        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 butoonbaru()

    End Sub

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

        Call OPENDB()

        Call RecordKARYAWAN()

        Call hapustext()

        ComboBox1.Items.Add(“JENIS KELAMIN”)

    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 KARYAWAN Where NIK='” & TextBox1.Text & “‘”

            CMD = New OleDbCommand(SQL, DB)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows = True Then

                TextBox2.Text = DR.Item(2)

                TextBox3.Text = DR.Item(3)

                TextBox4.Text = DR.Item(5)

                Call butoonedit()

                MsgBox(“DATA DITEMUKAN!”)

            Else

                xkode = TextBox1.Text

                Call hapustext()

                TextBox1.Text = xkode

                Call butoonsimpan()

            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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        SQL = “INSERT INTO KARYAWAN (NIK, NAMA, JABATAN, J_KELAMIN, BAGIAN)” & _

                “Values (‘” & TextBox1.Text & “‘,'” & _

                                TextBox2.Text & “‘,'” & _

                                TextBox3.Text & “‘,'” & _

                                ComboBox1.Text & “‘,'” & _

                                TextBox4.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='” & TextBox2.Text & “‘,” & _

                                “JABATAN='” & TextBox3.Text & “‘,” & _

                                “J_KELAMIN='” & ComboBox1.Text & “‘,” & _

                                “BAGIAN='” & TextBox4.Text & “‘ ” & _

                                “Where NIK='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordKARYAWAN()

        Call hapustext()

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        If ComboBox1.Text = “JENIS KELAMIN” Then

            ComboBox1.Items.Add(“LAKI-LAKI”)

            ComboBox1.Items.Add(“PEREMPUAN”)

            ComboBox1.Items.Add(“WARIA”)

        End If

    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='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordKARYAWAN()

    End Sub

End Class

design menu bagian

Image

listing program

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:\VB6\DATABASE141.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 butoonbaru()

        Button1.Enabled = True

        Button2.Enabled = False

        Button3.Enabled = False

        Button4.Enabled = False

        Button5.Enabled = False

        Button6.Enabled = True

    End Sub

    Sub butoonedit()

        Button1.Enabled = False

        Button2.Enabled = False

        Button3.Enabled = True

        Button4.Enabled = True

        Button5.Enabled = True

        Button6.Enabled = False

    End Sub

    Sub butoonsimpan()

        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 butoonbaru()

    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 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 KD_BAGIAN='” & TextBox1.Text & “‘”

            CMD = New OleDbCommand(SQL, DB)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows = True Then

                TextBox2.Text = DR.Item(2)

                Call butoonedit()

                MsgBox(“DATA DITEMUKAN!”)

            Else

                xkode = TextBox1.Text

                Call hapustext()

                TextBox1.Text = xkode

                Call butoonsimpan()

            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 Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        SQL = “UPDATE BAGIAN SET NN_BAGIAN='” & TextBox2.Text & “‘ ” & _

                        “Where KD_BAGIAN ='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        SQL = “INSERT INTO BAGIAN (KD_BAGIAN, NN_BAGIAN)” & _

                “Values (‘” & TextBox1.Text & “‘,'” & _

                                TextBox2.Text & “‘)”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        SQL = “DELETE FROM BAGIAN Where KD_BAGIAN='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    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

End Class

Design menu jabatan

Image

Listing program

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:\VB6\DATABASE141.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 butoonbaru()

        Button1.Enabled = True

        Button2.Enabled = False

        Button3.Enabled = False

        Button4.Enabled = False

        Button5.Enabled = False

        Button6.Enabled = True

    End Sub

    Sub butoonedit()

        Button1.Enabled = False

        Button2.Enabled = False

        Button3.Enabled = True

        Button4.Enabled = True

        Button5.Enabled = True

        Button6.Enabled = False

    End Sub

    Sub butoonsimpan()

        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 butoonbaru()

    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 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 KD_BAGIAN='” & TextBox1.Text & “‘”

            CMD = New OleDbCommand(SQL, DB)

            DR = CMD.ExecuteReader

            DR.Read()

            If DR.HasRows = True Then

                TextBox2.Text = DR.Item(2)

                Call butoonedit()

                MsgBox(“DATA DITEMUKAN!”)

            Else

                xkode = TextBox1.Text

                Call hapustext()

                TextBox1.Text = xkode

                Call butoonsimpan()

            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 Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        SQL = “UPDATE BAGIAN SET NN_BAGIAN='” & TextBox2.Text & “‘ ” & _

                        “Where KD_BAGIAN ='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        SQL = “INSERT INTO BAGIAN (KD_BAGIAN, NN_BAGIAN)” & _

                “Values (‘” & TextBox1.Text & “‘,'” & _

                                TextBox2.Text & “‘)”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        SQL = “DELETE FROM BAGIAN Where KD_BAGIAN='” & TextBox1.Text & “‘”

        CMD = New OleDbCommand(SQL, DB)

        CMD.ExecuteNonQuery()

        Call Button1_Click(sender, e)

        Call RecordBAGIAN()

    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

End Class

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s