4.3 STRUKTUR TABEL
APLIKASI INVENTORI
Tabel Mobil
Nama field
|
Type
|
Size
|
Ket
|
No. Polisi
|
Int
|
5
|
Primary key
|
Merk
|
Varchar
|
20
|
|
Type
|
Text
|
20
|
|
Tahun
|
Date
|
|
|
Cc
|
text
|
25
|
|
Warna
|
Varchar
|
20
|
|
Harga
|
text
|
25
|
|
Tabel Pelanggan
Nama field
|
Type
|
Size
|
Ket
|
No.Pelanggan
|
Int
|
3
|
Primary key
|
Nama
|
Varchar
|
40
|
|
Alamat
|
Varchar
|
40
|
|
Telepon
|
Int
|
15
|
|
|
|
|
|
|
|
|
|
Tabel Cabang
Nama field
|
Type
|
Size
|
Ket
|
No.Cabang
|
Int
|
4
|
Primary key
|
Nama
|
Text
|
40
|
|
Nama Pimpinan
|
Text
|
40
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tabel Sewa
Nama field
|
Type
|
Size
|
Ket
|
No.Polisi
|
Int
|
5
|
Primary key
|
No.Pelanggan
|
Int
|
3
|
|
Lama
|
Text
|
10
|
|
Total
|
Int
|
15
|
|
4.4 Rancanagan Tampilan Usulan
a. Rancangan Tampilan Halaman Utama
Tampilan
yang pertama kali muncul ketika system mulai dijalankan adalah halan utama.
Halaman utama ini berisi ucapan selamat dating di Program Rental Mobil dan profil.
Public Class Form1
Dim SQL As String
Dim Proses As New ClsKoneksi
Dim
tblMobil As DataTable
Sub
Data_Record()
tblMobil = Proses.ExecuteQuery("Select * From [mobil] order by id_mobil asc")
dgMobil.DataSource = tblMobil
End Sub
Sub
Bersih()
txtKode.Text = ""
txtMerk.Text = ""
txtType.Text = ""
cbWarna.Text = ""
txtTahun.Text = ""
txtHarga.Text = ""
txtCc.Text = ""
txtKode.Enabled = True
txtKode.Focus()
Call
Data_Record()
btnSimpan.Enabled = False
btnUpdate.Enabled = False
btnHapus.Enabled = False
btnBatal.Enabled = False
btnKeluar.Enabled = True
End Sub
Sub Aktif()
txtKode.Enabled = True
txtMerk.Enabled = True
txtType.Enabled = True
cbWarna.Enabled = True
txtTahun.Enabled = True
txtHarga.Enabled = True
txtCc.Enabled = True
End Sub
Sub
NonAktif()
txtKode.Enabled = False
txtMerk.Enabled = False
txtType.Enabled = False
cbWarna.Enabled = False
txtTahun.Enabled = False
txtHarga.Enabled = False
txtCc.Enabled = False
End Sub
Private Sub txtKode_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles txtKode.TextChanged
If
Len(txtKode.Text) < 5 Then Exit Sub
tblMobil = Proses.ExecuteQuery("Select * From [mobil] Where id_mobil='"
& txtKode.Text & "'")
If
tblMobil.Rows.Count > 0 Then
'MessageBox.Show("Data
Karyawan Tidak Ditemukan..!!", "Informasi",
MessageBoxButtons.OK, MessageBoxIcon.Information)
With
tblMobil.Rows(0)
txtKode.Text = .Item("id_mobil")
txtMerk.Text = .Item("merk")
txtType.Text = .Item("type")
cbWarna.Text = .Item("warna")
txtTahun.Text = .Item("tahun")
txtHarga.Text = .Item("harga")
txtCc.Text = .Item("Cc")
End
With
Call
Aktif()
txtKode.Enabled = False
txtMerk.Focus()
btnSimpan.Enabled = False
: btnKeluar.Enabled = True
btnUpdate.Enabled = True : btnHapus.Enabled = True
btnBatal.Enabled = True
Else
Call
Aktif()
txtKode.Enabled = False
txtMerk.Focus()
btnSimpan.Enabled = True
btnUpdate.Enabled = False : btnHapus.Enabled = False
: btnBatal.Enabled = True
End If
End Sub
Private Sub btnSimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnSimpan.Click
SQL = "Insert
Into [mobil] Values ('" & txtKode.Text & "','" & txtMerk.Text & "','" & txtType.Text & "','" & cbWarna.Text & "','" & txtTahun.Text & "','" & txtHarga.Text & "')"
Proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data Baru telah disimpan..!!", "Penyimpanan Sukses",
MessageBoxButtons.OK, MessageBoxIcon.Information)
Call
Bersih()
End Sub
Private Sub btnKeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnKeluar.Click
Me.Close()
End Sub
Private Sub dgMobil_CellContentClick(ByVal
sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgMobil.CellContentClick
txtKode.Text =
dgMobil.SelectedCells(0).Value
btnSimpan.Enabled = False : btnUpdate.Enabled = True
: btnHapus.Enabled = True
btnBatal.Enabled = True : btnKeluar.Enabled = False
End Sub
Private Sub btnUpdate_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
SQL = "Update
[mobil] Set merk = '" & txtMerk.Text & "', type ='" & txtType.Text & "', Cc ='" & txtCc.Text & "',warna = '" & cbWarna.Text & "', tahun = '" & txtTahun.Text &
"', harga = '" & txtHarga.Text
& "' where id_mobil = '" &
txtKode.Text & "'"
Proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah diubah..!!", "Perubahan
Data Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call
Bersih()
End Sub
Private Sub btnBatal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnBatal.Click
Call
Bersih()
End Sub
Private Sub btnHapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnHapus.Click
SQL = "Delete
From [mobil] Where id_mobil = '" & txtKode.Text & "'"
Proses.ExecuteNonQuery(SQL)
MessageBox.Show("Data telah dihapus..!!", "Penghapusan
Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call
Bersih()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
Bersih()
End Sub
Private Sub cbWarna_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
cbWarna.SelectedIndexChanged
End Sub
Private Sub txtCc_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles txtCc.TextChanged
End Sub
End Class