SISTEM
INFORMASI PEMESANAN DAN PENJUALAN SUKU CADANG MOBIL PADA UD.STAR DIESEL
Desaign form Pemesanan
Desaign Database
Listing Program Pemesanan
Imports
System.Data.OleDb
Public Class PEMESANAN
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:\PSN\PEMESANAN.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
TampilRecordPemesanan()
ADP = New
OleDbDataAdapter("SELECT * FROM
PEMESANAN", DB)
DS = New
DataSet
ADP.Fill(DS, "PEMESANAN")
DataGridView1.DataSource = DS.Tables("PEMESANAN")
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
hps.Enabled = True
btl.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()
KS.Text = ""
NAMA.Text = ""
ALAMAT.Text = ""
NO.Text = ""
KB.Text = ""
NB.Text = ""
JMLH.Text = ""
Call
ButtonBaru()
End Sub
Private Sub PEMESANAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OpenDB()
Call
HapusText()
Call
TampilRecordPemesanan()
End Sub
Private Sub br_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles br.Click
Call
HapusText()
KS.Focus()
End Sub
Private Sub btl_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btl.Click
Call
HapusText()
KS.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 PEMESANAN(KD_SUPLIER, NM, ALAMAT, NO_TLPN, KD_BARANG, NM_BARANG, JMLH)
" & _
"
values('" & KS.Text & "','"
& _
NAMA.Text
& "','" & _
ALAMAT.Text & "','"
& _
NO.Text
& "','" & _
KB.Text & "','"
& _
NB.Text
& "','" & _
JMLH.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub hps_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps.Click
SQL = "DELETE
FROM PEMESANAN Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
SQL = "UPDATE
PEMESANAN SET NM='" & NAMA.Text & "',"
& _
"
ALAMAT='" & ALAMAT.Text & "',"
& _
"
NO_TLPN='" & NO.Text & "','"
& _
"
KD_BARANG='" & KB.Text & "','"
& _
"
NM_BARANG='" & NB.Text & "','"
& _
"
JMLH='" & JMLH.Text & "'
" & _
"
Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub KS_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
KS.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "select
*from PEMESANAN Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
NAMA.Text = DR.Item(1)
ALAMAT.Text = DR.Item(2)
NO.Text = DR.Item(3)
KB.Text = DR.Item(4)
NB.Text = DR.Item(5)
JMLH.Text = DR.Item(6)
Call
ButtonEdit()
MsgBox("Data
ditemukan !")
Else
xkode = KS.Text
Call
HapusText()
KS.Text = xkode
Call
ButtonSimpan()
End
If
NAMA.Focus()
End If
End Sub
End Class
Imports
System.Data.OleDb
Public Class PEMESANAN
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:\PSN\PEMESANAN.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
TampilRecordPemesanan()
ADP = New
OleDbDataAdapter("SELECT * FROM
PEMESANAN", DB)
DS = New
DataSet
ADP.Fill(DS, "PEMESANAN")
DataGridView1.DataSource = DS.Tables("PEMESANAN")
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
hps.Enabled = True
btl.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()
KS.Text = ""
NAMA.Text = ""
ALAMAT.Text = ""
NO.Text = ""
KB.Text = ""
NB.Text = ""
JMLH.Text = ""
Call
ButtonBaru()
End Sub
Private Sub PEMESANAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OpenDB()
Call
HapusText()
Call
TampilRecordPemesanan()
End Sub
Private Sub br_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles br.Click
Call
HapusText()
KS.Focus()
End Sub
Private Sub btl_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btl.Click
Call
HapusText()
KS.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 PEMESANAN(KD_SUPLIER, NM, ALAMAT, NO_TLPN, KD_BARANG, NM_BARANG, JMLH)
" & _
"
values('" & KS.Text & "','"
& _
NAMA.Text
& "','" & _
ALAMAT.Text & "','"
& _
NO.Text
& "','" & _
KB.Text & "','"
& _
NB.Text
& "','" & _
JMLH.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub hps_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps.Click
SQL = "DELETE
FROM PEMESANAN Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
SQL = "UPDATE
PEMESANAN SET NM='" & NAMA.Text & "',"
& _
"
ALAMAT='" & ALAMAT.Text & "',"
& _
"
NO_TLPN='" & NO.Text & "','"
& _
"
KD_BARANG='" & KB.Text & "','"
& _
"
NM_BARANG='" & NB.Text & "','"
& _
"
JMLH='" & JMLH.Text & "'
" & _
"
Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
br_Click(sender, e)
Call
TampilRecordPemesanan()
End Sub
Private Sub KS_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
KS.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "select
*from PEMESANAN Where KD_SUPLIER='" & KS.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
NAMA.Text = DR.Item(1)
ALAMAT.Text = DR.Item(2)
NO.Text = DR.Item(3)
KB.Text = DR.Item(4)
NB.Text = DR.Item(5)
JMLH.Text = DR.Item(6)
Call
ButtonEdit()
MsgBox("Data
ditemukan !")
Else
xkode = KS.Text
Call
HapusText()
KS.Text = xkode
Call
ButtonSimpan()
End
If
NAMA.Focus()
End If
End Sub
End Class
Cetak Pemesanan
0 komentar:
Posting Komentar