TUGAS TA BALAJAR BAHASA PEMOGRAMAN
Desain data petugas
gudang:
Listing program data
petugas gudang:
Imports
System.Data.OleDb
Public Class data_petugas_gudang
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:\vb2\data.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
Recordanggota()
ADP = New
OleDbDataAdapter("SELECT * FROM jumlah",
DB)
DS = New
DataSet
ADP.Fill(DS, "jumlah")
DataGridView1.DataSource = DS.Tables("jumlah")
End Sub
Sub
butoonbaru()
btn_baru.Enabled = True
btn_simpan.Enabled = False
btn_edit.Enabled = False
btn_hapus.Enabled = False
btn_batal.Enabled = False
btn_keluar.Enabled = True
End Sub
Sub
butoonedit()
btn_baru.Enabled = True
btn_simpan.Enabled = False
btn_edit.Enabled = False
btn_hapus.Enabled = False
btn_batal.Enabled = False
btn_keluar.Enabled = True
End Sub
Sub
butoonsimpan()
btn_baru.Enabled = True
btn_simpan.Enabled = False
btn_edit.Enabled = False
btn_hapus.Enabled = False
btn_batal.Enabled = False
btn_keluar.Enabled = True
End Sub
Sub
hapustext()
kode.Text = ""
nama.Text = ""
satuan.Text = ""
jumlah.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
Recordanggota()
Call
butoonsimpan()
satuan.Items.Add("2")
satuan.Items.Add("4")
satuan.Items.Add("8")
End Sub
Private Sub HPS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_hapus.Click
SQL = "DELETE
FROM LATIHAN Where kode='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub BR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_baru.Click
Call
hapustext()
kode.Focus()
End Sub
Private Sub KLR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_keluar.Click
Me.Close()
End Sub
Private Sub NO_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
kode.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM LATIHAN Where kode='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
nama.Text = DR.Item(1)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = kode.Text
Call
hapustext()
kode.Text = xkode
Call
butoonsimpan()
End
If
nama.Focus()
End If
End Sub
Private Sub BTL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_batal.Click
Call
hapustext()
kode.Focus()
End Sub
Private Sub DIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_edit.Click
SQL = "UPDATE
LATIHAN SET NAMA='" & nama.Text & "',"
& _
"satuan='" & satuan.Text & "'," & _
"jumlah='" & jumlah.Text & "' " & _
"Where kode='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub SMPN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_simpan.Click
SQL = "INSERT
INTO LATIHAN (kode, NAMA, satuan, jumlah)" & _
"Values ('" & kode.Text & "','" & _
nama.Text & "','" &
_
satuan.Text & "','"
& _
jumlah.Text & "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub JNJNG_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
satuan.SelectedIndexChanged
jumlah.Items.Clear()
If
satuan.Text = "2" Then
satuan.Items.Add("4")
satuan.Items.Add("8")
End If
If
jumlah.Text = "20" Then
jumlah.Items.Add("30")
jumlah.Items.Add("40")
End If
jumlah.Items.Add("20")
jumlah.Items.Add("30")
jumlah.Items.Add("40")
End Sub
End Class
Hasil data petugas gudang:
Hasil laporan data
petugas gudang:
Desain data persedian:
Listing program data
persedian:
Imports
System.Data.OleDb
Public Class data_persedian
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:\vb5\penjualan1.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
Recordanggota()
ADP = New
OleDbDataAdapter("SELECT * FROM produk",
DB)
DS = New
DataSet
ADP.Fill(DS, "produk")
DataGridView1.DataSource = DS.Tables("produk")
End Sub
Sub
butoonbaru()
Btn_baru.Enabled = True
btn_simpan.Enabled = False
Btn_edit.Enabled = False
Btn_hapus.Enabled = False
Btn_batal.Enabled = False
Btn_keluar.Enabled = True
End Sub
Sub
butoonedit()
Btn_baru.Enabled = False
btn_simpan.Enabled = False
Btn_edit.Enabled = True
Btn_hapus.Enabled = True
Btn_batal.Enabled = True
Btn_keluar.Enabled = False
End Sub
Sub
butoonsimpan()
Btn_baru.Enabled = False
btn_simpan.Enabled = True
Btn_edit.Enabled = False
Btn_hapus.Enabled = False
Btn_batal.Enabled = True
Btn_keluar.Enabled = False
End Sub
Sub
hapustext()
faktur.Text = ""
nama.Text = ""
kode_supplier.Text = ""
tgl.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
Recordanggota()
Call
butoonsimpan()
nama.Items.Add("selfi")
nama.Items.Add("yuni")
nama.Items.Add("dewi")
tgl.Items.Add("07")
tgl.Items.Add("30")
tgl.Items.Add("19")
End Sub
Private Sub HPS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_hapus.Click
SQL = "DELETE
FROM LATIHAN Where kodeANGGOTA='" & faktur.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub BR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_baru.Click
Call
hapustext()
faktur.Focus()
End Sub
Private Sub KLR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_keluar.Click
Me.Close()
End Sub
Private Sub NO_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
faktur.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM LATIHAN Where kodeANGGOTA='" & faktur.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
nama.Text = DR.Item(1)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = faktur.Text
Call
hapustext()
faktur.Text = xkode
Call
butoonsimpan()
End
If
nama.Focus()
End If
End Sub
Private Sub BTL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_batal.Click
Call
hapustext()
faktur.Focus()
End Sub
Private Sub DIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_edit.Click
SQL = "UPDATE
LATIHAN SET NAMA='" & nama.Text & "',"
& _
"alama='" & kode_supplier.Text &
"'," & _
"tlpn='" & tgl.Text & "' " & _
"pemimpin='" & faktur.Text & "' " & _
"Where kodeANGGOTA='" & faktur.Text
& "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub SMPN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_simpan.Click
SQL = "INSERT
INTO LATIHAN (kode_supplier, NAMA, no faktur,tgl)" & _
"Values ('" & faktur.Text & "','" & _
nama.Text & "','" &
_
tgl.Text & "','" &
_
kode_supplier.Text & "','"
& " ' )"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub alamat_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
nama.SelectedIndexChanged
nama.Items.Clear()
If
nama.Text = "selfi" Then
nama.Items.Add("yuni")
nama.Items.Add("dewi")
End If
If
tgl.Text = "o7" Then
tgl.Items.Add("30")
tgl.Items.Add("19")
End If
End Sub
End Class
Hasil data persedian:
Hasil laporan data
persedian:
Tidak ada komentar:
Posting Komentar