Announcement:

Hi, iam Arifin. I don't have Much to Say. This's just a Place for a notes of my study

Rabu, 12 Oktober 2016

Visual Basic | Program Penyewaan Mobil

rogramer:
1.Arifin s.
2.Jimy Utama


1.      Form Loading
Form loading adalah tampilan proses tunggu sebelum masuk pada program
Pada kasus ini kami menggunakan timer dengan interval 20
Berikut listing programnya;
Private Sub Timer1_Timer() Static ictr As Integer If ictr <= 100 Then ProgressBar1.Value = ictr ictr = ictr + 1 Else If ProgressBar1.Max = 100 Then Call Form_Login.Show Unload Me End If End If End Sub



2.      Form Login
Form loging adalah proses masuk pada program dengan menggunakan username dan password sebagai input yang telah tersimpan di database.
Berikut listing programnya:
Private Sub cmdcancel_Click() Unload Me End Sub Private Sub cmdlogin_Click() Set rslog = New ADODB.Recordset rslog.LockType = adLockOptimistic rslog.CursorType = adOpenDynamic rslog.Open "select * from Tb_Admin", Conn, , , adCmdText If rslog.RecordCount > 0 Then rslog.MoveFirst rslog.Find "Username ='" & txtusername.Text & "'" rslog.Find "Password ='" & txtpassword.Text & "'" If rslog.AbsolutePosition <> adPosEOF Then Call Form_Home.Show Unload Me MsgBox "Selamat... Login Berhasil", vbOKOnly, "Info" Else MsgBox "user / Password Yang Anda Masukkan Salah", vbOKOnly, "Info" Call Bersih End If End If End Sub Private Sub Form_Load() koneksi End Sub Sub Bersih() txtusername.Text = "" txtpassword.Text = "" End Sub


3.      Form Menu Utama
Form menu utama menampilkan pilihan menu program yang bisa dijalankan
Berikut listing programnya:
Private Sub cmdclose_Click() If MsgBox("APAKAH ANDA YAKIN INGIN MENUTUP APLIKASI INI...?", vbYesNo + vbQuestion, "KONFIRMASI") = vbNo Then Cancel = 1 Else End End If End Sub Private Sub Form_Load() WindowsMediaPlayer1.URL = App.Path & "\Lagu.mp3" End Sub Private Sub mnukeluar_Click() If MsgBox("APAKAH ANDA YAKIN INGIN MENUTUP APLIKASI INI...?", vbYesNo + vbQuestion, "KONFIRMASI") = vbNo Then Cancel = 1 Else End End If End Sub Private Sub mnulapmember_Click() End Sub Private Sub MnuMember_Click() Call Form_Member.Show Form_Home.Enabled = True End Sub Private Sub mnulapelanggan_Click() Call DataReport2.Show End Sub Private Sub mnulapmobil_Click() Call DataReport3.Show End Sub Private Sub mnulaptransaksi_Click() Call DataReport1.Show End Sub Private Sub MnuMobil_Click() Call Form_Mobil.Show Form_Home.Enabled = True End Sub Private Sub MnuPelanggan_Click() Call Form_Member.Show End Sub Private Sub mnupeminjaman_Click() Call Form_Peminjaman.Show Form_Home.Enabled = True End Sub Private Sub mnupengembalian_Click() Call Form_Pengembalian.Show Form_Home.Enabled = True End Sub Private Sub mnuprojek_Click() Call Form_Project.Show Form_Home.Enabled = True End Sub Private Sub Picture1_Click() If MsgBox("APAKAH ANDA YAKIN INGIN MENUTUP APLIKASI INI...?", vbYesNo + vbQuestion, "KONFIRMASI") = vbNo Then Cancel = 1 Else End End If End Sub Private Sub Timer1_Timer(Index As Integer) Label3.ForeColor = RGB(Rnd * 250, Rnd * 250, Rnd * 250) If (Label3.RightToLeft + Label3.Width) <= 0 Then Label3.RightToLeft = Me.Width End If Label3.RightToLeft = Label3.RightToLeft - 100 End Sub Private Sub Timer2_Timer() windowsplayer1.Control.play End Sub

4.      Form Master Data Pelanggan
Form master data pelanggan digunakan untuk mengolah atau memproses data pelanggan. 
----------------------------------------------------------------------
Data input yang dugunakan;
Kode pelanggan, NIK, Nama Pelanggan, Jenis Kelamin,Alamat,RT/RW,Desa/Kelurahan,Kecamatan, Agama, Pekerjaan, Kewarganegaraan No.Telp.
Berikut listing programnya:
Private Sub cmdadd_Click() Call Hidup Call Bersih cmdsave.Enabled = True cmdadd.Enabled = False cmdcancel.Enabled = True txtkd.SetFocus End Sub Sub Tampil() With Adomember.Recordset txtkd.Text = !KodePelanggan txtnik.Text = !NIK txtnm.Text = !NamaPelanggan txtttl.Text = !TTL txtjk.Text = !JenisKelamin txtalmt.Text = !Alamat txtrtw.Text = !RT_RW txtdesa.Text = !Desa_Kel txtkec.Text = !Kecamatan txtagama.Text = !Agama txtpekerjaan.Text = !Pekerjaan txtwarga.Text = !Kewarganeraan txtnotelp.Text = !NoTelp End With End Sub Sub Bersih() txtkd.Text = "" txtnik = "" txtnm.Text = "" txtttl.Text = "" txtjk.Text = "" txtalmt.Text = "" txtrtw.Text = "" txtdesa.Text = "" txtkec.Text = "" txtagama.Text = "" txtpekerjaan.Text = "" txtwarga.Text = "" txtnotelp = "" End Sub Sub Mati() txtkd.Enabled = False txtnik.Enabled = False txtnm.Enabled = False txtttl.Enabled = False txtjk.Enabled = False txtalmt.Enabled = False txtrtw.Enabled = False txtdesa.Enabled = False txtkec.Enabled = False txtagama.Enabled = False txtpekerjaan.Enabled = False txtwarga.Enabled = False txtnotelp.Enabled = False End Sub Sub Hidup() txtkd.Enabled = True txtnik.Enabled = True txtnm.Enabled = True txtttl.Enabled = True txtjk.Enabled = True txtalmt.Enabled = True txtrtw.Enabled = True txtdesa.Enabled = True txtkec.Enabled = True txtagama.Enabled = True txtpekerjaan.Enabled = True txtwarga.Enabled = True txtnotelp.Enabled = True End Sub Private Sub Cmdback_Click() Call Form_Home.Show Unload Me End Sub Private Sub cmdcancel_Click() Call Bersih Call Mati cmdcancel.Enabled = False cmdadd.Enabled = True cmdsave.Enabled = False cmddelete.Enabled = True End Sub Private Sub cmdcari_Click() Adomember.Recordset.Resync Adomember.Recordset.Find "KodePelanggan='" & Me.txtcari.Text & "'", , adSearchForward If Not Adomember.Recordset.EOF Then Call Tampil Call Mati cmdedit.Enabled = True cmdsave.Enabled = False cmdcancel.Enabled = False txtkd.Enabled = False txtcari.Text = "" Else MsgBox "Kode Pelanggan tidak ada", vbInformation, "info" txtcari.Text = "" End If End Sub Private Sub cmddelete_Click() a = MsgBox("Yakin Akan Menghapus ???", vbYesNo + vbInformation, "Konfirmasi") If a = vbYes Then Adomember.Recordset.Delete Call Mati Call Bersih End If End Sub Private Sub Command1_Click() End Sub Private Sub cmdedit_Click() Call Hidup txtkd.Enabled = False cmdsave.Enabled = True cmdedit.Enabled = False cmdcancel.Enabled = True cmddelete.Enabled = False End Sub Private Sub cmdsave_Click() With Adomember.Recordset Adomember.Recordset.Find "KodePelanggan='" & Me.txtkd.Text & "'", , adSearchForward, 1 If Adomember.Recordset.EOF Then .AddNew !KodePelanggan = txtkd.Text !NIK = txtnik.Text !NamaPelanggan = txtnm.Text !TTL = txtttl.Text !JenisKelamin = txtjk.Text !Alamat = txtalmt.Text !RT_RW = txtrtw.Text !Desa_Kel = txtdesa.Text !Kecamatan = txtkec.Text !Agama = txtagama.Text !Pekerjaan = txtpekerjaan.Text !Kewarganeraan = txtwarga.Text !NoTelp = txtnotelp.Text .Update MsgBox "Data Pelanggan Berhasil Di Simpan", vbOKOnly, "Informasi" Else !KodePelanggan = txtkd.Text !NIK = txtnik.Text !NamaPelanggan = txtnm.Text !TTL = txtttl.Text !JenisKelamin = txtjk.Text !Alamat = txtalmt.Text !RT_RW = txtrtw.Text !Desa_Kel = txtdesa.Text !Kecamatan = txtkec.Text !Agama = txtagama.Text !Pekerjaan = txtpekerjaan.Text !Kewarganeraan = txtwarga.Text !NoTelp = txtnotelp.Text .Update End If End With Call Mati Call Bersih cmdsave.Enabled = False cmdadd.Enabled = True cmddelete.Enabled = True cmdcancel.Enabled = False End Sub Private Sub Form_Load() End Sub

5.      Form Master Data Mobil
Form master data mobil adalah form yang digunakan untuk memproses data mobil
----------------------------------------------------------------
Input data pada form ini meliputi;
Kodde Mobil, Nama Mobil,Warna, Jenis, Tahun Rilis,Nomor Mesin,NOmor Rangka,Nomor STNK, Nomor Plat, Harga
Berikut listing programnya?
Private Sub cmdadd_Click() Call Hidup Call Bersih cmdsave.Enabled = True cmdadd.Enabled = False cmdcancel.Enabled = True txtkode.SetFocus End Sub Sub Tampil() With Adomobil.Recordset txtkode.Text = !KodeMobil txtnama.Text = !NamaMobil txtwarna.Text = !warna txtjenis.Text = !Jenis txtrilis.Text = !TahunRilis txtnomesin.Text = !NomorMesin txtnorangka.Text = !NomorRangka txtnostnk.Text = !NomorSTNK txtnoplat.Text = !NomorPlat txtharga.Text = !Harga End With End Sub Sub Bersih() txtkode.Text = "" txtnama.Text = "" txtwarna.Text = "" txtjenis.Text = "" txtrilis.Text = "" txtnomesin.Text = "" txtnorangka.Text = "" txtnostnk.Text = "" txtnoplat.Text = "" txtharga.Text = "" End Sub Sub Mati() txtkode.Enabled = False txtnama.Enabled = False txtwarna.Enabled = False txtjenis.Enabled = False txtrilis.Enabled = False txtnomesin.Enabled = False txtnorangka.Enabled = False txtnostnk.Enabled = False txtnoplat.Enabled = False txtharga.Enabled = False End Sub Sub Hidup() txtkode.Enabled = True txtnama.Enabled = True txtwarna.Enabled = True txtjenis.Enabled = True txtrilis.Enabled = True txtnomesin.Enabled = True txtnorangka.Enabled = True txtnostnk.Enabled = True txtnoplat.Enabled = True txtharga.Enabled = True End Sub Private Sub Cmdback_Click() Call Form_Home.Show Unload Me End Sub Private Sub cmdcancel_Click() Call Bersih Call Mati cmdcancel.Enabled = False cmdadd.Enabled = True cmdsave.Enabled = False cmddelete.Enabled = True End Sub Private Sub cmdcari_Click() Adomobil.Recordset.Find "KodeMobil='" & Me.txtcari.Text& '"",,adserchforward If Not Adomobil.Recordset.EOF Then Call Tampil Call Mati cmdadd.Enabled = False cmdedit.Enabled = True cmdsave.Enabled = False txtkode.Enabled = False txtcari.Text = "" Else MsgBox "Kode Mobil Tidak Ada", vbInformation, "info" txtcari.Text = "" End If End Sub End If End Sub Private Sub cmddelete_Click() a = MsgBox("Yakin Akan Menghapus ???", vbYesNo + vbInformation, "Konfirmasi") If a = vbYes Then Adomobil.Recordset.Delete Call Mati Call Bersih End If End Sub Private Sub Command1_Click() End Sub Private Sub cmdedit_Click() Call Hidup txtkode.Enabled = False cmdsave.Enabled = True cmdedit.Enabled = False cmdcancel.Enabled = True cmddelete.Enabled = False End Sub Private Sub cmdfind_Click() Adomobil.Recordset.Find "KodeMobil='" & Me.txtcari.Text & "'", , adSearchForward If Not Adomobil.Recordset.EOF Then Call Tampil Call Mati cmdadd.Enabled = False cmdedit.Enabled = True cmdsave.Enabled = False txtkode.Enabled = False txtcari.Text = "" Else MsgBox "Kode Mobil Tidak Ada", vbInformation, "info" End If End Sub Private Sub cmdsave_Click() With Adomobil.Recordset Adomobil.Recordset.Find "KodeMobil='" & Me.txtkode.Text & "'", , adSearchForward, 1 If Adomobil.Recordset.EOF Then .AddNew !KodeMobil = txtkode.Text !NamaMobil = txtnama.Text !warna = txtwarna.Text !Jenis = txtjenis.Text !TahunRilis = txtrilis.Text !NomorMesin = txtnomesin.Text !NomorRangka = txtnorangka.Text !NomorSTNK = txtnostnk.Text !NomorPlat = txtnoplat.Text !Harga = txtharga.Text .Update MsgBox "Data Mobil Berhasil Di Simpan", vbOKOnly, "Informasi" Else !KodeMobil = txtkode.Text !NamaMobil = txtnama.Text !warna = txtwarna.Text !Jenis = txtjenis.Text !TahunRilis = txtrilis.Text !NomorMesin = txtnomesin.Text !NomorRangka = txtnorangka.Text !NomorSTNK = txtnostnk.Text !NomorPlat = txtnoplat.Text !Harga = txtharga.Text .Update End If End With Call Mati Call Bersih cmdsave.Enabled = False cmdadd.Enabled = True cmddelete.Enabled = True cmdcancel.Enabled = False End Sub Private Sub Form_Load() End Sub Private Sub txtnoplat_Change() End Sub

6.      Form Transaksi peminjaman
Form transaksi peminjaman berisi aktifitas proses peminjaman.
--------------------------------------------
Input data pada form ini meliputi;
Kode Transaksi, Kode Pelanggan, Nama Pelanggan, Kode Mobil, Nama Mobil, Lama Sewa, Harga Sewa, Total Biaya.
Berikut listing programnya?
Private Sub txtjam_Change() End Sub Private Sub txttgl_Change() End Sub Private Sub cmdcari_Click() End Sub Private Sub cmdclose_Click() Call Form_Home.Show Unload Me End Sub Private Sub cmdsave_Click() With Adotrans.Recordset .AddNew !KodeTransaksi = txtkdtransaksi.Text !KodePelanggan = txtkdpelanggan.Text !NamaPelanggan = txtnmpelanggan.Text !KodeMobil = txtkdmobil.Text !NamaMobil = txtnmmobil.Text !TanggalPeminjaman = Format(Date) !LamaSewa = txtsewa.Text !HargaSewa = txtharga.Text !TotalBiaya = txttotal.Text .Update End With MsgBox " Data Tersimpan", vbInformation, "Info" txtkdtransaksi.Text = "": txtkdpelanggan.Text = "": txtnmpelanggan.Text = "": txtkdmobil.Text = "": txtnmmobil.Text = "": pinjam = "": txtsewa.Text = "": txtharga.Text = "": txttotal.Text = "": End Sub Private Sub Command1_Click() txttotal.Text = Val(txtsewa.Text * txtharga.Text) End Sub Private Sub Command3_Click() End Sub Private Sub Command2_Click() End Sub Private Sub Form_Load() End Sub Private Sub Timer1_Timer() Tanggal.Text = Date Jam.Text = Time End Sub Private Sub txtkdmember_Click() Call Form_Member.Show End Sub Private Sub txtkdmobil_Click() Call Form_DgMobil.Show End Sub Private Sub txtkdpelanggan_Click() Call Form_DgPelanggan.Show End Sub

7.      Form Transaksi Pengembalian
Form transaksi pengembalian berisi aktifitas proses pengembalian.
----------------------------------------------


Input data pada form ini meliputi:
No.Transaksi, Kode Pelanggan, Nama Pelanggan, Kode Mobil, Nama Mobil, Tanggal Peminjaman, Tanggal Pengembalilan, Harga, Lama Sewa, Denda, Total Bayar.
Berikut listing programnya?
Dim Conn As New ADODB.Connection Dim rsTRANSAKSI As ADODB.Recordset Dim RSqTransaksi As ADODB.Recordset Private Sub Text10_Change() End Sub Private Sub Text2_Change() End Sub Private Sub Text5_Change() End Sub Private Sub cmbdenda_Click() Select Case cmbdenda Case "TELAT" txtdenda.Text = 5000000 Case "RUSAK" txtdenda.Text = 10000000 Case "TELAT + RUSAK" txtdenda.Text = 25000000 End Select End Sub Private Sub Command1_Click() Call Form_Transaksi.Show End Sub Private Sub Command3_Click() End Sub Private Sub cmddelete_Click() End Sub Private Sub cmdclose_Click() Call Form_Home.Show Unload Me End Sub Private Sub cmdfind_Click() Call Form_Transaksi.Show End Sub Private Sub cmdproses_Click() txttotal.Text = (Val(txtharga.Text) * Val(txtsewa.Text)) + Val(txtdenda.Text) End Sub Private Sub cmdsave_Click() With Adodc1.Recordset Adodc1.Recordset.Find "KodeTransaksi='" & Me.txtnotrans.Text & "'", , adSearchForward, 1 If Adodc1.Recordset.EOF Then .AddNew !KodeTransaksi = txtnotrans.Text !KodePelanggan = txtkdpelanggan.Text !NamaPelanggan = txtnmpelanggan.Text !KodeMobil = txtkdmobil.Text !NamaMobil = txtnmmobil.Text !TanggalPeminjaman = txtpinjam.Text !TanggalPengembalian = Format(Date) !LamaSewa = txtsewa.Text !HargaSewa = txtharga.Text !TotalBiaya = txttotal.Text .Update txtkdtransaksi.Text = "": txtkdpelanggan.Text = "": txtnmpelanggan.Text = "": txtkdmobil.Text = "": txtnmmobil.Text = "": txtpinjam.Text = "": txtsewa.Text = "": txtharga.Text = "": txttotal.Text = "": txtdenda.Text = "": Kembali = "" End If End With MsgBox " Data Tersimpan", VbOk0nly, "INFO" End Sub Private Sub JAM_Change() Jam = Time End Sub Private Sub Tanggal_Change() Tanggal = Date End Sub Private Sub Timer1_Timer() Tanggal.Text = Date Jam.Text = Time txtkembali.Text = Format(Date) End Sub Private Sub txtkdmobil_Click() Call Form_DgMobil.Show End Sub Private Sub txtkdpelanggan_Click() Call Form_DgPelanggan.Show End Sub Private Sub Kembali_Click() Kembali = Format(Date) End Sub Private Sub Form_Load() koneksi End Sub

Setelah desain form diats di butuhkan juga sebuah module,
Fungsi Module sendiri adalah sebagi berikut :

Untuk menyimpan procedure-prosedure atau fungsi-fungsi atau variable-variable yang digunakan secara global oleh alplikasi yang akan kita buat, sehingga kita tidak perlu membuat fungsi-fungsi atau procedur-prosedure atau variable-variable tersebut secara berulang-ulang, dan akan lebih memudahkan kita dalam penggunaannya.

Dengan penjelasan diatas maka penulisan coding akan menjadi ringkas, dan kita bisa memanggilnya di Module tersebut.
berikut listing module pada program ini;

Global Conn As ADODB.Connection Global rslog As ADODB.Recordset Option Explicit Public Const LWA_COLORKEY = 1 Public Const LWA_ALPHA = 2 Public Const LWA_BOTH = 3 Public Const WS_EX_LAYERED = &H80000 Public Const GWL_EXSTYLE = -20 Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal warna As Long, ByVal x As Byte, ByVal Alpha As Long) As Boolean Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Sub koneksi() Set Conn = New ADODB.Connection Conn.Provider = "microsoft.jet.oledb.4.0" Conn.CursorLocation = adUseClient Conn.Open App.Path & "\db_Project_Rental.mdb" Exit Sub gagal: If (Err.Number = -2147467259) Then MsgBox "Koneksi Aplikasi Ke Database Gagal...!", vbCritical, "Informasi" End End If End Sub
Berikutnya adalah....
Data Environment, yaitu fasilitas yang disediakan Microsoft Visual Basic 6.0 yang digunakan media penghubung program yang di buat dengan database, biasanya dalam program digunakan untuk membuat laporan.
berikut D.E pada program ini;

Data Report
Seperti yang kita tahu bahwa sebuah report itu sangat membantu dalam menampilkan sebuah rangkuman atau laporan data.Data report pada Visual Basic 6 merupakan pelengkap VB untuk membuat laporan. 
Secara umum langkah dalam pembuatan laporan dengan data report adalah membuat sebuah Data Environment, kemudian membuat DataReport, serta menghubungkan DataReport denganData Environment melalui properti DataSource dan DataMember, lalu membuat perintah menampilkan DataReport
Berikut data report program ini:






Share it Please

arifin

Bukan pengarang buku. Ngarang

0 komentar:

Posting Komentar

Copyright @ 2016 e-notes.pro. | suport by The Globe Press