SISTEM
INFORMASI PEMESANAN DAN PENJUALAN SUKU CADANG MOBIL PADA UD.STAR DIESEL
Desain form Penjualan
Desaign database
Listing Program Penjualan
Imports
System.Data.OleDb
Public Class PENJUALAN
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:\TRANSAKSI\SAKSI.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
TampilRecordPenjualan()
ADP = New
OleDbDataAdapter("SELECT * FROM SAKSI",
DB)
DS = New
DataSet
ADP.Fill(DS, "SAKSI")
DataGridView1.DataSource = DS.Tables("SAKSI")
End Sub
Sub ButtonBaru()
br.Enabled = True
smpn.Enabled = False
edit.Enabled = False
hps.Enabled = False
btl.Enabled = False
klr.Enabled = True
End Sub
Sub
ButtonEdit()
br.Enabled = False
smpn.Enabled = False
edit.Enabled = True
btl.Enabled = True
hps.Enabled = True
klr.Enabled = False
End Sub
Sub
ButtonSimpan()
br.Enabled = False
smpn.Enabled = True
edit.Enabled = False
hps.Enabled = False
btl.Enabled = True
klr.Enabled = False
End Sub
Sub
HapusText()
kdbrng.Text = ""
nmbrng.Text = ""
jmlh.Text = ""
hrg.Text = ""
ttl.Text = ""
Call
ButtonBaru()
End Sub
Private Sub PENJUALAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OpenDB()
Call
HapusText()
Call
TampilRecordPenjualan()
End Sub
Private Sub br_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles br.Click
Call
HapusText()
kdbrng.Focus()
End Sub
Private Sub btl_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btl.Click
Call
HapusText()
kdbrng.Focus()
End Sub
Private Sub klr_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles klr.Click
Me.Close()
End Sub
Private Sub smpn_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles smpn.Click
SQL = "INSERT
INTO SAKSI(KD_BRNG, NM_BRNG, JMLH, HRG, TTL) " & _
" values('" & kdbrng.Text & "','" & _
nmbrng.Text & "','"
& _
jmlh.Text & "','" & _
hrg.Text
& "','" & _
ttl.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call TampilRecordPenjualan()
End Sub
Private Sub hps_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps.Click
SQL = "DELETE
FROM SAKSI Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPenjualan()
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
SQL = "UPDATE
SAKSI SET NM_BRNG='" & nmbrng.Text & "'," & _
"
JMLH='" & jmlh.Text & "',"
& _
"
HRG='" & hrg.Text & "',"
& _
"
TTL='" & ttl.Text & "'
" & _
"
Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPenjualan()
End Sub
Private Sub kdbrng_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
kdbrng.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "select
*from SAKSI Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
nmbrng.Text = DR.Item(1)
jmlh.Text = DR.Item(2)
hrg.Text = DR.Item(3)
ttl.Text = DR.Item(4)
Call
ButtonEdit()
MsgBox("Data
ditemukan !")
Else
xkode = kdbrng.Text
Call
HapusText()
kdbrng.Text = xkode
Call
ButtonSimpan()
End
If
nmbrng.Focus()
End If
End Sub
End Class
Imports
System.Data.OleDb
Public Class PENJUALAN
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:\TRANSAKSI\SAKSI.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
TampilRecordPenjualan()
ADP = New
OleDbDataAdapter("SELECT * FROM SAKSI",
DB)
DS = New
DataSet
ADP.Fill(DS, "SAKSI")
DataGridView1.DataSource = DS.Tables("SAKSI")
End Sub
Sub ButtonBaru()
br.Enabled = True
smpn.Enabled = False
edit.Enabled = False
hps.Enabled = False
btl.Enabled = False
klr.Enabled = True
End Sub
Sub
ButtonEdit()
br.Enabled = False
smpn.Enabled = False
edit.Enabled = True
btl.Enabled = True
hps.Enabled = True
klr.Enabled = False
End Sub
Sub
ButtonSimpan()
br.Enabled = False
smpn.Enabled = True
edit.Enabled = False
hps.Enabled = False
btl.Enabled = True
klr.Enabled = False
End Sub
Sub
HapusText()
kdbrng.Text = ""
nmbrng.Text = ""
jmlh.Text = ""
hrg.Text = ""
ttl.Text = ""
Call
ButtonBaru()
End Sub
Private Sub PENJUALAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OpenDB()
Call
HapusText()
Call
TampilRecordPenjualan()
End Sub
Private Sub br_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles br.Click
Call
HapusText()
kdbrng.Focus()
End Sub
Private Sub btl_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btl.Click
Call
HapusText()
kdbrng.Focus()
End Sub
Private Sub klr_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles klr.Click
Me.Close()
End Sub
Private Sub smpn_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles smpn.Click
SQL = "INSERT
INTO SAKSI(KD_BRNG, NM_BRNG, JMLH, HRG, TTL) " & _
" values('" & kdbrng.Text & "','" & _
nmbrng.Text & "','"
& _
jmlh.Text & "','" & _
hrg.Text
& "','" & _
ttl.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call TampilRecordPenjualan()
End Sub
Private Sub hps_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps.Click
SQL = "DELETE
FROM SAKSI Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPenjualan()
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
SQL = "UPDATE
SAKSI SET NM_BRNG='" & nmbrng.Text & "'," & _
"
JMLH='" & jmlh.Text & "',"
& _
"
HRG='" & hrg.Text & "',"
& _
"
TTL='" & ttl.Text & "'
" & _
"
Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPenjualan()
End Sub
Private Sub kdbrng_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
kdbrng.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "select
*from SAKSI Where KD_BRNG='" & kdbrng.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
nmbrng.Text = DR.Item(1)
jmlh.Text = DR.Item(2)
hrg.Text = DR.Item(3)
ttl.Text = DR.Item(4)
Call
ButtonEdit()
MsgBox("Data
ditemukan !")
Else
xkode = kdbrng.Text
Call
HapusText()
kdbrng.Text = xkode
Call
ButtonSimpan()
End
If
nmbrng.Focus()
End If
End Sub
End Class
Cetak Penjualan
Cetak Relasi