You are on page 1of 25

LAPORAN UJIAN PRAKTIK MULTIMEDIA

MEMBUAT APLIKASI KASIR

OLEH :

FALIH ABID

GURU MATA PELAJARAN :

YUDI PERMANA W., M.Kom.


A. Tampilan

B. Penjelasan

1. Masukkan Kode Kasir dan Password dengan benar dan klik tombol Login, jika benar akan masuk
kedalam form menu utama
2. Jika Password salah akan muncul Massage Box
3. Klik tombol Cancel untuk keluar

C. Script

Sub Terbuka()

FormMenuUtama.MnMaster.Visible = True

FormMenuUtama.MnTransaksi.Visible = True

FormMenuUtama.MnLaporan.Visible = True

FormMenuUtama.MnUtility.Visible = True

FormMenuUtama.MnLogout.Visible = True

FormMenuUtama.MnLogin.Visible = False

End Sub

Private Sub Command1_Click()

Call BukaDB

RSKasir.Open "Select * From tbl_kasir where kodekasir='" & Text1 & "' and PasswordKasir='" & Text2 &
"'", Koneksi

If RSKasir.EOF Then

MsgBox "Kode Kasir dan Password Salah!"

Else
Call Terbuka

FormMenuUtama.STBar.Panels(2) = RSKasir!KodeKasir

FormMenuUtama.STBar.Panels(4) = RSKasir!NamaKasir

FormMenuUtama.STBar.Panels(6) = RSKasir!LevelKasir

Me.Hide

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Sub KondisiAwal()

Text1.MaxLength = 6

Text2.MaxLength = 30

Text2.PasswordChar = "X"

End Sub

Private Sub Form_Activate()

Text1 = ""

Text2 = ""

End Sub

Private Sub Form_Load()

Call KondisiAwal

End Sub
A. Tampilan

B. Penjelasan

1. Klik menu Master kemudian klik sub menu Kasir nanti akan masuk kedalam form kasir
2. Klik menu Master kemudian klik sub menu Pelanggan nanti akan masuk kedalam form
pelanggan
3. Klik menu Master kemudian klik sub menu Barang nanti akan masuk kedalam form
Barang
4. Klik menu Transaksi kemudian klik sub menu Penjualan nanti akan masuk kedalam form
penjualan
5. Jika ingin keluar klik menu File kemudian klik sub menu Keluar

C. Script

Private Sub Form_Load()

Call Terkunci

STBar.Panels(8) = Date$

End Sub

Sub Terkunci()

MnMaster.Visible = False

MnTransaksi.Visible = False

MnLaporan.Visible = False
MnUtility.Visible = False

MnLogout.Visible = False

MnLogin.Visible = True

End Sub

Private Sub MnBarang_Click()

FormMasterBarang.Show vbModal

End Sub

Private Sub MnKasir_Click()

FormMasterKasir.Show vbModal

End Sub

Private Sub MnKeluar_Click()

End

End Sub

Private Sub MnLogin_Click()

FormLogin.Show vbModal

End Sub

Private Sub MnLogout_Click()

Call Terkunci

FormMenuUtama.STBar.Panels(2) = ""

FormMenuUtama.STBar.Panels(4) = ""

FormMenuUtama.STBar.Panels(6) = ""

End Sub
Private Sub MnPelanggan_Click()

FormMasterPelanggan.Show vbModal

End Sub

Private Sub MnPenjualan_Click()

FormTransJual.Show vbModal

End Sub

Private Sub Timer1_Timer()

STBar.Panels(10) = Time$

End Sub

A. Tampilan
B. Penjelasan

1. Isi kode, nama, password, dan level kemudian klik tombol INPUT
2. Jika ingin mengedit cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan keisi
semua, lalu edit dan untuk menyimpannya klik tombol EDIT
3. Jika ingin menghapus cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan
keisi semua, kumudian klik tombol HAPUS
4. Jika ingin keluar klik tombol TUTUP
5. Jika salah satu kolom belum terisi kemudian diklik tombol INPUT maka akan keluar Massage Box
6. Jika berhasil menginput data nanti akan muncul Massage Box

C. Script

Private Sub Command1_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Combo1 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim TambahData As String

TambahData = "Insert into tbl_kasir values ('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Combo1 &
"')"

Koneksi.Execute TambahData

MsgBox "Input Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command2_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Combo1 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim EditData As String


EditData = "Update tbl_kasir set namakasir = '" & Text2 & "', passwordkasir = '" & Text3 & "', levelkasir =
'" & Combo1 & "' where kodekasir = '" & Text1 & "'"

Koneksi.Execute EditData

MsgBox "Edit Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command3_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Combo1 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim HapusData As String

HapusData = "Delete from tbl_kasir where kodekasir = '" & Text1 & "'"

Koneksi.Execute HapusData

MsgBox "Hapus Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command4_Click()

Unload Me

End Sub

Private Sub Form_Activate()

Call KondisiAwal

End Sub
Sub KondisiAwal()

Text1 = ""

Text2 = ""

Text3 = ""

Text3.PasswordChar = "X"

Combo1 = ""

Combo1.Clear

Combo1.AddItem "ADMIN"

Combo1.AddItem "USER"

Call BukaDB

Adodc1.ConnectionString = Koneksi

Adodc1.RecordSource = "Select kodekasir,namakasir,levelkasir from tbl_kasir"

Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1

DataGrid1.Refresh

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Call BukaDB

RSKasir.Open "Select * From tbl_kasir where kodekasir = '" & Text1 & "'", Koneksi

If RSKasir.EOF Then

MsgBox "Data tidak ada"

Else

Text1 = RSKasir!KodeKasir

Text2 = RSKasir!NamaKasir

Text3 = RSKasir!PasswordKasir

Combo1 = RSKasir!LevelKasir

End If
End If

End Sub

A. Tampilan

B.Penjelasan

1. Isi kode, nama, alamat, dan telepon kemudian klik tombol INPUT
2. Jika ingin mengedit cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan keisi
semua, lalu edit dan untuk menyimpannya klik tombol EDIT
3. Jika ingin menghapus cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan
keisi semua, kumudian klik tombol HAPUS
4. Jika ingin keluar klik tombol TUTUP
5. Jika salah satu kolom belum terisi kemudian diklik tombol INPUT maka akan keluar Massage Box
6. Jika berhasil menginput data nanti akan muncul Massage Box
C. Script

Private Sub Command1_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim TambahNilai As String

TambahNilai = "Insert into tbl_pelanggan values ('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Text4
& "')"

Koneksi.Execute TambahNilai

MsgBox "Input Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command2_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim EditData As String

EditData = "Update tbl_pelanggan set namapelanggan = '" & Text2 & "', alamatpelanggan = '" & Text3 &
"', telppelanggan = '" & Text4 & "' where kodepelanggan = '" & Text1 & "'"

Koneksi.Execute EditData

MsgBox "Edit Data Berhasil"

Form_Activate

End If
End Sub

Private Sub Command3_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim HapusData As String

HapusData = "Delete from tbl_pelanggan where kodepelanggan = '" & Text1 & "'"

Koneksi.Execute HapusData

MsgBox "Hapus Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command4_Click()

Unload Me

End Sub

Private Sub Form_Activate()

Call KondisiAwal

End Sub

Sub KondisiAwal()

Text1 = ""

Text2 = ""

Text3 = ""

Text4 = ""
Call BukaDB

Adodc1.ConnectionString = Koneksi

Adodc1.RecordSource = "Select * from tbl_pelanggan"

Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1

DataGrid1.Refresh

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Call BukaDB

RSPelanggan.Open "Select * From tbl_pelanggan where kodepelanggan = '" & Text1 & "'", Koneksi

If RSPelanggan.EOF Then

MsgBox "Data tidak ada"

Else

Text1 = RSPelanggan!KodePelanggan

Text2 = RSPelanggan!NamaPelanggan

Text3 = RSPelanggan!AlamatPelanggan

Text4 = RSPelanggan!TelpPelanggan

End If

End If

End Sub
A. Tampilan

B.Penjelasan

1. Isi kode, nama, harga, jumlah, dan satuan kemudian klik tombol INPUT
2. Jika ingin mengedit cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan keisi
semua, lalu edit dan untuk menyimpannya klik tombol EDIT
3. Jika ingin menghapus cukup masukan kode lalu klik enter pada keyboard nanti otomatis akan
keisi semua, kumudian klik tombol HAPUS
4. Jika ingin keluar klik tombol TUTUP
5. Jika salah satu kolom belum terisi kemudian diklik tombol INPUT maka akan keluar Massage Box
6. Jika berhasil menginput data nanti akan muncul Massage Box

C.Script

Private Sub Command1_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Or Text5 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim TambahNilai As String

TambahNilai = "Insert into tbl_barang values ('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Text4 &
"','" & Text5 & "')"

Koneksi.Execute TambahNilai
MsgBox "Input Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command2_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim EditData As String

EditData = "Update tbl_barang set namabarang = '" & Text2 & "', hargabarang = '" & Text3 & "',
jumlahbarang = '" & Text4 & "', satuanbarang = '" & Text5 & "' where kodebarang = '" & Text1 & "'"

Koneksi.Execute EditData

MsgBox "Edit Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command3_Click()

If Text1 = "" Or Text2 = "" Or Text3 = "" Or Text4 = "" Then

MsgBox "Silahkan isi data terlebih dahulu!"

Else

Call BukaDB

Dim HapusData As String

HapusData = "Delete from tbl_barang where kodebarang = '" & Text1 & "'"

Koneksi.Execute HapusData
MsgBox "Hapus Data Berhasil"

Form_Activate

End If

End Sub

Private Sub Command4_Click()

Unload Me

End Sub

Private Sub Form_Activate()

aCall KondisiAwal

End Sub

Sub KondisiAwal()

Text1 = ""

Text2 = ""

Text3 = ""

Text4 = ""

Text5 = ""

Call BukaDB

Adodc1.ConnectionString = Koneksi

Adodc1.RecordSource = "Select * from tbl_barang"

Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1

DataGrid1.Refresh

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then

Call BukaDB

RSBarang.Open "Select * From tbl_barang where kodebarang = '" & Text1 & "'", Koneksi

If RSBarang.EOF Then

MsgBox "Data tidak ada"

Else

Text1 = RSBarang!Kodebarang

Text2 = RSBarang!Namabarang

Text3 = RSBarang!Hargabarang

Text4 = RSBarang!JumlahBarang

Text5 = RSBarang!satuanbarang

End If

End If

End Sub

A. Tampilan
B. Penjelasan

1. Pilih kode pelanggan


2. Ketikkan kode barang pada tabel kode, lalu klik enter dan otomatis akan keisi semua
3. Ketikkan jumlah uang yang ingin dibayarkan lalu klik enter, kemudian otomatis kolom kembali
akan terisi jika uangnya lebih
4. Klik Simpan untuk menyimpan data
5. Klik Batal jika ingin keluar

C. Script

Sub NoOtomatis()

Call BukaDB

RSJual.Open ("Select * From tbl_jual where NoJual in(select(NoJual) from tbl_Jual) order by NoJual
desc"), Koneksi

RSJual.Requery

Dim Urutan As String * 12

Dim Hitung As Long

With RSJual

If .EOF Then

Urutan = "J" + "000000000001"

LBLNoJual = Urutan

Else

Hitung = Right(RSJual!NoJual, 11) + 1

Urutan = "J" + Right("00000000000" & Hitung, 11)

End If

LBLNoJual = Urutan

End With

End Sub

Private Sub Combo1_Click()

Call BukaDB

RSPelanggan.Open "Select * From TBL_Pelanggan where kodepelanggan= '" & Combo1 & "'", Koneksi

If Not RSPelanggan.EOF Then


LBLNama = RSPelanggan!NamaPelanggan

LBLAlamat = RSPelanggan!AlamatPelanggan

LBLTelp = RSPelanggan!TelpPelanggan

End If

Koneksi.Close

End Sub

Private Sub Command1_Click()

Dim TglSQL As String

TglSQL = Format(Date, "yyyy-MM-dd")

If LBLTotal = "" Or LBLKembali = "" Or LBLItem = "" Then

MsgBox "TRansaksi Tidak Ada, Silahkan Lakukan Transaksi Terlebih Dahulu"

Else

Call BukaDB

Dim SOLTambahJual As String

SOLTambahJual = "Insert into


TBL_JUAL(NoJual,TglJual,JamJual,ItemJual,TotalJual,Dibayar,Kembali,KodePelanggan,KodeKasir)" & _

"values('" & LBLNoJual & "','" & TglSQL & "','" & LBLJam & "','" & LBLItem & "','" & LBLTotal & "','" &
Text1 & "','" & LBLKembali & "','" & Combo1 & "','" & FormMenuUtama.STBar.Panels(2) & "')"

Koneksi.Execute (SQLTambahJual)

Adodc1.Recordset.MoveFirst

Do While Not Adodc1.Recordset.EOF

Call BukaDB

If Adodc1.Recordset!kode <> vbNullString Then

Call BukaDB

Dim SOLTambahDetail As String


SOLTambahDetail = "Insert into
TBL_DETAILJUAL(NoJual,kodebarang,namabarang,hargajual,jumlahjual,subtotal)" & _

"values('" & LBLNoJual & "','" & Adodc1.Recordset!kode & "','" & Adodc1.Recordset!nama & "','" &
Adodc1.Recordset!Harga & "','" & Adodc1.Recordset!jumlah & "','" & Adodc1.Recordset!total & "')"

Koneksi.Execute (SQLTambahDetailJual)

End If

Adodc1.Recordset.MoveNext

Loop

MsgBox "Transaksi Jual Telah Berhasil"

Call KondisiAwal

End If

End Sub

Private Sub Command2_Click()

End

End Sub

Private Sub DataGrid1_AfterColEdit(ByVal ColIndex As Integer)

If DataGrid1.Col = 1 Then

If Combo1 = "" Then

Combo1.SetFocus

MsgBox "Isi Kode Pelanggan Dulu Yaa"

Exit Sub

Else

If Len(Adodc1.Recordset!kode) < 6 Then

MsgBox "Kode Harus 6 Digit"

DataGrid1.Col = 1

Exit Sub

End If
End If

Call BukaDB

RSBarang.Open "Select * From TBL_Barang where kodebarang = '" & Adodc1.Recordset!kode & "',
Koneksi "

If RSBarang.EOF Then

MsgBox "Kode Barang Tidak Ada"

Exit Sub

Else

Call BukaDB

Dim RSBarang1 As ADODB.Recordset

SetRSBarang1 = New ADODB.Recordset

RSBarang1.Open "Select * From TBL_Barang where kodebarang = '" & Adodc1.Recordset!kode & "',
Koneksi "

If Not RSBarang1.EOF Then

Adodc1.Recordset!kode = RSBarang1!Kodebarang

Adodc1.Recordset!nama = RSBarang1!Namabarang

Adodc1.Recordset!Harga = RSBarang1!Hargabarang

DataGrid1.Col = 4

DataGrid1.Refresh

End If

Exit Sub

End If

End If

If DataGrid1.Col = 4 Then

Call BukaDB

RSBarang.Open "Select * From TBL_Barang where kodebarang = '" & Adodc1.Recordset!kode & "',
Koneksi "

If Not RSBarang.EOF Then

If RSBarang!JumlahBarang < Adodc1.Recordset!jumlah Then

MsgBox "Stock Barang Tidak Mencukupi"


Adodc1.Recordset!jumlah = 1

Exit Sub

End If

End If

Adodc1.Recordset!jumlah = Adodc1.Recordset!jumlah

Adodc1.Recordset!total = Adodc1.Recordset!Harga * Adodc1.Recordset!jumlah

Adodc1.Recordset.Update

Call Tambah_baris

Adodc1.Recordset.MoveNext

DataGrid1.Col = 1

Adodc1.Recordset.MoveLast

LBLTotal = TotalHarga

LBLItem = TotalItem

End If

End Sub

Private Sub Form_Load()

Call KondisiAwal

'Tanggal

LBLTgl = Date

LBLNamaKasir = FormMenuUtama.STBar.Panels(4).Text

End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

If Text1 = "" Or Val(Text1) < Val(LBLTotal) Then

MsgBox "Pembayaran Kurang"

Else

If Val(Text1) = Val(LBLTotal) Then

LBLKembali = Text1 - LBLTotal

Else

LBLKembali = Val(Text1) - Val(LBLTotal)

End If

End If

End If

End Sub

Private Sub Timer1_Timer()

LBLJam = Time$

End Sub

Function Tabel_kosong()

Adodc1.Recordset.MoveFirst

Do While Not Adodc1.Recordset.EOF

Adodc1.Recordset.Delete

Adodc1.Recordset.MoveNext

Loop

For i = 1 To 1

Adodc1.Recordset.AddNew

Adodc1.Recordset!No = i

Adodc1.Recordset.Update
Next i

DataGrid1.Col = 1

End Function

Sub KondisiAwal()

LBLTotal = "0"

LBLNama = "0"

LBLAlamat = "0"

LBLTelp = "0"

Combo1 = ""

Text1 = ""

LBLKembali = ""

LBLTotal = ""

LBLItem = ""

Call NoOtomatis

Call BukaDB

RSPelanggan.Open "Select * From TBL_Pelanggan", Koneksi

Combo1.Clear

Do Until RSPelanggan.EOF

Combo1.AddItem RSPelanggan!KodePelanggan

RSPelanggan.MoveNext

Loop

Adodc1.ConnectionString = Koneksi

Adodc1.RecordSource = "TBL_TRANSJUAL"

Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1

DataGrid1.Refresh

'Panggil Tabel Kosong


Call Tabel_kosong

End Sub

Function Tambah_baris()

For i = Adodc1.Recordset.RecordCount To Adodc1.Recordset.RecordCount

Adodc1.Recordset.AddNew

Adodc1.Recordset!No = i + 1

Adodc1.Recordset.Update

Next i

End Function

Function TotalHarga()

Set TtlHarga = New ADODB.Recordset

TtlHarga.Open "Select sum(total) as JumTotal from TBL_TRANSJUAL", Koneksi

TotalHarga = TtlHarga!JumTotal

LBLTotal = TotalHarga

End Function

Function TotalItem()

Set TTLItem = New ADODB.Recordset

TTLItem.Open "Select Sum(Jumlah) as JumItem from tbl_TransJual", Koneksi

TotalItem = TTLItem!JumItem

End Function

You might also like