aplikasi program sistem informasi pemasukan dan ... program sistem...Title Microsoft Word - aplikasi...

27
www www www www. belajarvb belajarvb belajarvb belajarvb.net net net net Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi APLIKASI PEMASUKAN DAN PENGELUARAN KAS - VB.NET Imports System.Data.OleDb Public Class Login Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TXTnama.KeyPress If e.KeyChar = Chr(13) Then TXTPassword.Focus() End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TXTPassword.KeyPress If e.KeyChar = Chr(13) Then BTNLogin.Focus() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLogin.Click Call Koneksi() CMD = New OleDbCommand("select * from tbluser where nama_User= '" & TXTnama.Text & "' and pwd_user='" & TXTPassword.Text & "'", CONN) DR = CMD.ExecuteReader DR.Read() If DR.HasRows Then If TXTnama.Text <> DR.Item("nama_user") And TXTPassword.Text <> DR.Item("Pwd_user") Then

Transcript of aplikasi program sistem informasi pemasukan dan ... program sistem...Title Microsoft Word - aplikasi...

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    APLIKASI PEMASUKAN DAN PENGELUARAN KAS - VB.NET

    Imports System.Data.OleDb

    Public Class Login

    Private Sub TextBox1_KeyPress(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyPressEventArgs)

    Handles TXTnama.KeyPress

    If e.KeyChar = Chr(13) Then TXTPassword.Focus()

    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyPressEventArgs)

    Handles TXTPassword.KeyPress

    If e.KeyChar = Chr(13) Then BTNLogin.Focus()

    End Sub

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    BTNLogin.Click

    Call Koneksi()

    CMD = New OleDbCommand("select * from tbluser

    where nama_User= '" & TXTnama.Text & "' and pwd_user='" &

    TXTPassword.Text & "'", CONN)

    DR = CMD.ExecuteReader

    DR.Read()

    If DR.HasRows Then

    If TXTnama.Text DR.Item("nama_user") And

    TXTPassword.Text DR.Item("Pwd_user") Then

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    MsgBox("Login Gagal")

    TXTnama.Clear()

    TXTPassword.Clear()

    TXTnama.Focus()

    Exit Sub

    Else

    Me.Visible = False

    MenuUtama.Show()

    MenuUtama.Panel1.Text =

    DR.Item("Kode_user")

    MenuUtama.Panel2.Text =

    DR.Item("nama_User")

    MenuUtama.Panel3.Text =

    UCase(DR.Item("status_user"))

    If MenuUtama.Panel3.Text "ADMIN" Then

    MenuUtama.Button1.Visible = False

    MenuUtama.Button2.Visible = False

    Pemasukan.Button2.Enabled = False

    Else

    MenuUtama.Button1.Visible = True

    MenuUtama.Button2.Visible = True

    Pemasukan.Button2.Enabled = True

    End If

    End If

    CMD = New OleDbCommand("select * from

    tblprofil", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    Profil.Show()

    Exit Sub

    Else

    MenuUtama.PanelID.Text = DR.Item("id")

    End If

    Else

    MsgBox("Login Gagal")

    TXTnama.Clear()

    TXTPassword.Clear()

    TXTnama.Focus()

    End If

    End Sub

    Private Sub Button2_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    BTNKeluar.Click

    End

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    End Sub

    End Class

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Imports System.Data.OleDb

    Public Class User

    Sub Kosongkan()

    txtkodeuser.Clear()

    txtnamauser.Clear()

    cbostatus.Text = ""

    txtpassword.Clear()

    txtcaridata.Clear()

    txtkodeuser.Focus()

    Call TampilStatus_user()

    Call TampilGrid()

    End Sub

    Sub DataBaru()

    txtnamauser.Clear()

    cbostatus.Text = ""

    txtpassword.Clear()

    txtcaridata.Clear()

    txtnamauser.Focus()

    End Sub

    Sub Ketemu()

    txtnamauser.Text = DR.Item("nama_User")

    txtpassword.Text = DR.Item("pwd_User")

    cbostatus.Text = DR.Item("Status_user")

    txtnamauser.Focus()

    End Sub

    Sub TampilGrid()

    DA = New OleDbDataAdapter("select * from tblUser",

    CONN)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    End Sub

    Sub TampilStatus_user()

    CMD = New OleDbCommand("select distinct

    Status_user from tblUser", CONN)

    DR = CMD.ExecuteReader

    cbostatus.Items.Clear()

    Do While DR.Read

    cbostatus.Items.Add(DR.Item("Status_user"))

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Loop

    End Sub

    Private Sub User_Load(ByVal sender As System.Object,

    ByVal e As System.EventArgs) Handles MyBase.Load

    'Me.StartPosition =

    FormStartPosition.CenterScreen

    Me.StartPosition = FormStartPosition.CenterScreen

    Call Koneksi()

    Call Kosongkan()

    End Sub

    Private Sub combobox1_KeyPress(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyPressEventArgs)

    Handles cbostatus.KeyPress

    If ((e.KeyChar >= "0" And e.KeyChar

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    btnsimpan.Click

    CMD = New OleDbCommand("select * from tblUser

    where kode_User='" & txtkodeuser.Text & "'", CONN)

    DR = CMD.ExecuteReader

    DR.Read()

    Try

    If Not DR.HasRows Then

    Dim simpan As String = "insert into

    tblUser values ('" & txtkodeuser.Text & "','" &

    txtnamauser.Text & "','" & txtpassword.Text & "','" &

    cbostatus.Text & "')"

    CMD = New OleDbCommand(simpan, CONN)

    CMD.ExecuteNonQuery()

    Else

    Dim edit As String = "update tblUser set

    nama_User='" & txtnamauser.Text & "',Status_user='" &

    cbostatus.Text & "',pwd_User='" & txtpassword.Text & "'

    where kode_User='" & txtkodeuser.Text & "'"

    CMD = New OleDbCommand(edit, CONN)

    CMD.ExecuteNonQuery()

    End If

    Catch ex As Exception

    MsgBox(ex.Message)

    End Try

    Call Kosongkan()

    End Sub

    Private Sub DGV_CellMouseClick(ByVal sender As Object,

    ByVal e As

    System.Windows.Forms.DataGridViewCellMouseEventArgs)

    Handles DGV.CellMouseClick

    On Error Resume Next

    txtkodeuser.Text =

    DGV.Rows(e.RowIndex).Cells(0).Value

    txtnamauser.Text =

    DGV.Rows(e.RowIndex).Cells(1).Value

    txtpassword.Text =

    DGV.Rows(e.RowIndex).Cells(2).Value

    cbostatus.Text =

    DGV.Rows(e.RowIndex).Cells(3).Value

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub Button2_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    btnhapus.Click

    If txtkodeuser.Text = "" Then

    MsgBox("Kode User harus diisi")

    txtkodeuser.Focus()

    Exit Sub

    End If

    If MessageBox.Show("yakin akan dihapus..?", "",

    MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes

    Then

    Dim hapus As String = "delete * from tblUser

    where kode_User='" & txtkodeuser.Text & "'"

    CMD = New OleDbCommand(hapus, CONN)

    CMD.ExecuteNonQuery()

    Call Kosongkan()

    Else

    Call Kosongkan()

    End If

    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object,

    ByVal e As System.EventArgs) Handles

    txtkodeuser.LostFocus

    CMD = New OleDbCommand("select * from tblUser

    where kode_User='" & txtkodeuser.Text & "'", CONN)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    Call DataBaru()

    Else

    Call Ketemu()

    End If

    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    txtcaridata.TextChanged

    DA = New OleDbDataAdapter("select * from tblUser

    where nama_User like '%" & txtcaridata.Text & "%'", CONN)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub GroupBox1_Enter(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    GroupBox1.Enter

    End Sub

    End Class

    Imports System.Data.OleDb

    Public Class Profil

    Sub IDtblprofilOtomatis()

    CMD = New OleDbCommand("select id from tblprofil

    order by id desc", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    ID.Text = "01"

    Else

    ID.Text = "01"

    End If

    ID.Enabled = False

    End Sub

    Sub Kosongkan()

    On Error Resume Next

    Nama.Clear()

    Alamat.Clear()

    Telepon.Clear()

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Fax.Clear()

    Email.Clear()

    Website.Clear()

    Nama.Focus()

    End Sub

    Sub Ketemu()

    On Error Resume Next

    Nama.Text = DR.Item(1)

    Alamat.Text = DR.Item(2)

    Telepon.Text =

    Microsoft.VisualBasic.Mid(DR.Item(3), 9, 30)

    Fax.Text = Microsoft.VisualBasic.Mid(DR.Item(4),

    5, 30)

    Email.Text = Microsoft.VisualBasic.Mid(DR.Item(5),

    7, 30)

    Website.Text =

    Microsoft.VisualBasic.Mid(DR.Item(6), 9, 30)

    Nama.Focus()

    End Sub

    Sub CariIdtblprofil()

    CMD = New OleDbCommand("select * from tblprofil

    where ID='" & ID.Text & "'", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    End Sub

    Sub Awal()

    Call IDtblprofilOtomatis()

    Call Kosongkan()

    End Sub

    Private Sub Profil_Load(ByVal sender As System.Object,

    ByVal e As System.EventArgs) Handles MyBase.Load

    Call Koneksi()

    'Call Awal()

    Call IDtblprofilOtomatis()

    Call CariIdtblprofil()

    If DR.HasRows Then

    Call Ketemu()

    End If

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button1.Click

    Try

    Call CariIdtblprofil()

    If Not DR.HasRows Then

    Dim simpan As String = "insert into

    tblprofil values('" & ID.Text & "','" & Nama.Text & "','"

    & Alamat.Text & "', '" & Label4.Text & Space(1) &

    Telepon.Text & "', '" & Label5.Text & Space(1) & Fax.Text

    & " ', '" & Label6.Text & Space(1) & Email.Text & "', '"

    & Label7.Text & Space(1) & Website.Text & "')"

    CMD = New OleDbCommand(simpan, Conn)

    CMD.ExecuteNonQuery()

    Else

    CMD = New OleDbCommand("delete * from

    tblprofil", Conn)

    CMD.ExecuteNonQuery()

    Dim simpan As String = "insert into

    tblprofil values('" & ID.Text & "','" & Nama.Text & "','"

    & Alamat.Text & "', '" & Label4.Text & Space(1) &

    Telepon.Text & "', '" & Label5.Text & Space(1) & Fax.Text

    & " ', '" & Label6.Text & Space(1) & Email.Text & "', '"

    & Label7.Text & Space(1) & Website.Text & "')"

    CMD = New OleDbCommand(simpan, Conn)

    CMD.ExecuteNonQuery()

    End If

    'Call Awal()

    MenuUtama.PanelID.Text = ID.Text

    MsgBox("Data berhasil disimpan")

    Me.Close()

    Catch ex As Exception

    MsgBox(ex.Message)

    End Try

    End Sub

    Private Sub Button3_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button3.Click

    'Call Kosongkan()

    Call IDtblprofilOtomatis()

    Call Ketemu()

    Nama.Focus()

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub Button4_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button4.Click

    Me.Close()

    End Sub

    End Class

    Imports System.Data.OleDb

    Public Class Pemasukan

    Sub NOTIS()

    CMD = New OleDbCommand("select nomor from tblKas

    order by nomor desc", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    txtnomor.Text = "00001" '99999

    Else

    txtnomor.Text =

    Format(Microsoft.VisualBasic.Right(DR.Item("Nomor"), 5) +

    1, "00000")

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    'txtnomor.Text = "M" + txtnomor.Text

    End If

    End Sub

    Sub Kosongkan()

    txtnomor.Clear()

    txtbukti.Clear()

    txtketerangan.Clear()

    txtjumlah.Clear()

    txtcari.Clear()

    txtnomor.Focus()

    Call TampilGrid()

    Call NOTIS()

    Tanggal.Focus()

    End Sub

    Sub DataBaru()

    txtbukti.Clear()

    txtketerangan.Clear()

    txtjumlah.Clear()

    txtcari.Clear()

    txtbukti.Focus()

    End Sub

    Sub Ketemu()

    Tanggal.Text = DR.Item("Tanggal")

    txtbukti.Text = DR.Item("nomor_Bukti")

    txtketerangan.Text = DR.Item("Keterangan")

    txtjumlah.Text = DR.Item("Pemasukan")

    txtbukti.Focus()

    End Sub

    Sub TampilGrid()

    DA = New OleDbDataAdapter("select * from tblKas

    where pemasukan>0", Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    DGV.Columns(5).Visible = False

    DGV.Columns(6).Visible = False

    DGV.Columns(7).Visible = False

    End Sub

    Private Sub Pemasukan_Load(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    MyBase.Load

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Call Koneksi()

    Call Kosongkan()

    Call NOTIS()

    If MenuUtama.Panel3.Text "ADMIN" Then

    Button2.Enabled = False

    Else

    Button2.Enabled = True

    End If

    End Sub

    Private Sub Button3_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button3.Click

    Call Kosongkan()

    End Sub

    Private Sub Button4_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button4.Click

    Me.Close()

    End Sub

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button1.Click

    CMD = New OleDbCommand("select * from tblKas

    where Nomor='" & txtnomor.Text & "'", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    Try

    If Not DR.HasRows Then

    Dim simpankas As String = "insert into

    tblkas values ('" & txtnomor.Text & "','" & Tanggal.Text

    & "','" & txtbukti.Text & "','" & txtketerangan.Text &

    "','" & txtjumlah.Text & "',0,'" & MenuUtama.Panel1.Text

    & "','" & MenuUtama.PanelID.Text & "')"

    CMD = New OleDbCommand(simpankas, Conn)

    CMD.ExecuteNonQuery()

    Else

    Dim editkas As String = "update tblkas

    set tanggal='" & Tanggal.Text & "',nomor_bukti='" &

    txtbukti.Text & "',keterangan='" & txtketerangan.Text &

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    "',pemasukan='" & txtjumlah.Text & "',kode_user='" &

    MenuUtama.Panel1.Text & "' where nomor='" & txtnomor.Text

    & "'"

    CMD = New OleDbCommand(editkas, Conn)

    CMD.ExecuteNonQuery()

    End If

    Catch ex As Exception

    MsgBox(ex.Message)

    End Try

    Call Kosongkan()

    End Sub

    Private Sub DGV_CellMouseClick(ByVal sender As Object,

    ByVal e As

    System.Windows.Forms.DataGridViewCellMouseEventArgs)

    Handles DGV.CellMouseClick

    On Error Resume Next

    txtnomor.Text =

    DGV.Rows(e.RowIndex).Cells(0).Value

    Tanggal.Text =

    DGV.Rows(e.RowIndex).Cells(1).Value

    txtbukti.Text =

    DGV.Rows(e.RowIndex).Cells(2).Value

    txtketerangan.Text =

    DGV.Rows(e.RowIndex).Cells(3).Value

    txtjumlah.Text =

    DGV.Rows(e.RowIndex).Cells(4).Value

    End Sub

    Private Sub Button2_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button2.Click

    If txtnomor.Text = "" Then

    MsgBox("Kode Kas harus diisi")

    txtnomor.Focus()

    Exit Sub

    End If

    If MessageBox.Show("yakin akan dihapus..?", "",

    MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes

    Then

    Dim hapuskas As String = "delete * from

    tblkas where nomor='" & txtnomor.Text & "'"

    CMD = New OleDbCommand(hapuskas, Conn)

    CMD.ExecuteNonQuery()

    Call Kosongkan()

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Else

    Call Kosongkan()

    End If

    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object,

    ByVal e As System.EventArgs) Handles txtnomor.LostFocus

    CMD = New OleDbCommand("select * from tblKas

    where Nomor='" & txtnomor.Text & "'", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    Call DataBaru()

    Else

    Call Ketemu()

    End If

    End Sub

    Private Sub txtcari_TextChanged(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    txtcari.TextChanged

    DA = New OleDbDataAdapter("select * from tblKas

    where nomor_Bukti like '%" & txtcari.Text & "%' or

    Keterangan like '%" & txtcari.Text & "%' and pemasukan>0",

    Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    End Sub

    Private Sub txtbukti_KeyDown(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyEventArgs) Handles

    txtbukti.KeyDown

    If e.KeyCode = Keys.Enter Then

    txtketerangan.Focus()

    End If

    End Sub

    Private Sub txtketeranagn_KeyDown(ByVal sender As

    Object, ByVal e As System.Windows.Forms.KeyEventArgs)

    Handles txtketerangan.KeyDown

    If e.KeyCode = Keys.Enter Then

    txtjumlah.Focus()

    End If

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub txtjumlah_KeyDown(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyEventArgs) Handles

    txtjumlah.KeyDown

    If e.KeyCode = Keys.Enter Then

    Button1.Focus()

    End If

    End Sub

    Private Sub txtjumlah_KeyPress(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyPressEventArgs)

    Handles txtjumlah.KeyPress

    If Not ((e.KeyChar >= "0" And e.KeyChar

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Imports System.Data.OleDb

    Public Class Pengeluaran

    Sub NOTIS()

    CMD = New OleDbCommand("select nomor from tblKas

    order by nomor desc", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    txtnomor.Text = "00001"

    Else

    txtnomor.Text =

    Format(Microsoft.VisualBasic.Right(DR.Item("Nomor"), 5) +

    1, "00000")

    End If

    End Sub

    Sub Kosongkan()

    txtnomor.Clear()

    txtbukti.Clear()

    txtketerangan.Clear()

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    txtjumlah.Clear()

    txtcari.Clear()

    txtnomor.Focus()

    Call TampilGrid()

    Call NOTIS()

    Tanggal.Focus()

    End Sub

    Sub DataBaru()

    txtbukti.Clear()

    txtketerangan.Clear()

    txtjumlah.Clear()

    txtcari.Clear()

    txtbukti.Focus()

    End Sub

    Sub Ketemu()

    Tanggal.Text = DR.Item("Tanggal")

    txtbukti.Text = DR.Item("nomor_Bukti")

    txtketerangan.Text = DR.Item("Keterangan")

    txtjumlah.Text = DR.Item("Pengeluaran")

    txtbukti.Focus()

    End Sub

    Sub TampilGrid()

    DA = New OleDbDataAdapter("select * from tblKas

    where Pengeluaran>0", Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    DGV.Columns(4).Visible = False

    'DGV.Columns(5).Visible = False

    DGV.Columns(6).Visible = False

    DGV.Columns(7).Visible = False

    End Sub

    Private Sub Pengeluaran_Load(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    MyBase.Load

    Call Koneksi()

    Call Kosongkan()

    Call NOTIS()

    If MenuUtama.Panel3.Text "ADMIN" Then

    Button2.Enabled = False

    Else

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Button2.Enabled = True

    End If

    End Sub

    Private Sub Button3_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button3.Click

    Call Kosongkan()

    End Sub

    Private Sub Button4_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button4.Click

    Me.Close()

    End Sub

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button1.Click

    CMD = New OleDbCommand("select * from tblKas

    where Nomor='" & txtnomor.Text & "'", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    Try

    If Not DR.HasRows Then

    Dim simpankas As String = "insert into

    tblkas values ('" & txtnomor.Text & "','" & Tanggal.Text

    & "','" & txtbukti.Text & "','" & txtketerangan.Text &

    "',0,'" & txtjumlah.Text & "','" & MenuUtama.Panel1.Text

    & "','" & MenuUtama.PanelID.Text & "')"

    CMD = New OleDbCommand(simpankas, Conn)

    CMD.ExecuteNonQuery()

    Else

    Dim editkas As String = "update tblkas

    set tanggal='" & Tanggal.Text & "',nomor_bukti='" &

    txtbukti.Text & "',keterangan='" & txtketerangan.Text &

    "',Pengeluaran='" & txtjumlah.Text & "',kode_user='" &

    MenuUtama.Panel1.Text & "' where nomor='" & txtnomor.Text

    & "'"

    CMD = New OleDbCommand(editkas, Conn)

    CMD.ExecuteNonQuery()

    End If

    Catch ex As Exception

    MsgBox(ex.Message)

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    End Try

    Call Kosongkan()

    End Sub

    Private Sub DGV_CellMouseClick(ByVal sender As Object,

    ByVal e As

    System.Windows.Forms.DataGridViewCellMouseEventArgs)

    Handles DGV.CellMouseClick

    On Error Resume Next

    txtnomor.Text =

    DGV.Rows(e.RowIndex).Cells(0).Value

    Tanggal.Text =

    DGV.Rows(e.RowIndex).Cells(1).Value

    txtbukti.Text =

    DGV.Rows(e.RowIndex).Cells(2).Value

    txtketerangan.Text =

    DGV.Rows(e.RowIndex).Cells(3).Value

    txtjumlah.Text =

    DGV.Rows(e.RowIndex).Cells(5).Value

    End Sub

    Private Sub Button2_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    Button2.Click

    If txtnomor.Text = "" Then

    MsgBox("Kode Kas harus diisi")

    txtnomor.Focus()

    Exit Sub

    End If

    If MessageBox.Show("yakin akan dihapus..?", "",

    MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes

    Then

    Dim hapuskas As String = "delete * from

    tblkas where nomor='" & txtnomor.Text & "'"

    CMD = New OleDbCommand(hapuskas, Conn)

    CMD.ExecuteNonQuery()

    Call Kosongkan()

    Else

    Call Kosongkan()

    End If

    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object,

    ByVal e As System.EventArgs) Handles txtnomor.LostFocus

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    CMD = New OleDbCommand("select * from tblKas

    where Nomor='" & txtnomor.Text & "'", Conn)

    DR = CMD.ExecuteReader

    DR.Read()

    If Not DR.HasRows Then

    Call DataBaru()

    Else

    Call Ketemu()

    End If

    End Sub

    Private Sub txtcari_TextChanged(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    txtcari.TextChanged

    DA = New OleDbDataAdapter("select * from tblKas

    where nomor_Bukti like '%" & txtcari.Text & "%' or

    Keterangan like '%" & txtcari.Text & "%' and

    Pengeluaran0", Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    End Sub

    Private Sub txtbukti_KeyDown(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyEventArgs) Handles

    txtbukti.KeyDown

    If e.KeyCode = Keys.Enter Then

    txtketerangan.Focus()

    End If

    End Sub

    Private Sub txtketeranagn_KeyDown(ByVal sender As

    Object, ByVal e As System.Windows.Forms.KeyEventArgs)

    Handles txtketerangan.KeyDown

    If e.KeyCode = Keys.Enter Then

    txtjumlah.Focus()

    End If

    End Sub

    Private Sub txtjumlah_KeyDown(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyEventArgs) Handles

    txtjumlah.KeyDown

    If e.KeyCode = Keys.Enter Then

    Button1.Focus()

    End If

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    End Sub

    Private Sub txtjumlah_KeyPress(ByVal sender As Object,

    ByVal e As System.Windows.Forms.KeyPressEventArgs)

    Handles txtjumlah.KeyPress

    If Not ((e.KeyChar >= "0" And e.KeyChar

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    DGV.Columns(6).Visible = False

    DGV.Columns(7).Visible = False

    DGV.Columns(1).DefaultCellStyle.Format = "dd MMMM

    yyyy"

    DGV.Columns(4).DefaultCellStyle.Format = "#,###"

    DGV.Columns(4).DefaultCellStyle.Alignment =

    DataGridViewContentAlignment.MiddleRight

    DGV.Columns(5).DefaultCellStyle.Format = "#,###"

    DGV.Columns(5).DefaultCellStyle.Alignment =

    DataGridViewContentAlignment.MiddleRight

    DGV.Columns(3).AutoSizeMode =

    DataGridViewAutoSizeColumnMode.DisplayedCells

    End Sub

    Sub Tampilsemua()

    DA = New OleDbDataAdapter("select * from tblkas",

    Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    Call FormatGrid()

    End Sub

    Sub tampilpertanggal()

    On Error Resume Next

    DA = New OleDbDataAdapter("select * from tblkas

    where cdate(tanggal)='" & DateValue(ListBox1.Text) & "'",

    Conn)

    Call FormatGrid()

    End Sub

    Sub tampiljenisdantanggal()

    Try

    If ListBox2.Text = "Pemasukan" Then

    DA = New OleDbDataAdapter("select * from

    tblkas where cdate(tanggal)='" & DateValue(ListBox1.Text)

    & "' and Pengeluaran=0", Conn)

    Call FormatGrid()

    Else

    DA = New OleDbDataAdapter("select * from

    tblkas where cdate(tanggal)='" & DateValue(ListBox1.Text)

    & "' and Pemasukan=0", Conn)

    Call FormatGrid()

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    End If

    Catch ex As Exception

    MsgBox("Pilih periode...!")

    End Try

    End Sub

    Sub Tampilperbulandantahun()

    Try

    If ListBox2.Text = "" Then

    Try

    If ListBox3.Text = "Bulanan" Then

    DA = New OleDbDataAdapter("select

    * from tblkas where month(tanggal)='" &

    Month(DateValue(ListBox1.Text)) & "' and year(tanggal)='"

    & Year(DateValue(ListBox1.Text)) & "'", Conn)

    Call FormatGrid()

    ElseIf ListBox3.Text = "Tahunan" Then

    DA = New OleDbDataAdapter("select

    * from tblkas where year(tanggal)='" &

    Year(DateValue(ListBox1.Text)) & "'", Conn)

    Call FormatGrid()

    End If

    Catch ex As Exception

    MsgBox(ex.Message)

    End Try

    End If

    If ListBox3.Text = "Bulanan" And

    ListBox2.Text = "Pemasukan" Then

    DA = New OleDbDataAdapter("select * from

    tblkas where month(tanggal)='" &

    Month(DateValue(ListBox1.Text)) & "' and year(tanggal)='"

    & Year(DateValue(ListBox1.Text)) & "' and Pengeluaran=0",

    Conn)

    Call FormatGrid()

    ElseIf ListBox3.Text = "Bulanan" And

    ListBox2.Text = "Pengeluaran" Then

    DA = New OleDbDataAdapter("select * from

    tblkas where month(tanggal)='" &

    Month(DateValue(ListBox1.Text)) & "' and year(tanggal)='"

    & Year(DateValue(ListBox1.Text)) & "' and Pemasukan=0",

    Conn)

    Call FormatGrid()

    ElseIf ListBox3.Text = "Tahunan" And

    ListBox2.Text = "Pemasukan" Then

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    DA = New OleDbDataAdapter("select * from

    tblkas where year(tanggal)='" &

    Year(DateValue(ListBox1.Text)) & "' and Pengeluaran=0",

    Conn)

    Call FormatGrid()

    ElseIf ListBox3.Text = "Tahunan" And

    ListBox2.Text = "Pengeluaran" Then

    DA = New OleDbDataAdapter("select * from

    tblkas where year(tanggal)='" &

    Year(DateValue(ListBox1.Text)) & "' and Pemasukan=0",

    Conn)

    Call FormatGrid()

    End If

    Catch ex As Exception

    MsgBox("Pilih periode dan jenis

    transaksi...!")

    End Try

    End Sub

    Private Sub Laporan_Load(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    MyBase.Load

    Call Koneksi()

    Call Koneksi()

    CMD = New OleDbCommand("select distinct tanggal

    from tblkas", Conn)

    DR = CMD.ExecuteReader

    ListBox1.Items.Clear()

    Do While DR.Read

    ListBox1.Items.Add(Format(DR(0), "dd MMMM

    yyyy"))

    Loop

    Call Tampilsemua()

    ListBox2.Items.Add("Pemasukan")

    ListBox2.Items.Add("Pengeluaran")

    ListBox3.Items.Add("Bulanan")

    ListBox3.Items.Add("Tahunan")

    'ListBox4.Items.Add("Tampil Semua")

    ListBox4.Items.Add("Bersihkan Pilihan")

    ListBox4.Items.Add("Cetak")

    End Sub

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    Private Sub listBox1_SelectedIndexChanged(ByVal

    sender As System.Object, ByVal e As System.EventArgs)

    Handles ListBox1.SelectedIndexChanged

    Call tampilpertanggal()

    End Sub

    Private Sub listBox2_SelectedIndexChanged(ByVal

    sender As System.Object, ByVal e As System.EventArgs)

    Handles ListBox2.SelectedIndexChanged

    Call tampiljenisdantanggal()

    End Sub

    Private Sub Button1_Click(ByVal sender As

    System.Object, ByVal e As System.EventArgs)

    Call Tampilsemua()

    End Sub

    Private Sub listBox3_SelectedIndexChanged(ByVal

    sender As System.Object, ByVal e As System.EventArgs)

    Handles ListBox3.SelectedIndexChanged

    Call Tampilperbulandantahun()

    End Sub

    Private Sub Button1_Click_1(ByVal sender As

    System.Object, ByVal e As System.EventArgs)

    Call Tampilsemua()

    Call FormatGrid()

    End Sub

    Private Sub ListBox4_SelectedIndexChanged(ByVal

    sender As System.Object, ByVal e As System.EventArgs)

    Handles ListBox4.SelectedIndexChanged

    If ListBox4.Text = "Tampil Semua" Then

    Call Tampilsemua()

    ElseIf ListBox4.Text = "Bersihkan Pilihan" Then

    'ListBox1.SelectedItem = Nothing

    ListBox2.SelectedItem = Nothing

    ListBox3.SelectedItem = Nothing

    ListBox4.SelectedItem = Nothing

    Call Tampilsemua()

    ElseIf ListBox4.Text = "Cetak" Then

    If DGV.RowCount - 1 = 0 Then

    MsgBox("pilih kriteria terlebih

    dahulu...!")

    Exit Sub

    End If

  • wwwwwwwwwwww....belajarvbbelajarvbbelajarvbbelajarvb....netnetnetnet Media Belajar VB.Net Online & Bimbingan Tugas Akhir - Skripsi

    CMD = New OleDbCommand("delete * from

    tblcetak", Conn)

    CMD.ExecuteNonQuery()

    For baris As Integer = 0 To DGV.RowCount - 2

    CMD = New OleDbCommand("insert into

    tblcetak values('" & DGV.Rows(baris).Cells(0).Value &

    "','" & DGV.Rows(baris).Cells(1).Value & "','" &

    DGV.Rows(baris).Cells(2).Value & "','" &

    DGV.Rows(baris).Cells(3).Value & "','" &

    DGV.Rows(baris).Cells(4).Value & "','" &

    DGV.Rows(baris).Cells(5).Value & "','" &

    DGV.Rows(baris).Cells(6).Value & "','" &

    DGV.Rows(baris).Cells(7).Value & "')", Conn)

    CMD.ExecuteNonQuery()

    Next

    Cetak.Show()

    cryRpt.Load("cetak.rpt")

    Call seting_laporan()

    Cetak.CRV.ReportSource = cryRpt

    Cetak.CRV.RefreshReport()

    End If

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As

    System.Object, ByVal e As System.EventArgs) Handles

    TextBox1.TextChanged

    DA = New OleDbDataAdapter("select * from tblkas

    where keterangan like '%" & TextBox1.Text & "%'", Conn)

    DS = New DataSet

    DA.Fill(DS)

    DGV.DataSource = DS.Tables(0)

    DGV.ReadOnly = True

    Call FormatGrid()

    End Sub

    End Class