0% found this document useful (0 votes)
62 views34 pages

Aplikasi Program Pemasukan Dan Pengeluaran Kas

This document describes tables and fields used in a VB.NET application for recording cash receipts and disbursements. It includes descriptions of three tables: tbljurnal for journal entries, TBLPerkiraan for chart of accounts, and tbluser for user authentication. Fields listed for each table include name, data type, and size. The document also provides code modules for database connectivity and login functionality.

Uploaded by

Sholah Muchsin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views34 pages

Aplikasi Program Pemasukan Dan Pengeluaran Kas

This document describes tables and fields used in a VB.NET application for recording cash receipts and disbursements. It includes descriptions of three tables: tbljurnal for journal entries, TBLPerkiraan for chart of accounts, and tbluser for user authentication. Fields listed for each table include name, data type, and size. The document also provides code modules for database connectivity and login functionality.

Uploaded by

Sholah Muchsin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

www.konsultasivb.

com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
APLIKASI PEMASUKAN DAN PENGELUARAN KAS - VB.NET
Table: tbljurnal Page: 1

Name Type Size


Nomor Text 5
Tanggal Date/Time 8
Nomor_Bukti Text 10
Keterangan Text 255
Kode_Perkiraan Text 5
Pemasukan Long Integer 4
Pengeluaran Long Integer 4
Saldo Long Integer 4
Kode_User Text 5

Table: TBLPerkiraan Page: 2

Name Type Size


Kode_Perkiraan Text 3
Nama_Perkiraan Text 100
Kelompok_Akun Text 50
Kelompok_Laporan Text 50

Table: tbluser Page: 3

Name Type Size


Kode_User Text 5
Nama_User Text 255
Status_User Text 255
Pwd_User Text 255
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Module Koneksi

Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Module Module1

Public Conn As OleDbConnection


Public DA As OleDbDataAdapter
Public DS As DataSet
Public CMD As OleDbCommand
Public DR As OleDbDataReader

Public cryRpt As New ReportDocument


Public crtableLogoninfos As New TableLogOnInfos
Public crtableLogoninfo As New TableLogOnInfo
Public crConnectionInfo As New ConnectionInfo
Public CrTables As Tables

Public Sub seting_laporan()


With crConnectionInfo
.ServerName =
(Application.StartupPath.ToString & "\dbkas.mdb")
.DatabaseName =
(Application.StartupPath.ToString & "\dbkas.mdb")
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
.UserID = ""
.Password = ""
End With

CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo =
crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
End Sub

Public Sub Koneksi()


Conn = New
OleDbConnection("provider=microsoft.jet.oledb.4.0;data
source=dbkas.mdb")
Conn.Open()
End Sub
End Module

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
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
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
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()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
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
End Sub
End Class

Imports System.Data.OleDb

Public Class User


www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Sub kosongkan()
TextBox1.Clear()
TextBox2.Clear()
ComboBox1.Text = ""
TextBox3.Clear()
TextBox5.Clear()
TextBox1.Focus()
End Sub

Sub databaru()
TextBox2.Clear()
ComboBox1.Text = ""
TextBox3.Clear()
TextBox5.Clear()
TextBox2.Focus()
End Sub

Sub ketemu()
On Error Resume Next
TextBox2.Text = DR(1)
ComboBox1.Text = DR(2)
TextBox3.Text = DR(3)
TextBox2.Focus()
End Sub

Sub tampilstatus_User()
CMD = New OleDbCommand("select distinct
status_User from tbluser", Conn)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
ComboBox1.Items.Add(DR(0))
Loop
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 carikode_user()
CMD = New OleDbCommand("select * from tbluser
where kode_user='" & TextBox1.Text & "'", Conn)
DR = CMD.ExecuteReader
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
DR.Read()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
Call Koneksi()
Call tampilgrid()
Call tampilstatus_User()
Call kosongkan()
End Sub

Private Sub TextBox1_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Call carikode_user()
If DR.HasRows Then
Call ketemu()
Else
Call databaru()
End If
End If
End Sub

Private Sub Button1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or
ComboBox1.Text = "" Or TextBox3.Text = "" Then
MsgBox("data belum lengkap")
Exit Sub
Else
Call carikode_user()
If Not DR.HasRows Then
Dim simpan As String = "insert into
tbluser values ('" & TextBox1.Text & "','" &
TextBox2.Text & "','" & ComboBox1.Text & "','" &
TextBox3.Text & "')"
CMD = New OleDbCommand(simpan, Conn)
CMD.ExecuteNonQuery()
Call kosongkan()
Call tampilgrid()
Call tampilstatus_User()
End If
End If
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Private Sub Button2_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or
ComboBox1.Text = "" Or TextBox3.Text = "" Then
MsgBox("data belum lengkap")
Exit Sub
Else
Call carikode_user()
If DR.HasRows Then
Dim EDIT As String = "UPDATE tbluser SET
nama_user='" & TextBox2.Text & "',status_User='" &
ComboBox1.Text & "',pwd_user='" & TextBox3.Text & "'
where kode_user='" & TextBox1.Text & "'"
CMD = New OleDbCommand(EDIT, Conn)
CMD.ExecuteNonQuery()
Call kosongkan()
Call tampilgrid()
Call tampilstatus_User()
End If
End If
End Sub

Private Sub Button3_Click(ByVal sender As


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

If TextBox1.Text = "" Then


MsgBox("kode user harus diisi")
TextBox1.Focus()
Exit Sub
End If

Call carikode_user()
If Not DR.HasRows Then
MsgBox("kode user tidak ditemukan ")
TextBox1.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='" & TextBox1.Text & "'"
CMD = New OleDbCommand(hapus, Conn)
CMD.ExecuteNonQuery()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Call kosongkan()
Call tampilgrid()
Call tampilstatus_User()
Else
Call kosongkan()
End If
End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
Call kosongkan()
End Sub

Private Sub Button5_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub

Private Sub TextBox5_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox5.TextChanged
DA = New OleDbDataAdapter("select * from tbluser
where nama_user like '%" & TextBox5.Text & "%'", Conn)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
End Sub

Private Sub DGV_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs)
Handles DGV.CellMouseClick
On Error Resume Next
TextBox1.Text =
DGV.Rows(e.RowIndex).Cells(0).Value
Call carikode_user()
If DR.HasRows Then
Call ketemu()
End If
End Sub
End Class
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Imports System.Data.OleDb

Public Class Perkiraan

Sub Kosongkan()
TextBox1.Enabled = True
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
'TextBox6.Clear()
TextBox1.Focus()
Call TampilGrid()
End Sub

Sub DataBaru()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
'TextBox6.Clear()
TextBox2.Focus()
End Sub

Sub Ketemu()
TextBox1.Enabled = False
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
TextBox2.Text = DR.Item("nama_Perkiraan")
TextBox3.Text = DR.Item("KELOMPOK_akun")
TextBox4.Text = DR.Item("kelompok_laporan")
TextBox2.Focus()
End Sub

Sub TampilGrid()
DA = New OleDbDataAdapter("select * from
tblPerkiraan order by 1", Conn)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True
DGV.Columns(1).Width = 200
End Sub

Sub Carikode()
CMD = New OleDbCommand("select * from
tblPerkiraan where kode_Perkiraan='" & TextBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Private Sub MasterPerkiraan_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Me.CenterToScreen()
Call Koneksi()
Call Kosongkan()
End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
If TextBox1.Text = "" Then
MsgBox("Kode Perkiraan harus diisi")
TextBox1.Focus()
Exit Sub
End If

CMD = New OleDbCommand("select kode_perkiraan


from tbljurnal where kode_perkiraan='" & TextBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
MsgBox("kode perkiraan tidak dapat dihapus
karena sudah ada dalam jurnal")
Else
If MessageBox.Show("yakin akan dihapus..?",
"", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then

Dim hapus As String = "delete from


tblPerkiraan where kode_Perkiraan='" & TextBox1.Text &
"'"
CMD = New OleDbCommand(hapus, Conn)
CMD.ExecuteNonQuery()
Call Kosongkan()
Else
Call Kosongkan()
End If
End If
End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
Call Kosongkan()
End Sub

Private Sub Button1_Click(ByVal sender As


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

Call Carikode()
Try
If Not DR.HasRows Then
Dim simpan As String = "insert into
tblPerkiraan values ('" & TextBox1.Text & "','" &
TextBox2.Text & "','" & TextBox3.Text & "','" &
TextBox4.Text & "')"
CMD = New OleDbCommand(simpan, Conn)
CMD.ExecuteNonQuery()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Call Kosongkan()
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Private Sub DGV_CellMouseClick(ByVal sender As Object,
ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs)
Handles DGV.CellMouseClick
On Error Resume Next
TextBox1.Enabled = False
TextBox1.Text =
DGV.Rows(e.RowIndex).Cells(0).Value
TextBox2.Text =
DGV.Rows(e.RowIndex).Cells(1).Value
TextBox3.Text =
DGV.Rows(e.RowIndex).Cells(2).Value
TextBox4.Text =
DGV.Rows(e.RowIndex).Cells(3).Value
TextBox2.Focus()
End Sub

Private Sub Button2_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Call Carikode()
Try
If DR.HasRows Then
Dim edit As String = "update tblPerkiraan
set nama_Perkiraan='" & TextBox2.Text &
"',kelompok_akun='" & TextBox3.Text &
"',kelompok_laporan='" & TextBox4.Text & "' where
kode_Perkiraan='" & TextBox1.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 TextBox1_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs)
Handles TextBox1.KeyPress
TextBox1.MaxLength = 3
If e.KeyChar = Chr(13) Then
If Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "1" And Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "2" And Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "3" And Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "4" And Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "5" And Microsoft.VisualBasic.Left(TextBox1.Text,
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
1) <> "6" And Microsoft.VisualBasic.Left(TextBox1.Text,
1) <> "7" Then
MsgBox("kode perkiraan harus diawalai
dengan angka 1,2,3,4,5,6 atau 7")
Exit Sub
Else
If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "1" Then
TextBox3.Text = "AKTIVA LANCAR"
TextBox4.Text = "NERACA"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "2" Then
TextBox3.Text = "AKTIVA TIDAK LANCAR"
TextBox4.Text = "NERACA"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "3" Then
TextBox3.Text = "HUTANG LANCAR"
TextBox4.Text = "NERACA"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "4" Then
TextBox3.Text = "HUTANG TIDAK LANCAR"
TextBox4.Text = "NERACA"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "5" Then
TextBox3.Text = "MODAL"
TextBox4.Text = "NERACA"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "6" Then
TextBox3.Text = " PENDAPATAN"
TextBox4.Text = "LABA RUGI"
End If

If
Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "7" Then
TextBox3.Text = "BIAYA"
TextBox4.Text = "LABA RUGI"
End If
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
End If

CMD = New OleDbCommand("select kode_perkiraan


from tblperkiraan where left(kode_perkiraan,1)='" &
Microsoft.VisualBasic.Left(TextBox1.Text, 1) & "' order
by kode_perkiraan desc", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
TextBox1.Text = DR.Item(0) + 1
TextBox2.Focus()
Else
TextBox1.Text =
Microsoft.VisualBasic.Left(TextBox1.Text, 1) + "01"
TextBox2.Focus()
End If

End If
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = vbBack) Then
e.Handled = True
End If

End Sub

Private Sub TextBox5_TextChanged(ByVal sender As


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

DA = New OleDbDataAdapter("select * from


tblPerkiraan where nama_Perkiraan like '%" &
TextBox5.Text & "%' OR KELOMPOK_AKUN like '%" &
TextBox5.Text & "%' OR KELOMPOK_LAPORAN like '%" &
TextBox5.Text & "%'", Conn)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
End Sub

Private Sub TextBox2_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs)
Handles TextBox2.KeyPress
If e.KeyChar = Chr(13) Then

CMD = New OleDbCommand("select nama_perkiraan


from tblperkiraan where nama_perkiraan='" & TextBox2.Text
& "'", Conn)
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
MsgBox("Nama perkiraan sudah ada, ganti
dengan yang lain")
TextBox2.Clear()
TextBox2.Focus()
Else
Button1.Focus()
End If
End If
End Sub

Private Sub Button5_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub
End Class

Imports System.Data.OleDb

Public Class Penerimaan


www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Sub NOTIS()
CMD = New OleDbCommand("select nomor from
tbljurnal 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()
txtjumlah.Clear()
txtcari.Clear()
tNamaPerkiraan.Text = ""
ComboBox1.Text = ""
txtnomor.Focus()
Call NOTIS()
Call TampilGrid()
Call Tampilkodeperkiraan()
Tanggal.Focus()
End Sub

Sub DataBaru()
txtbukti.Clear()
txtketerangan.Clear()
txtjumlah.Clear()
tNamaPerkiraan.Text = ""
ComboBox1.Text = ""
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")
ComboBox1.Text = DR("kode_perkiraan")

txtbukti.Focus()
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Sub TampilGrid()
'DA = New OleDbDataAdapter("select * from
TBLJURNAL where pemasukan>0", Conn)
DA = New OleDbDataAdapter("select * from
TBLJURNAL", Conn)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True

DGV.Columns("pemasukan").DefaultCellStyle.Format
= "#,0"

DGV.Columns("pemasukan").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight

DGV.Columns("Pengeluaran").DefaultCellStyle.Format =
"#,0"

DGV.Columns("Pengeluaran").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight
DGV.Columns("saldo").DefaultCellStyle.Format =
"#,0"
DGV.Columns("saldo").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight
End Sub

Sub Tampilkodeperkiraan()
CMD = New OleDbCommand("select * from
tblperkiraan", Conn)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
ComboBox1.Items.Add(DR(0))
Loop

CMD = New OleDbCommand("select * from


tblperkiraan", Conn)
DR = CMD.ExecuteReader
ListBox1.Items.Clear()
Do While DR.Read
ListBox1.Items.Add(DR(1))
Loop
End Sub

Sub carinomor()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
CMD = New OleDbCommand("select * from TBLJURNAL
where Nomor='" & txtnomor.Text & "'", Conn)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Sub updatesaldo()
DGV.Rows(0).Cells("saldo").Value =
DGV.Rows(0).Cells("Pemasukan").Value -
DGV.Rows(0).Cells("pengeluaran").Value
For baris As Integer = 1 To DGV.RowCount - 2
DGV.Rows(baris).Cells("saldo").Value =
DGV.Rows(baris - 1).Cells("saldo").Value +
DGV.Rows(baris).Cells("Pemasukan").Value -
DGV.Rows(baris).Cells("pengeluaran").Value
Next

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


CMD = New OleDbCommand("update tbljurnal set
saldo ='" & DGV.Rows(baris).Cells("saldo").Value & "'
where nomor='" & DGV.Rows(baris).Cells(0).Value & "'",
Conn)
CMD.ExecuteNonQuery()
Next
End Sub

Private Sub Pemasukan_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Me.CenterToScreen()
Call Koneksi()
Call Kosongkan()
End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.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
TBLJURNAL where nomor='" & txtnomor.Text & "'"
CMD = New OleDbCommand(hapuskas, Conn)
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
CMD.ExecuteNonQuery()
Call Kosongkan()
Call updatesaldo()

Else
Call Kosongkan()
End If
End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
Call Kosongkan()
End Sub

Private Sub Button1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Call carinomor()
If Not DR.HasRows Then
Dim simpankas As String = "insert into
TBLJURNAL values ('" & txtnomor.Text & "','" &
Tanggal.Text & "','" & txtbukti.Text & "','" &
txtketerangan.Text & "','" & ComboBox1.Text & "','" &
txtjumlah.Text & "',0,0,'" & MenuUtama.Panel1.Text & "')"
CMD = New OleDbCommand(simpankas, Conn)
CMD.ExecuteNonQuery()
Call Kosongkan()
End If

Call updatesaldo()
End Sub

Private Sub DGV_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs)
Handles DGV.CellMouseClick
On Error Resume Next
If DGV.Rows(e.RowIndex).Cells(5).Value = 0 Then
MsgBox("Pilih data pemasukan kas...!")
Call Kosongkan()
Exit Sub
End If
txtnomor.Text =
DGV.Rows(e.RowIndex).Cells(0).Value
Call carinomor()
If DR.HasRows Then
Call Ketemu()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
End If
End Sub

Private Sub Button2_Click(ByVal sender As


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

Call carinomor()
If DR.HasRows Then
Dim editkas As String = "update TBLJURNAL set
tanggal='" & Tanggal.Text & "',nomor_bukti='" &
txtbukti.Text & "',keterangan='" & txtketerangan.Text &
"',kode_perkiraan='" & ComboBox1.Text & "',pemasukan='" &
txtjumlah.Text & "',kode_user='" & MenuUtama.Panel1.Text
& "' where nomor='" & txtnomor.Text & "'"
CMD = New OleDbCommand(editkas, Conn)
CMD.ExecuteNonQuery()
Call Kosongkan()
End If
Call updatesaldo()
End Sub

Private Sub txtcari_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
txtcari.TextChanged
DA = New OleDbDataAdapter("select * from
TBLJURNAL 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
ComboBox1.Focus()
End If
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
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
End Sub

Sub carisaldo()
CMD = New OleDbCommand("select saldo from
tbljurnal where nomor in(select max(nomor) from
TBLJURNAL) order by nomor desc", Conn)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Private Sub Tanggal_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
Tanggal.KeyDown
If e.KeyCode = Keys.Enter Then
txtbukti.Focus()
End If
End Sub

Private Sub ComboBox1_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyDown
If e.KeyCode = Keys.Enter Then
txtjumlah.Focus()
End If
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged
CMD = New OleDbCommand("select * from
tblperkiraan where kode_perkiraan='" & ComboBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
tNamaPerkiraan.Text = DR(1)
End If
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Private Sub ListBox1_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles ListBox1.SelectedIndexChanged
CMD = New OleDbCommand("select * from
tblperkiraan where nama_perkiraan='" & ListBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
ComboBox1.Text = DR(0)
tNamaPerkiraan.Text = DR(1)
End If
End Sub

Private Sub Button5_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub
End Class

Imports System.Data.OleDb

Public Class Pengeluaran


www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Sub NOTIS()
CMD = New OleDbCommand("select nomor from
tbljurnal 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()
txtjumlah.Clear()
txtcari.Clear()
tNamaPerkiraan.Text = ""
ComboBox1.Text = ""
txtnomor.Focus()
Call NOTIS()
Call TampilGrid()
Call Tampilkodeperkiraan()
Tanggal.Focus()
End Sub

Sub DataBaru()
txtbukti.Clear()
txtketerangan.Clear()
txtjumlah.Clear()
tNamaPerkiraan.Text = ""
ComboBox1.Text = ""
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")
ComboBox1.Text = DR("kode_perkiraan")

txtbukti.Focus()
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Sub TampilGrid()
'DA = New OleDbDataAdapter("select * from
TBLJURNAL where pengeluaran>0", Conn)
DA = New OleDbDataAdapter("select * from
TBLJURNAL", Conn)
DS = New DataSet
DA.Fill(DS)
DGV.DataSource = DS.Tables(0)
DGV.ReadOnly = True

DGV.Columns("pemasukan").DefaultCellStyle.Format
= "#,0"

DGV.Columns("pemasukan").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight

DGV.Columns("Pengeluaran").DefaultCellStyle.Format =
"#,0"

DGV.Columns("Pengeluaran").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight
DGV.Columns("saldo").DefaultCellStyle.Format =
"#,0"
DGV.Columns("saldo").DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleRight
End Sub

Sub Tampilkodeperkiraan()
CMD = New OleDbCommand("select * from
tblperkiraan", Conn)
DR = CMD.ExecuteReader
ComboBox1.Items.Clear()
Do While DR.Read
ComboBox1.Items.Add(DR(0))
Loop

CMD = New OleDbCommand("select * from


tblperkiraan", Conn)
DR = CMD.ExecuteReader
ListBox1.Items.Clear()
Do While DR.Read
ListBox1.Items.Add(DR(1))
Loop
End Sub

Sub carinomor()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
CMD = New OleDbCommand("select * from TBLJURNAL
where Nomor='" & txtnomor.Text & "'", Conn)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Sub updatesaldo()
DGV.Rows(0).Cells("saldo").Value =
DGV.Rows(0).Cells("Pemasukan").Value -
DGV.Rows(0).Cells("pengeluaran").Value
For baris As Integer = 1 To DGV.RowCount - 2
DGV.Rows(baris).Cells("saldo").Value =
DGV.Rows(baris - 1).Cells("saldo").Value +
DGV.Rows(baris).Cells("Pemasukan").Value -
DGV.Rows(baris).Cells("pengeluaran").Value
Next

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


CMD = New OleDbCommand("update tbljurnal set
saldo ='" & DGV.Rows(baris).Cells("saldo").Value & "'
where nomor='" & DGV.Rows(baris).Cells(0).Value & "'",
Conn)
CMD.ExecuteNonQuery()
Next
End Sub

Private Sub pengeluaran_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Me.CenterToScreen()
Call Koneksi()
Call Kosongkan()
End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.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
TBLJURNAL where nomor='" & txtnomor.Text & "'"
CMD = New OleDbCommand(hapuskas, Conn)
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
CMD.ExecuteNonQuery()
Call Kosongkan()
Call updatesaldo()
Else
Call Kosongkan()
End If

End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
Call Kosongkan()
End Sub

Private Sub Button1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Call carinomor()
If Not DR.HasRows Then
Dim simpankas As String = "insert into
TBLJURNAL values ('" & txtnomor.Text & "','" &
Tanggal.Text & "','" & txtbukti.Text & "','" &
txtketerangan.Text & "','" & ComboBox1.Text & "',0,'" &
txtjumlah.Text & "',0,'" & MenuUtama.Panel1.Text & "')"
CMD = New OleDbCommand(simpankas, Conn)
CMD.ExecuteNonQuery()
Call Kosongkan()
End If

Call updatesaldo()
End Sub

Private Sub DGV_CellMouseClick(ByVal sender As Object,


ByVal e As
System.Windows.Forms.DataGridViewCellMouseEventArgs)
Handles DGV.CellMouseClick
On Error Resume Next
If DGV.Rows(e.RowIndex).Cells(6).Value = 0 Then
MsgBox("Pilih data pengeluaran kas...!")
Call Kosongkan()
Exit Sub
End If
txtnomor.Text =
DGV.Rows(e.RowIndex).Cells(0).Value
Call carinomor()
If DR.HasRows Then
Call Ketemu()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
End If

End Sub

Private Sub Button2_Click(ByVal sender As


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

Call carinomor()
If DR.HasRows Then
Dim editkas As String = "update TBLJURNAL set
tanggal='" & Tanggal.Text & "',nomor_bukti='" &
txtbukti.Text & "',keterangan='" & txtketerangan.Text &
"',kode_perkiraan='" & ComboBox1.Text & "',pengeluaran='"
& txtjumlah.Text & "',kode_user='" &
MenuUtama.Panel1.Text & "' where nomor='" & txtnomor.Text
& "'"
CMD = New OleDbCommand(editkas, Conn)
CMD.ExecuteNonQuery()
Call Kosongkan()
End If
Call updatesaldo()
End Sub

Private Sub txtcari_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
txtcari.TextChanged
DA = New OleDbDataAdapter("select * from
TBLJURNAL where nomor_Bukti like '%" & txtcari.Text & "%'
or Keterangan like '%" & txtcari.Text & "%' and
pengeluaran>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
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
ComboBox1.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
End Sub

Sub carisaldo()
CMD = New OleDbCommand("select saldo from
tbljurnal where nomor in(select max(nomor) from
TBLJURNAL) order by nomor desc", Conn)
DR = CMD.ExecuteReader
DR.Read()
End Sub

Private Sub Tanggal_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
Tanggal.KeyDown
If e.KeyCode = Keys.Enter Then
txtbukti.Focus()
End If
End Sub

Private Sub ComboBox1_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyDown
If e.KeyCode = Keys.Enter Then
txtjumlah.Focus()
End If
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged
CMD = New OleDbCommand("select * from
tblperkiraan where kode_perkiraan='" & ComboBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
tNamaPerkiraan.Text = DR(1)
End If
End Sub
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi

Private Sub ListBox1_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ListBox1.SelectedIndexChanged
CMD = New OleDbCommand("select * from
tblperkiraan where nama_perkiraan='" & ListBox1.Text &
"'", Conn)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows Then
ComboBox1.Text = DR(0)
tNamaPerkiraan.Text = DR(1)
End If
End Sub

Private Sub Button5_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
Me.Close()
End Sub
End Class

Imports System.Data.OleDb

Public Class Laporan

Private Sub Laporan_Load(ByVal sender As


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

Call Koneksi()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
CMD = New OleDbCommand("select distinct
Nomor_bukti from tbljurnal", Conn)
DR = CMD.ExecuteReader
Do While DR.Read
ListBox1.Items.Add(DR(0))
Loop

CMD = New OleDbCommand("select distinct


nama_perkiraan from tblperkiraan,tbljurnal where
tblperkiraan.kode_perkiraan=tbljurnal.kode_perkiraan",
Conn)
DR = CMD.ExecuteReader
Do While DR.Read
ListBox2.Items.Add(DR(0))
Loop

End Sub

Private Sub Button1_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
CRV.SelectionFormula =
"totext({tbljurnal.tanggal})='" & dtp1.Text & "'"
cryRpt.Load("jurnal.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub Button2_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
CRV.SelectionFormula =
"totext({tbljurnal.tanggal})>='" & dtp2.Text & "' and
totext({tbljurnal.tanggal})<='" & dtp3.Text & "'"
cryRpt.Load("jurnal.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub Button4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
CRV.SelectionFormula =
"month({tbljurnal.tanggal})=(" & Month(dtp4.Text) & ")
and year({tbljurnal.tanggal})=(" & Year(dtp4.Text) & ")"
cryRpt.Load("jurnal.rpt")
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
CRV.SelectionFormula =
"year({tbljurnal.tanggal})=(" & Year(dtp4.Text) & ")"
cryRpt.Load("jurnal.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ListBox1.SelectedIndexChanged
CRV.SelectionFormula =
"{tbljurnal.nomor_bukti}='" & ListBox1.Text & "'"
cryRpt.Load("jurnal.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub ListBox2_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ListBox2.SelectedIndexChanged
CRV.SelectionFormula =
"{tblperkiraan.nama_perkiraan}='" & ListBox2.Text & "'"
cryRpt.Load("BUKU BESAR.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
End Sub

Private Sub TextBox1_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
CRV.SelectionFormula =
"{tbljurnal.keterangan} like '*" & TextBox1.Text & "*'"
cryRpt.Load("jurnal.rpt")
Call seting_laporan()
CRV.ReportSource = cryRpt
CRV.RefreshReport()
www.konsultasivb.com
Pusat Kursus VB.Net, Bimbingan Tugas Akhir & Skripsi
End If
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As


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

End Sub
End Class

You might also like