227
Adodc1.RecordSource = select kode_barang KODE BARANG, nama_barang NAMA BARANG, tipe_barang TIPE BARANG, sisa SISA, satuan SATUAN, kadaluarsa
KADALUARSA, kode_suplier KODE SUPLIER, nama_suplier NAMA SUPLIER from data_barang where nama_suplier LIKE _
txtCari.Text order by kode_barang Adodc1.Refresh
DataGrid1.Refresh Adodc2.RecordSource = select id_suplier KODE SUPLIER, nama_suplier NAMA
SUPLIER, alamat ALAMAT from suplier where nama_suplier LIKE _ txtCari.Text order by id_suplier
Adodc2.Refresh DataGrid2.Refresh
End If End Sub
Private Sub txtCari_KeyPressKeyAscii As Integer KeyAscii = AscUCaseChrKeyAscii
End Sub Private Sub txtsuplier_keypressKeyAscii As Integer
KeyAscii = AscUCaseChrKeyAscii Adodc2.RecordSource = select id_suplier KODE SUPLIER, nama_suplier NAMA
SUPLIER, alamat ALAMAT from suplier where nama_suplier LIKE _ txtSuplier.Text order by id_suplier
Adodc2.Refresh DataGrid2.Refresh
End Sub
K. Form Pengecekan Data Barang
Private Sub cmdDetail_Click detailCek.Show
End Sub Private Sub cmdKeluar_Click
Unload Me End Sub
Private Sub DataGrid1_dblClick detailCek.Show
detailCek.txtCari.Text = DataGrid1.Columns0.Value End Sub
Private Sub lapBarang_Click frmLaporanBarang.Show
End Sub Private Sub txtCari_Change
If optKode.Value = True Then Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, tipe_barang JENIS BARANG, sisa SISA, satuan SATUAN from barang where id_barang LIKE _
txtCari.Text order by id_barang Adodc1.Refresh
DataGrid1.Refresh ElseIf optNama.Value = True Then
Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA BARANG, tipe_barang JENIS BARANG, sisa SISA, satuan SATUAN from barang where
nama_barang LIKE _
228
txtCari.Text order by id_barang Adodc1.Refresh
DataGrid1.Refresh Else
MsgBox Pilih kategori pencarian, vbInformation, INFORMASI End If
End Sub Private Sub txtCari_KeyPressKeyAscii As Integer
KeyAscii = AscUCaseChrKeyAscii End Sub
Private Sub Form_UnloadCancel As Integer Do Until Me.Top = -9000
DoEvents Me.Move Me.Left, Me.Top - 50
DoEvents Loop
End Sub
L. Form Detail Pengecekan Data Barang
Private Sub frmAwal txtCari.Enabled = True
txtTgl1.Enabled = True txtTgl2.Enabled = True
txtJam1.Enabled = True txtJam2.Enabled = True
cmdTampil.Enabled = False txtJam1.Text = FormatMDIForm1.lblJamLogin, hh:mm
txtJam2.Text = FormatTime, hh:mm End Sub
Private Sub frmKosong txtCari.Text =
txtTgl1.Text = FormatDate, yyyy-mm-dd txtTgl2.Text = FormatDate, yyyy-mm-dd
txtJam1.Text = FormatMDIForm1.lblJamLogin, hh:mm txtJam2.Text = FormatTime, hh:mm
End Sub Private Sub boxKategori_Click
If boxKategori.Text = JAM Then Call frmKosong
cmdTampil.Enabled = True txtCari.Enabled = False
txtJam1.Enabled = True txtJam2.Enabled = True
txtJam1.Text = FormatMDIForm1.lblJamLogin, hh:mm txtJam2.Text = FormatTime, hh:mm
txtTgl1.Enabled = True txtTgl2.Enabled = True
txtTgl1.Text = FormatDTPicker1.Value, yyyy-mm-dd txtTgl2.Text = FormatDTPicker2.Value, yyyy-mm-dd
MsgBox Isi form tanggal dan jam lalu pilih tombol tampil, vbInformation, INFORMASI ElseIf boxKategori.Text = TANGGAL Then
229
Call frmKosong cmdTampil.Enabled = True
txtCari.Enabled = False txtJam1.Enabled = False
txtJam2.Enabled = False txtTgl1.Enabled = True
txtTgl2.Enabled = True txtTgl1.Text = FormatDTPicker1.Value, yyyy-mm-dd
txtTgl2.Text = FormatDTPicker2.Value, yyyy-mm-dd MsgBox Isi form tanggal lalu pilih tombol tampil, vbInformation, INFORMASI
Else txtCari.Enabled = True
txtJam1.Enabled = True txtJam2.Enabled = True
End If End Sub
Private Sub cmdKeluar_Click Unload Me
End Sub Private Sub cmdTampil_Click
txtTgl1.Text = FormatDTPicker1.Value, yyyy-mm-dd txtTgl2.Text = FormatDTPicker2.Value, yyyy-mm-dd
If boxKategori.Text = TANGGAL Then Jam1 = 00:00
Jam2 = 23:59 Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
detail_pengecekan where datetime BETWEEN _ txtTgl1.Text Jam1 AND txtTgl2.Text Jam2
order by datetime Adodc1.Refresh
DataGrid1.Refresh ElseIf boxKategori.Text TANGGAL Then
While boxKategori.Text = JAM Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
detail_pengecekan where datetime BETWEEN _ txtTgl1.Text txtJam1.Text AND txtTgl2.Text
txtJam2.Text order by datetime Adodc1.Refresh
DataGrid1.Refresh Exit Sub
Wend While boxKategori.Text = KODE BARANG
Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime
TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from detail_pengecekan where id_barang LIKE _
txtCari.Text AND datetime BETWEEN txtTgl1.Text
230
txtJam1.Text AND txtTgl2.Text txtJam2.Text order by datetime Adodc1.Refresh
DataGrid1.Refresh Exit Sub
Wend While boxKategori.Text = NAMA BARANG
Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime
TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from detail_pengecekan where nama_barang LIKE _
txtCari.Text AND datetime BETWEEN txtTgl1.Text txtJam1.Text AND txtTgl2.Text txtJam2.Text order by datetime
Adodc1.Refresh DataGrid1.Refresh
Exit Sub Wend
While boxKategori.Text = KEGIATAN Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
detail_pengecekan where kegiatan LIKE _ txtCari.Text AND datetime BETWEEN txtTgl1.Text
txtJam1.Text AND txtTgl2.Text txtJam2.Text order by datetime Adodc1.Refresh
DataGrid1.Refresh Exit Sub
Wend End If
End Sub Private Sub Form_Load
Call frmAwal DTPicker1.Value = FormatDate, ddMMyyyy
DTPicker2.Value = FormatDate, ddMMyyyy txtTgl1.Text = FormatDTPicker1.Value, yyyy-mm-dd
txtTgl2.Text = FormatDTPicker2.Value, yyyy-mm-dd With boxKategori
.AddItem KODE BARANG .AddItem NAMA BARANG
.AddItem KEGIATAN .AddItem TANGGAL
.AddItem JAM End With
End Sub Private Sub txtCari_Change
Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime
TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from detail_pengecekan where id_barang LIKE _
txtCari.Text order by datetime If boxKategori.Text = KODE BARANG Then
Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime
TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
231
detail_pengecekan where id_barang LIKE _ txtCari.Text order by datetime
Adodc1.Refresh DataGrid1.Refresh
ElseIf boxKategori.Text = NAMA BARANG Then Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
detail_pengecekan where nama_barang LIKE _ txtCari.Text order by datetime
Adodc1.Refresh DataGrid1.Refresh
ElseIf boxKategori.Text = KEGIATAN Then Adodc1.RecordSource = select id_barang KODE BARANG, nama_barang NAMA
BARANG, id_op ID OP,username USERNAME, kegiatan KEGIATAN, datetime TANGGAL, datetime JAM, qty QTY,sisa PERSEDIAAN, satuan SATUAN from
detail_pengecekan where kegiatan LIKE _ txtCari.Text order by datetime
Adodc1.Refresh DataGrid1.Refresh
End If End Sub
Private Sub txtCari_KeyPressKeyAscii As Integer KeyAscii = AscUCaseChrKeyAscii
End Sub Private Sub Form_UnloadCancel As Integer
Do Until Me.Top = -9000 DoEvents
Me.Move Me.Left, Me.Top - 50 DoEvents
Loop End Sub
Private Sub txtJam1_Change cmdTampil.Enabled = True
End Sub Private Sub txtJam2_change
cmdTampil.Enabled = True End Sub
Private Sub txtTgl1_change cmdTampil.Enabled = True
End Sub Private Sub txtTgl2_Change
cmdTampil.Enabled = True End Sub
M. Form Laporan Data Barang