EBOOK PANDUAN PEMROGRAMAN VISUAL BASIC                        “PEMBUATAN APLICATION PENJUALAN TIKET KAPAL”                ...
PENGATURAN PROPERTIES ALL FORM      Objek               Properties                       Keterangan Form                Na...
2. Penulisan Listing – FrmbytiketModul1 – Modul1Public Koneksi As New ADODB.ConnectionPublic Rsbytiket As New ADODB.Record...
Listing FrmbytiketPublic Ada1, Valid As BooleanDim RsTampil As New ADODB.RecordsetPrivate Sub Form_Activate()frmmenuutama....
xpbatal_Click  Exit SubEnd IfValidasiIf Valid = True Then   If Ada1 = False Then      Rsbytiket.AddNew      isitblbytarif ...
kosongtdkaktiftxtjnstiket.Enabled = Truetxtjnstiket.SetFocusxpsimpan.Caption = "&Tambah"tutuptombolEnd SubPrivate Sub xped...
Rsbytiket.MoveFirstEnd IfSet Rsbytiket = NothingRsbytiket.Open "[tblbytiket] where jnstiket =" & ckode & "", Koneksi, adOp...
Private Sub Form_Load()BukaDatabasetdkaktifTampildataxpsimpan.Caption = "&Tambah"tutuptombolSet rscari = Nothingrscari.Ope...
End IfRsnotempat.RequeryTampildataEnd SubPrivate Sub xphapus_Click()ckode = Trim(txtnot4.Text)Rsbeli.Find ("no4=" & ckode ...
txtjml.Text = RsTampil.RecordCountElse  Grid1.Caption = "ga ada tu datanya "  txtjml.Text = RsTampil.RecordCountEnd IfEnd ...
cek                           Form Entry Pesan Tempat – Frmpesant4                                                  dccek ...
Set rscari = Nothing  rscari.Open "Select no4 from tblpesant4 where nama=" & dccek & "and status=Pesan and tglpesan = #"& ...
End SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub tdkaktif()txtnotelp.Enabled = False: cbod...
End IfEnd SubPrivate Sub cbodari_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then  SendKeys vbTa...
Else       Rspesant4.AddNew       Rspesant4!no4 = List1.Text       Rspesant4!tglpesan = dtptglpesan       Rspesant4!nama =...
Form Penjualan Tiket - Frmjualtiket    Txtnot4                                                                            ...
tdkaktifedit.Visible = Falsedtptgljual = Datedtptgljual_LostFocuscbojnskel.List(0) = "Laki-laki"cbojnskel.List(1) = "Perem...
If Rspesant4.RecordCount > 0 Then    Rspesant4.MoveFirst  End If  Set Rspesant4 = Nothing  Rspesant4.Open "[tblpesant4] wh...
txtnama.Enabled = True  txtnama.SetFocus  Ada1 = False  xpsimpan.Enabled = True  End If  End IfEnd IfEnd SubPrivate Sub xp...
End SubPrivate Sub txtnama_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then  SendKeys vbTab  akt...
End If   If KeyCode = vbKeyReturn Then        SendKeys vbTab   End IfElse   If KeyCode = vbKeyF1 Then     txtnot4.Text = "...
Rsbytiket.Open "[tblbytiket] where jnstiket =" & jns & "", Koneksi, adOpenDynamic,adLockOptimistic      If Not Rsbytiket.E...
If Not Rsnotempat.EOF Then      ll = Rsnotempat!jnstiket    End If      If cbopenumpang.Text = "Dewasa" Then          Set ...
Exit Sub   ElseIf cbotujuan.Text = Empty Then     MsgBox "tujuan keberangkatan tidak boleh kosong!", 0 + 64, "Konfirmasi" ...
If Rsnotempat.RecordCount > 0 Then    tjml = Rsnotempat.RecordCount     Rsnotempat.MoveFirst      Do While Not Rsnotempat....
Form Info – FrmInfo                                                                                                       ...
Desain Tiket pada Cystal ReportHasil Ketika pencetakkan :-----------------------------------------------------------------...
DTPTgl2_LostFocusxpcetak.Enabled = FalseEnd SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub d...
If dtptgl1 = dtptgl2 Then        tt = Format(dtptgl1)      Else        tt = Format(dtptgl1) + " s/d " + Format(dtptgl2)   ...
If RsTampil.RecordCount > 0 Then   Grid1.Enabled = True   xpcetak.Enabled = True   Grid1.Caption = "Penumpang Yg Batal Ber...
xpkeluar.SetFocusEnd IfEnd SubPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load()BukaDat...
Else     Grid1.Caption = "ga ada tu datanya "     Grid1.Enabled = False     xpubah.Enabled = False   End IfEnd IfEnd SubPr...
Else  MsgBox "Hak akses terbuka!", , "Konfirmasi"  edit.Visible = False  aktif  cbostatus.SetFocus  Ada1 = TrueEnd IfEnd S...
frmmenuutama.Enabled = TrueEnd SubPrivate Sub CmdSimpan_Click()   IsiTabel   CmdBatal_ClickEnd SubPrivate Sub Form_Activat...
Menu dan Sub Menu                                                                                                         ...
Private Sub mnpen_Click()frmcetakpen.ShowEnd SubPrivate Sub mnpesantiket_Click()frmpesant4.ShowEnd SubPrivate Sub mntiket_...
End SubPrivate Sub TxtNamap_GotFocus()  TxtNamap.SelStart = 0  TxtNamap.SelLength = Len(TxtNamap)End SubPrivate Sub TxtNam...
Untuk pembuatan Database dapat anda gunakan Ms. Access, seperti tampilan gambar berikut ini :Jika direlasikan, maka akan m...
PROSES LAYANAN PENJUALAN TIKET KAPAL DELLSA SECARA UMUM                                                                MUL...
Upcoming SlideShare
Loading in …5
×

Ebook Pembuatan Aplikasi tiket kapal 2012

1,901 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,901
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
243
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Ebook Pembuatan Aplikasi tiket kapal 2012

  1. 1. EBOOK PANDUAN PEMROGRAMAN VISUAL BASIC “PEMBUATAN APLICATION PENJUALAN TIKET KAPAL” Oleh : Yanto Naim Email : infoitbangkep@gmail.com Web : www.itbangkep.wordpress.comPetunjuk : 1. Untuk membuat program ini, di computer anda harus terinstal : a. Visual Basic 6.0 b. Crystal Report 8.5 c. Componen tambahan : XpButton dan Icon Perintah. d. Disarankan system operasi yang digunakan adalah Windows XP. 2. Buat database dengan nama dbstiket_kapal (databasenya ada di hal. 37 - 38). 3. Jalankan Visual Basic, dan tambahkan komponen-komponen sebagai berikut : a. Crystal Report Control b. Microsoft Ado Data Control 6.0 (OLEDB) c. Microsoft Common Dialog Control 6.0 d. Microsoft Data Bound List Control 6.0 e. Microsoft DataGrid Control 6.0 (OLEDB) f. Microsoft DataList Control 6.0 (OLEDB) g. Microsoft Windows Common Control 6.0 (SP6) h. Microsoft Windows Common Control-2 6.0 (SP4) i. ucXPButtonTampilan Microsoft Visual Basic Menu Utama Form Aktif Form Properties Form Komponen Pengetikan ListingTampilan Cystal Report 8.5 Menu Utama Report Header Report Footer Page Header Database & Detail Componen Crystal Page FooterEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 1
  2. 2. PENGATURAN PROPERTIES ALL FORM Objek Properties Keterangan Form Name Nama form BackColor Warna baground form BorderStyle Bingkai form Caption Judul form Icon Icon form MaxButton True, False MinButton True, False Picture Gambar baground form StartUpPosition Posisi form pada saat dijalankan Visible True, False Height Ukuran tinggi form Widht Ukuran lebar form TextBox Name Nama Textbox Alignment Posisi teks (kiri, tengah, kanan) BorderStyle Bingkai textbox TabIndex urutan index MaxLenght banyaknya karakter yang diinput Text Keterangan (dikosongkan saja) ToolTipText Catatan petunjuk Visible True, False Label Name Nama Label Caption Keterangan Label Frame Name Nama Frame Caption Keterangan Frame OptionButton Name Nama OptionButton Caption Keterangan Option XPButton Name Name Command Button Caption Keterangan Command Button ColorScheme - Pilih Custom ComboBox Name Nama Combo DataCombo Name Nama DataCombo UpDown Name Nama Updown Max Nilai tertinggi, misal : 9999 Min Nilai terendah, misal : 2008 DTPicker Name Nama DTPicker DataGrid Name Nama Grid BorderStyle Bingkai Grid RowDividerStyle Bingkai Garis CrystalReport Name Nama CrystalReportContoh : 1. Penulisan Listing – Modul1Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 2
  3. 3. 2. Penulisan Listing – FrmbytiketModul1 – Modul1Public Koneksi As New ADODB.ConnectionPublic Rsbytiket As New ADODB.RecordsetPublic Rsnotempat As New ADODB.RecordsetPublic Rspesant4 As New ADODB.RecordsetPublic Rsbeli As New ADODB.RecordsetPublic Rskasir As New ADODB.RecordsetSub BukaDatabase() Set Koneksi = Nothing Koneksi.CursorLocation = adUseClient Koneksi.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &"dbstiket_kapal.mdb;jet OLEDB:Database Password=;" Rsbytiket.Open "[tblbytiket]", Koneksi, adOpenDynamic, adLockOptimistic Rsnotempat.Open "[tblnotempat]", Koneksi, adOpenDynamic, adLockOptimistic Rspesant4.Open "[tblpesant4]", Koneksi, adOpenDynamic, adLockOptimistic Rsbeli.Open "[tblbeli]", Koneksi, adOpenDynamic, adLockOptimistic Rskasir.Open "[tblkasir]", Koneksi, adOpenDynamic, adLockOptimisticEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------ Form Entry Tarif Tiket – Frmbytiket xpsimpan txtjnstiket xpedit Txtanak2 xphapus txtpelajar xpbatal txtumum txpkeluar txtfasilitas Grid1Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 3
  4. 4. Listing FrmbytiketPublic Ada1, Valid As BooleanDim RsTampil As New ADODB.RecordsetPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load()BukaDatabasetdkaktifkosongTampildatatutuptombolxpsimpan.Caption = "&Tambah"End SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub tdkaktif()txtanak2.Enabled = False: txtpelajar.Enabled = False: txtumum.Enabled = False: txtfasilitas.Enabled = FalseEnd SubPrivate Sub aktif()txtanak2.Enabled = True: txtpelajar.Enabled = True: txtumum.Enabled = True: txtfasilitas.Enabled = TrueEnd SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub txtjnstiket_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtanak2_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtpelajar_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtumum_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtfasilitas_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub kosong()txtanak2.Text = "": txtpelajar.Text = "": txtumum.Text = "": txtfasilitas.Text = ""End SubPrivate Sub isiformtarif()txtanak2.Text = Rsbytiket!Anak2: txtpelajar.Text = Rsbytiket!Pelajartxtumum.Text = Rsbytiket!umum: txtfasilitas.Text = Rsbytiket!fasilitasEnd SubPrivate Sub isitblbytarif()Rsbytiket!jnstiket = txtjnstiket.Text: Rsbytiket!Anak2 = txtanak2.Text: Rsbytiket!Pelajar = txtpelajar.TextRsbytiket!umum = txtumum.Text: Rsbytiket!fasilitas = txtfasilitas.TextEnd SubPrivate Sub xpsimpan_Click()If xpsimpan.Caption = "&Tambah" ThenEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 4
  5. 5. xpbatal_Click Exit SubEnd IfValidasiIf Valid = True Then If Ada1 = False Then Rsbytiket.AddNew isitblbytarif Rsbytiket.Update Else isitblbytarif Rsbytiket.Update End If xpsimpan.Caption = "&Tambah"Elsexpsimpan.Caption = "&Simpan"End IfRsbytiket.RequeryTampildataEnd SubPrivate Sub xphapus_Click()ckode = Trim(txtjnstiket.Text)Rsnotempat.Find ("jnstiket=" & ckode & ""), , adSearchForward, 1If Not Rsnotempat.EOF Then x = MsgBox("jenis tiket tersebut tidak dapat dihapus", 0 + 16, "konfirmasi") txtjnstiket.SetFocus Exit SubElse Y = MsgBox("Benar anda ingin hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi") Select Case Y Case vbYes Koneksi.Execute "delete * from tblbytiket where jnstiket=" & ckode & "" Case vbNoEnd SelectEnd Ifxpbatal_ClickRsbytiket.RequeryTampildataEnd SubPrivate Sub Validasi()Valid = FalseIf txtanak2.Text = Empty Then x = MsgBox("tarif untuk anak-anak harus diisi", 0 + 16, "konfirmasi") txtanak2.Text = "" txtanak2.SetFocus Exit SubElseIf txtpelajar.Text = Empty Then x = MsgBox("tarif untuk pelajar harus diisi", 0 + 16, "konfirmasi") txtpelajar.Text = "" txtpelajar.SetFocus Exit SubElseIf txtumum.Text = Empty Then x = MsgBox("tarif untuk penumpang umum harus diisi", 0 + 16, "konfirmasi") txtumum.Text = "" txtumum.SetFocus Exit SubElseIf txtfasilitas.Text = Empty Then x = MsgBox("fasilitas harus diisi", 0 + 16, "konfirmasi") txtfasilitas.Text = "" txtfasilitas.SetFocus Exit SubEnd IfValid = TrueEnd SubPrivate Sub xpbatal_Click()Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 5
  6. 6. kosongtdkaktiftxtjnstiket.Enabled = Truetxtjnstiket.SetFocusxpsimpan.Caption = "&Tambah"tutuptombolEnd SubPrivate Sub xpedit_click()tutuptombolAda1 = Trueaktiftxtjnstiket.Enabled = Truexpsimpan.Caption = "&Simpan"txtanak2.SetFocusEnd SubPrivate Sub Tampildata()Set RsTampil = NothingRsTampil.Open "select * from tblbytiket order by jnstiket ", Koneksi, adOpenDynamic, adLockOptimisticSet Grid1.DataSource = RsTampilGrid1.Columns(0).Width = 2000Grid1.Columns(1).Width = 1000Grid1.Columns(2).Width = 1000Grid1.Columns(3).Width = 1000Grid1.Columns(4).Width = 1250Grid1.Columns(1).Alignment = dbgCenterGrid1.Columns(2).Alignment = dbgCenterGrid1.Columns(3).Alignment = dbgCenterGrid1.Columns(0).Caption = "Tiket"Grid1.Columns(1).Caption = "Anak-anak"Grid1.Columns(2).Caption = "Remaja"Grid1.Columns(3).Caption = "Dewasa"Grid1.Columns(4).Caption = "Fasilitas"Grid1.Columns(1).NumberFormat = "#,###,### "Grid1.Columns(2).NumberFormat = "#,###,### "Grid1.Columns(3).NumberFormat = "#,###,### "If RsTampil.RecordCount > 0 Then Grid1.Caption = "Biaya Tiket Kapal "Else Grid1.Caption = "ga ada tu datanya "End IfEnd SubPrivate Sub txtanak2_KeyPress(KeyAscii As Integer)If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then KeyAscii = 0End IfEnd SubPrivate Sub txtpelajar_KeyPress(KeyAscii As Integer)If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then KeyAscii = 0End IfEnd SubPrivate Sub txtumum_KeyPress(KeyAscii As Integer)If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then KeyAscii = 0End IfEnd SubPrivate Sub txtjnstiket_Lostfocus()ckode = Trim(txtjnstiket.Text)If ckode = Empty Then Exit SubEnd IfIf Rsbytiket.RecordCount > 0 ThenEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 6
  7. 7. Rsbytiket.MoveFirstEnd IfSet Rsbytiket = NothingRsbytiket.Open "[tblbytiket] where jnstiket =" & ckode & "", Koneksi, adOpenDynamic, adLockOptimisticIf Rsbytiket.EOF Then kosong aktif txtanak2.SetFocus Ada1 = False tutuptombol xpsimpan.Caption = "&Simpan"Else tdkaktif isiformtarif xpedit.Enabled = True xphapus.Enabled = True Ada1 = TrueEnd IfEnd SubPrivate Sub tutuptombol()xpedit.Enabled = Falsexphapus.Enabled = FalseEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------ Form Entry No Tempat – Frmnot4 xpsimpan xpedit xphapus dcjnstiket Txtnot4 xpkeluar txtstatus xpbatal txtjml Grid1Listing Frmnot4Public Ada1, Valid As BooleanDim RsTampil As New ADODB.RecordsetDim rscari As New ADODB.RecordsetPrivate Sub dcjnstiket_LostFocus()txtnot4.Enabled = Truetxtstatus.Enabled = Truetxtnot4.SetFocusEnd SubPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 7
  8. 8. Private Sub Form_Load()BukaDatabasetdkaktifTampildataxpsimpan.Caption = "&Tambah"tutuptombolSet rscari = Nothingrscari.Open "Select jnstiket from tblbytiket group by jnstiket", Koneksi, adOpenDynamic, adLockOptimisticSet dcjnstiket.RowSource = rscaridcjnstiket.ListField = "jnstiket"End SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub tdkaktif()txtnot4.Enabled = False: txtstatus.Enabled = FalseEnd SubPrivate Sub aktif()txtnot4.Enabled = True: txtstatus.Enabled = TrueEnd SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub dcjnstiket_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtnot4_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtstatus_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub isiformnot4()txtnot4.Text = Rsnotempat!no4: txtstatus.Text = Rsnotempat!StatusEnd SubPrivate Sub isitabelnot4()Rsnotempat!jnstiket = dcjnstiket.Text: Rsnotempat!no4 = txtnot4.Text: Rsnotempat!Status = txtstatus.TextEnd SubPrivate Sub xpsimpan_Click()If xpsimpan.Caption = "&Tambah" Then txtstatus.Text = "" txtnot4.Enabled = True txtnot4.SetFocus Exit SubEnd IfValidasiIf Valid = True Then If Ada1 = False Then Rsnotempat.AddNew isitabelnot4 Rsnotempat.Update Else isitabelnot4 Rsnotempat.Update End If xpsimpan.Caption = "&Tambah"Elsexpsimpan.Caption = "&Simpan"Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 8
  9. 9. End IfRsnotempat.RequeryTampildataEnd SubPrivate Sub xphapus_Click()ckode = Trim(txtnot4.Text)Rsbeli.Find ("no4=" & ckode & ""), , adSearchForward, 1If Not Rsbeli.EOF Then x = MsgBox("no tempat tsb tidak dapat dihapus", 0 + 16, "konfirmasi") txtnot4.Enabled = True txtnot4.SetFocus Exit SubElse Y = MsgBox("Benar anda ingin hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "konfirmasi") Select Case Y Case vbYes Koneksi.Execute "delete * from tblnotempat where jnstiket=" & dcjnstiket & "and no4=" & ckode & "" Case vbNoEnd SelectEnd Ifxpbatal_ClickRsnotempat.RequeryTampildataEnd SubPrivate Sub Validasi()Valid = FalseIf txtstatus.Text = Empty Then x = MsgBox("status tidak boleh kosong, harus diisi", 0 + 16, "konfirmasi") txtstatus.Text = "Kosong" txtstatus.SetFocus Exit SubEnd IfValid = TrueEnd SubPrivate Sub xpbatal_Click()tdkaktifdcjnstiket.Enabled = Truedcjnstiket.SetFocusxpsimpan.Caption = "&Tambah"tutuptomboltxtnot4.Text = "": txtstatus.Text = ""End SubPrivate Sub xpedit_click()tutuptombolAda1 = Trueaktiftxtstatus.Enabled = Truexpsimpan.Caption = "&Simpan"txtstatus.SetFocusEnd SubPrivate Sub Tampildata()Set RsTampil = NothingRsTampil.Open "select * from tblnotempat order by jnstiket,no4 ", Koneksi, adOpenDynamic,adLockOptimisticSet Grid1.DataSource = RsTampilGrid1.Columns(0).Width = 2000Grid1.Columns(1).Width = 1000Grid1.Columns(2).Width = 1000Grid1.Columns(1).Alignment = dbgCenterGrid1.Columns(2).Alignment = dbgCenterGrid1.Columns(0).Caption = " Kelas"Grid1.Columns(1).Caption = " Nomor"Grid1.Columns(2).Caption = " Status"If RsTampil.RecordCount > 0 Then Grid1.Caption = "Data Nomor Tempat di Kapal "Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 9
  10. 10. txtjml.Text = RsTampil.RecordCountElse Grid1.Caption = "ga ada tu datanya " txtjml.Text = RsTampil.RecordCountEnd IfEnd SubPrivate Sub txtnot4_KeyPress(KeyAscii As Integer)KeyAscii = Asc(UCase(Chr(KeyAscii)))End SubPrivate Sub cekno()ckode = Trim(txtnot4.Text)Set Rsnotempat = NothingRsnotempat.Open "[tblnotempat] where no4 =" & ckode & "", Koneksi, adOpenDynamic, adLockOptimisticIf Not Rsnotempat.EOF Then kk = Rsnotempat!jnstiket MsgBox "No tersebut sudah dipakai pada kelas " & kk & " !", 0 + 64, "Konfirmasi" txtnot4.Text = "": txtnot4.SetFocus Exit SubElseaktiftxtstatus.SetFocustxtstatus.Text = "Kosong"tutuptombolxpsimpan.Caption = "&Simpan"End IfEnd SubPrivate Sub txtnot4_Lostfocus()ckode = Trim(txtnot4.Text)If ckode = Empty Then Exit SubEnd IfIf Rsnotempat.RecordCount > 0 Then Rsnotempat.MoveFirstEnd IfSet Rsnotempat = NothingRsnotempat.Open "[tblnotempat] where jnstiket =" & dcjnstiket & "and no4 =" & ckode & "", Koneksi,adOpenDynamic, adLockOptimisticIf Rsnotempat.EOF Then cekno Ada1 = FalseElse tdkaktif isiformnot4 xpedit.Enabled = True xphapus.Enabled = True Ada1 = TrueEnd IfEnd SubPrivate Sub tutuptombol()xpedit.Enabled = Falsexphapus.Enabled = FalseEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 10
  11. 11. cek Form Entry Pesan Tempat – Frmpesant4 dccek txtnama dtptglpesan txtnotelp txtjampesan cbodari cbotujuan List2 dctiket xplagi List1 xpkeluar xppesan xpbatalListing Frmpesant4Public Ada, Ada1, Valid As BooleanPublic sql As StringDim rscari As New ADODB.RecordsetPublic T1, B1, Th1 As IntegerPrivate Sub cek_Click()If cek.Value = vbChecked Then frmpesant4.Refresh txtnama.Visible = False dccek.Visible = True dccek.Text = "" dccek.SetFocusElse frmpesant4.Refresh txtnama.Visible = True dccek.Visible = False txtnama.Text = "" txtnama.SetFocusEnd IfEnd SubPrivate Sub dccek_Click(Area As Integer)aktifLs2End SubPrivate Sub dctiket_Click(Area As Integer)Ls1End SubPrivate Sub Ls1()Set rscari = Nothingrscari.Open "Select no4 from tblnotempat where jnstiket=" & dctiket & "and status=Kosong group by no4Order by no4", Koneksi, adOpenDynamic, adLockOptimisticSet List1.RowSource = rscariList1.ListField = "no4"If rscari.RecordCount > 0 Then List1.Enabled = TrueElse List1.Enabled = FalseEnd IfEnd SubPrivate Sub Ls2()If cek.Value = vbChecked ThenEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 11
  12. 12. Set rscari = Nothing rscari.Open "Select no4 from tblpesant4 where nama=" & dccek & "and status=Pesan and tglpesan = #"& B1 & "/" & T1 & "/" & Th1 & "# group by no4", Koneksi, adOpenDynamic, adLockOptimistic Set List2.RowSource = rscari List2.ListField = "no4" If rscari.RecordCount > 0 Then List2.Enabled = True txtnotelp.Text = Rspesant4!notelp cbodari.Text = Rspesant4!dari cbotujuan.Text = Rspesant4!tujuan Else List2.Enabled = False End IfElse Set rscari = Nothing rscari.Open "Select no4 from tblpesant4 where nama=" & txtnama & "and status=Pesan and tglpesan = #"& B1 & "/" & T1 & "/" & Th1 & "# group by no4", Koneksi, adOpenDynamic, adLockOptimistic Set List2.RowSource = rscari List2.ListField = "no4" If rscari.RecordCount > 0 Then List2.Enabled = True Else List2.Enabled = False End IfEnd IfEnd SubPrivate Sub cekpesan()Set rscari = Nothingrscari.Open "Select nama from tblpesant4 where status=Pesan group by nama", Koneksi, adOpenDynamic,adLockOptimisticSet dccek.RowSource = rscaridccek.ListField = "nama"If rscari.RecordCount > 0 Then cek.Enabled = TrueElse cek.Enabled = FalseEnd IfEnd SubPrivate Sub dctiket_LostFocus()Ls1End SubPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load()BukaDatabasetdkaktiftutuptomboldccek.Visible = Falsedtptglpesan = Datedtptglpesan_LostFocuscekpesanSet rscari = Nothingrscari.Open "Select jnstiket from tblbytiket group by jnstiket", Koneksi, adOpenDynamic, adLockOptimisticSet dctiket.RowSource = rscaridctiket.ListField = "jnstiket"cbodari.List(0) = "Banggai"cbodari.List(1) = "Luwuk"cbotujuan.List(0) = "Luwuk"cbotujuan.List(1) = "Banggai"End SubPrivate Sub dtptglpesan_LostFocus()T1 = Left(dtptglpesan, 2)B1 = Mid(dtptglpesan, 4, 2)Th1 = Right(dtptglpesan, 4)Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 12
  13. 13. End SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub tdkaktif()txtnotelp.Enabled = False: cbodari.Enabled = False: cbotujuan.Enabled = Falsedtptglpesan.Enabled = False: List1.Enabled = False: List2.Enabled = False: dctiket.Enabled = FalseEnd SubPrivate Sub aktif()txtnotelp.Enabled = True: cbodari.Enabled = True: cbotujuan.Enabled = Truedtptglpesan.Enabled = True: dctiket.Enabled = TrueEnd SubPrivate Sub tutuptombol()xppesan.Enabled = False: xpbatal.Enabled = FalseEnd SubPrivate Sub List1_Click()xppesan.Enabled = TrueEnd SubPrivate Sub List2_Click()xpbatal.Enabled = TrueEnd SubPrivate Sub Timer1_Timer() txtjampesan.Text = TimeEnd SubPrivate Sub txtnama_Lostfocus()ckode = Trim(txtnama.Text)If ckode = Empty Then Exit SubEnd IfIf Rspesant4.RecordCount > 0 Then Rspesant4.MoveFirstEnd IfSet Rspesant4 = NothingRspesant4.Open "[tblpesant4] where nama=" & txtnama & "and status=Pesan and tglpesan = #" & B1 & "/"& T1 & "/" & Th1 & "# ", Koneksi, adOpenDynamic, adLockOptimisticIf Rspesant4.EOF Then aktif txtnotelp.SetFocus Ada1 = FalseElse aktif txtnotelp.Text = Rspesant4!notelp cbodari.Text = Rspesant4!dari cbotujuan.Text = Rspesant4!tujuan Ls2 Ada1 = TrueEnd IfEnd SubPrivate Sub txtnama_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub dtptglpesan_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtnotelp_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTabEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 13
  14. 14. End IfEnd SubPrivate Sub cbodari_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub cbotujuan_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub dctiket_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub xpbatal_Click()If cek.Value = vbChecked Then xpbatal.Enabled = False Koneksi.Execute "update tblpesant4 set status=Batal where no4 =" & List2 & " and nama =" & dccek &"and tglpesan = #" & B1 & "/" & T1 & "/" & Th1 & "# " Koneksi.Execute "update tblnotempat set status=Kosong where no4=" & List2 & "" Ls1 Ls2Else xpbatal.Enabled = False Koneksi.Execute "update tblpesant4 set status=Batal where no4 =" & List2 & " and nama =" & txtnama& "and tglpesan = #" & B1 & "/" & T1 & "/" & Th1 & "# " Koneksi.Execute "update tblnotempat set status=Kosong where no4=" & List2 & "" Ls1 Ls2End IfEnd SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub xplagi_Click()tdkaktif: cekpesan: cek.Value = novbchecked: Ls1: Ls2txtnotelp.Text = "": cbodari.Text = "": cbotujuan.Text = "": txtnama.SetFocus: txtnama.Text = "":dctiket.Text = ""cekpesanEnd SubPrivate Sub xppesan_Click()gg = Login.TxtNamap.TextIf cek.Value = vbChecked Then xppesan.Enabled = False Set Rspesant4 = Nothing Rspesant4.Open "[tblpesant4] where nama =" & dccek & " and tglpesan = #" & B1 & "/" & T1 & "/" &Th1 & "# ", Koneksi, adOpenDynamic, adLockOptimistic If Rspesant4.EOF Then Rspesant4.AddNew Rspesant4!no4 = List1.Text Rspesant4!tglpesan = dtptglpesan Rspesant4!nama = dccek.Text Rspesant4!notelp = txtnotelp.Text Rspesant4!Status = "Pesan" Rspesant4!jampesan = txtjampesan.Text Rspesant4!dari = cbodari.Text Rspesant4!tujuan = cbotujuan.Text Rspesant4!Kasir = gg Rspesant4.Update Koneksi.Execute "update tblnotempat set status=Pesan where no4=" & List1 & ""Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 14
  15. 15. Else Rspesant4.AddNew Rspesant4!no4 = List1.Text Rspesant4!tglpesan = dtptglpesan Rspesant4!nama = dccek.Text Rspesant4!notelp = txtnotelp.Text Rspesant4!Status = "Pesan" Rspesant4!jampesan = txtjampesan.Text Rspesant4!dari = cbodari.Text Rspesant4!tujuan = cbotujuan.Text Rspesant4!Kasir = gg Rspesant4.Update Koneksi.Execute "update tblnotempat set status=Pesan where no4=" & List1 & "" End If Ls1 Ls2 cekpesanElse xppesan.Enabled = False Set Rspesant4 = Nothing Rspesant4.Open "[tblpesant4] where nama =" & txtnama & " and tglpesan = #" & B1 & "/" & T1 & "/" &Th1 & "# ", Koneksi, adOpenDynamic, adLockOptimistic If Rspesant4.EOF Then Rspesant4.AddNew Rspesant4!no4 = List1.Text Rspesant4!tglpesan = dtptglpesan Rspesant4!nama = txtnama.Text Rspesant4!notelp = txtnotelp.Text Rspesant4!Status = "Pesan" Rspesant4!jampesan = txtjampesan.Text Rspesant4!dari = cbodari.Text Rspesant4!tujuan = cbotujuan.Text Rspesant4!Kasir = gg Rspesant4.Update Koneksi.Execute "update tblnotempat set status=Pesan where no4=" & List1 & "" Else Rspesant4.AddNew Rspesant4!no4 = List1.Text Rspesant4!tglpesan = dtptglpesan Rspesant4!nama = txtnama.Text Rspesant4!notelp = txtnotelp.Text Rspesant4!Status = "Pesan" Rspesant4!jampesan = txtjampesan.Text Rspesant4!dari = cbodari.Text Rspesant4!tujuan = cbotujuan.Text Rspesant4!Kasir = gg Rspesant4.Update Koneksi.Execute "update tblnotempat set status=Pesan where no4=" & List1 & "" End If Ls1 Ls2 cekpesanEnd IfEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 15
  16. 16. Form Penjualan Tiket - Frmjualtiket Txtnot4 cek txtnama txtalamat edit cbojnskel dtptgljual cbodari txtjamjual cbotujuan txtbayarcbopenumpang xpbatal Grid1 xplagi xpcetak xpkeluar xpsimpan stb Listing Frmjualtiket Crpcetak1 Public Ada, Ada1, Valid As Boolean Public sql As String Dim rscari As New ADODB.Recordset Public T1, B1, Th1 As Integer Dim RsTampil As New ADODB.Recordset Private Sub cbopenumpang_Click() cekbiaya End Sub Private Sub cek_Click() If cek.Value = vbChecked Then txtnot4.SetFocus Else txtnot4.SetFocus End If End Sub Private Sub edit_Click() If edit.Value = vbChecked Then aksesedit Else xpsimpan.Enabled = False tdkaktif xplagi.SetFocus End If End Sub Private Sub Form_Activate() frmmenuutama.Enabled = False End Sub Private Sub Form_Load() BukaDatabase Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 16
  17. 17. tdkaktifedit.Visible = Falsedtptgljual = Datedtptgljual_LostFocuscbojnskel.List(0) = "Laki-laki"cbojnskel.List(1) = "Perempuan"cbodari.List(0) = "Banggai"cbodari.List(1) = "Luwuk"cbotujuan.List(0) = "Luwuk"cbotujuan.List(1) = "Banggai"cbopenumpang.List(0) = "Dewasa"cbopenumpang.List(1) = "Remaja"cbopenumpang.List(2) = "Anak-Anak"Tampildataxpcetak.Enabled = Falsexpsimpan.Enabled = Falsexpbatal.Enabled = FalsecekjmltiketEnd SubPrivate Sub Tampildata()Set RsTampil = NothingRsTampil.Open "select namapen,no4,tglbeli,jambeli,asal from tblbeli where statust4=Terisi and tglbeli= #"& B1 & "/" & T1 & "/" & Th1 & "# order by no4,namapen", Koneksi, adOpenDynamic, adLockOptimisticSet Grid1.DataSource = RsTampilGrid1.RefreshGrid1.Columns(0).Width = 2500Grid1.Columns(1).Width = 1000Grid1.Columns(2).Width = 1000Grid1.Columns(3).Width = 1000Grid1.Columns(4).Width = 2000Grid1.Columns(1).Alignment = dbgCenterGrid1.Columns(2).Alignment = dbgCenterGrid1.Columns(3).Alignment = dbgCenterGrid1.Columns(0).Caption = " Nama Penumpang"Grid1.Columns(1).Caption = " No.T4"Grid1.Columns(2).Caption = " Tgl.Beli"Grid1.Columns(3).Caption = " Jam.Beli"Grid1.Columns(4).Caption = " Asal"If RsTampil.RecordCount > 0 Then Grid1.Enabled = True Grid1.Caption = "Data Penumpang Tanggal " + Format(dtptgljual)Else Grid1.Enabled = False Grid1.Caption = " ga ada tu datanya "End IfEnd SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub Grid1_Click()akseshpsEnd SubPrivate Sub Timer1_Timer()txtjamjual.Text = TimeEnd SubPrivate Sub txtnot4_Lostfocus()If cek.Value = vbChecked Then ckode = Trim(txtnot4.Text) If ckode = Empty Then Exit Sub End IfEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 17
  18. 18. If Rspesant4.RecordCount > 0 Then Rspesant4.MoveFirst End If Set Rspesant4 = Nothing Rspesant4.Open "[tblpesant4] where no4 =" & ckode & " and status=Ok", Koneksi, adOpenDynamic,adLockOptimistic If Not Rspesant4.EOF Then cekpenum End If Set Rspesant4 = Nothing Rspesant4.Open "[tblpesant4] where no4 =" & ckode & " and status=Pesan", Koneksi, adOpenDynamic,adLockOptimistic If Rspesant4.EOF Then MsgBox "Nomor tempat tersebut tidak dalam status dipesan!", 0 + 64, "Konfirmasi" xpcetak.Enabled = False xpsimpan.Enabled = False Exit Sub Else kosong aktif txtnama.Enabled = True txtnama.SetFocus Ada1 = False xpsimpan.Enabled = True End IfElse ckode = Trim(txtnot4.Text) If ckode = Empty Then Exit Sub End If If Rsnotempat.RecordCount > 0 Then Rsnotempat.MoveFirst End If Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & "and status=Pesan", Koneksi,adOpenDynamic, adLockOptimistic If Not Rsnotempat.EOF Then MsgBox "nomor tempat tersebut sudah dipesan!", 0 + 64, "Konfirmasi" txtnot4.Text = "" xpcetak.Enabled = False xpsimpan.Enabled = False txtnot4.SetFocus Exit Sub End If Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & "and status=Terisi", Koneksi,adOpenDynamic, adLockOptimistic If Not Rsnotempat.EOF Then cekpenum edit.Visible = True Else Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & " and status=Kosong", Koneksi,adOpenDynamic, adLockOptimistic If Rsnotempat.EOF Then MsgBox "Nomor tempat tersebut tidak terdaftar!", 0 + 64, "Konfirmasi" txtnot4.Text = "" txtnot4.SetFocus Exit Sub Else kosong aktifEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 18
  19. 19. txtnama.Enabled = True txtnama.SetFocus Ada1 = False xpsimpan.Enabled = True End If End IfEnd IfEnd SubPrivate Sub xpbatal_Click()xpbatal.Enabled = Falsekk = Grid1.Columns(1)Set Rsbeli = NothingRsbeli.Open "[tblbeli] where no4 =" & kk & " and statust4=Terisi and tglbeli = #" & B1 & "/" & T1 & "/"& Th1 & "# ", Koneksi, adOpenDynamic, adLockOptimisticIf Not Rsbeli.EOF Then byr = Rsbeli!bayar / 2End IfKoneksi.Execute "update tblbeli set statust4=Batal,statuspen=Batal,bayar=" & byr & " where no4 =" & kk& "and tglbeli = #" & B1 & "/" & T1 & "/" & Th1 & "# "Koneksi.Execute "update tblnotempat set status=Kosong where no4 =" & kk & ""txtnot4.SetFocus: Tampildata: cekjmltiketEnd SubPrivate Sub xpcetak_Click() crpcetak1.ReportFileName = App.Path & "" & "rpttiket.rpt" crpcetak1.Formulas(0) = "nama =" & txtnama & "" crpcetak1.Formulas(1) = "dari =" & cbodari & "" crpcetak1.Formulas(2) = "tujuan =" & cbotujuan & "" crpcetak1.Formulas(3) = "ket =No.: " & txtnot4 & "" crpcetak1.Formulas(4) = "kategori =" & cbopenumpang & "" crpcetak1.Formulas(5) = "tgl =" & dtptgljual & "" crpcetak1.Formulas(6) = "tarif =Rp. " & Format(txtbayar, "#,###,###.#0") & "" crpcetak1.Formulas(7) = "menerima =" & Login.TxtNamap.Text & "" crpcetak1.RetrieveDataFiles crpcetak1.WindowState = crptMaximized crpcetak1.CopiesToPrinter = 1 crpcetak1. Destination = crptToPrinter crpcetak1.Action = 1End SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub dtptgljual_LostFocus()T1 = Left(dtptgljual, 2)B1 = Mid(dtptgljual, 4, 2)Th1 = Right(dtptgljual, 4)End SubPrivate Sub tdkaktif()txtalamat.Enabled = False: cbojnskel.Enabled = False: cbodari.Enabled = False: cbotujuan.Enabled = Falsedtptgljual.Enabled = False: txtnama.Enabled = False: txtbayar.Enabled = False: cbopenumpang.Enabled =FalseEnd SubPrivate Sub aktif()txtalamat.Enabled = True: cbojnskel.Enabled = True: cbodari.Enabled = True: cbotujuan.Enabled = Truedtptgljual.Enabled = True: txtnama.Enabled = True: txtbayar.Enabled = False: cbopenumpang.Enabled =TrueEnd SubPrivate Sub dccek_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab aktifEnd IfEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 19
  20. 20. End SubPrivate Sub txtnama_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab aktif End IfEnd SubPrivate Sub dtptgljual_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub txtalamat_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub cbojnskel_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub cbodari_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub cbotujuan_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub cbopenumpang_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab cekbiaya End IfEnd SubPrivate Sub kosong()txtalamat.Text = "": cbojnskel.Text = "": cbodari.Text = "": cbotujuan.Text = ""txtnama.Text = "": txtbayar.Text = "": cbopenumpang.Text = ""End SubPrivate Sub xplagi_Click()Tampildata: xpbatal.Enabled = Falseedit.Value = novbchecked: edit.Visible = False: cekjmltiket: txtnot4.Enabled = Truetxtnama.Text = "": cek.Value = novbchecked: tdkaktif: kosong: txtnot4.SetFocusEnd SubPrivate Sub txtnot4_KeyDown(KeyCode As Integer, Shift As Integer)If cek.Value = vbChecked Then If KeyCode = vbKeyF1 Then txtnot4.Text = "" sql="Select tblpesant4.nama,tblpesant4.no4,tblpesant4.tglpesan,tblnotempat.jnstiket fromtblpesant4,tblnotempat where tblpesant4.no4 like " & txtnot4 & "% and tblpesant4.status=Pesan andtblpesant4.no4=tblnotempat.no4 and tblpesant4.tglpesan > #" & B1 & "/" & T1 & "/" & Th1 & "# order bytblpesant4.nama,tblpesant4.no4" Ada = True frminfo.Caption = ">>> Info Data Pemesan Tiket <<<" frminfo.Grid1.Columns(0).Width = 1500 frminfo.Grid1.Columns(1).Width = 1000 frminfo.Grid1.Columns(2).Width = 1500 frminfo.Grid1.Columns(3).Width = 1000 frminfo.Show vbModal, Me Ada = False txtnot4.Text = frminfo.Kode txtnot4_LostfocusEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 20
  21. 21. End If If KeyCode = vbKeyReturn Then SendKeys vbTab End IfElse If KeyCode = vbKeyF1 Then txtnot4.Text = "" sql = "Select jnstiket,no4,status from tblnotempat where no4 like " & txtnot4 & "% and status=Kosongorder by jnstiket,no4" Ada = True frminfo.Caption = ">>> Info Nomor Tempat <<<" frminfo.Grid1.Columns(0).Width = 1500 frminfo.Grid1.Columns(1).Width = 1000 frminfo.Grid1.Columns(2).Width = 1500 frminfo.Show vbModal, Me Ada = False txtnot4.Text = frminfo.Kode txtnot4_Lostfocus End If If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd IfEnd SubPrivate Sub txtbayar_KeyPress(KeyAscii As Integer)If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or _ KeyAscii = vbKeyBack) Then KeyAscii = 0End IfEnd SubPrivate Sub cekpenum()ckode = Trim(txtnot4.Text)If ckode = Empty Then Exit SubEnd IfIf Rsbeli.RecordCount > 0 Then Rsbeli.MoveFirstEnd IfSet Rsbeli = NothingRsbeli.Open "[tblbeli] where no4=" & ckode & " and statust4=Terisi and statuspen=Ok and tglbeli= #" &B1 & "/" & T1 & "/" & Th1 & "#", Koneksi, adOpenDynamic, adLockOptimisticIf Not Rsbeli.EOF Then tdkaktif isiformbeli xpsimpan.Enabled = False Ada1 = TrueEnd IfEnd SubPrivate Sub isiformbeli()txtalamat.Text = Rsbeli!asal: cbodari.Text = Rsbeli!dari: cbotujuan.Text = Rsbeli!tujuan: txtnama.Text =Rsbeli!namapencbojnskel.Text = Rsbeli!jnskel: cbopenumpang.Text = Rsbeli!jenispen: txtbayar.Text = Rsbeli!bayarEnd SubPrivate Sub cekbiaya()If cek.Value = vbChecked Then ckode = Trim(txtnot4.Text) Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & "and status=Pesan", Koneksi,adOpenDynamic, adLockOptimistic If Not Rsnotempat.EOF Then jns = Rsnotempat!jnstiket End If If cbopenumpang.Text = "Dewasa" Then Set Rsbytiket = NothingEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 21
  22. 22. Rsbytiket.Open "[tblbytiket] where jnstiket =" & jns & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!umum End If ElseIf cbopenumpang.Text = "Remaja" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & jns & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Pelajar End If ElseIf cbopenumpang.Text = "Anak-Anak" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & jns & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Anak2 End If End If txtbayar.Text = byt1 xpcetak.Enabled = True xpsimpan.Enabled = True xpcetak.SetFocusElse If edit.Value = vbChecked Then ckode = Trim(txtnot4.Text) Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & " and status=Terisi", Koneksi,adOpenDynamic, adLockOptimistic If Not Rsnotempat.EOF Then ll = Rsnotempat!jnstiket End If If cbopenumpang.Text = "Dewasa" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!umum End If ElseIf cbopenumpang.Text = "Remaja" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Pelajar End If ElseIf cbopenumpang.Text = "Anak-Anak" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Anak2 End If End If txtbayar.Text = byt1 xpcetak.Enabled = True xpsimpan.Enabled = True xpcetak.SetFocus Else ckode = Trim(txtnot4.Text) Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] where no4 =" & ckode & " and status=Kosong", Koneksi,adOpenDynamic, adLockOptimisticEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 22
  23. 23. If Not Rsnotempat.EOF Then ll = Rsnotempat!jnstiket End If If cbopenumpang.Text = "Dewasa" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!umum End If ElseIf cbopenumpang.Text = "Remaja" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Pelajar End If ElseIf cbopenumpang.Text = "Anak-Anak" Then Set Rsbytiket = Nothing Rsbytiket.Open "[tblbytiket] where jnstiket =" & ll & "", Koneksi, adOpenDynamic,adLockOptimistic If Not Rsbytiket.EOF Then byt1 = Rsbytiket!Anak2 End If End If txtbayar.Text = byt1 xpcetak.Enabled = True xpsimpan.Enabled = True xpcetak.SetFocus End IfEnd IfEnd SubPrivate Sub xpsimpan_Click()gg = Login.TxtNamap.TextIf edit.Value = vbChecked Then xpsimpan.Enabled = False Set Rsbeli = Nothing Rsbeli.Open "[tblbeli] where no4 =" & txtnot4 & " and statust4=Terisi and tglbeli = #" & B1 & "/" & T1& "/" & Th1 & "# ", Koneksi, adOpenDynamic, adLockOptimistic If Not Rsbeli.EOF Then Koneksi.Execute "update tblbeli set namapen=" & txtnama & ",jnskel=" & cbojnskel & ",asal=" &txtalamat & ",dari=" & cbodari & ",tujuan=" & cbotujuan & ",jenispen=" & cbopenumpang & ",bayar="& txtbayar & " where no4 =" & txtnot4 & "and statust4=Terisi and statuspen=Ok and tglbeli = #" & B1 &"/" & T1 & "/" & Th1 & "# " Tampildata cekjmltiket End IfElse If txtnama.Text = Empty Then MsgBox "Nama penumpang tidak boleh kosong!", 0 + 64, "Konfirmasi" txtnama.SetFocus Exit Sub ElseIf txtalamat.Text = Empty Then MsgBox "alamat penumpang tidak boleh kosong!", 0 + 64, "Konfirmasi" txtalamat.SetFocus Exit Sub ElseIf cbojnskel.Text = Empty Then MsgBox "Jenis kelamin tidak boleh kosong!", 0 + 64, "Konfirmasi" cbojnskel.SetFocus Exit Sub ElseIf cbodari.Text = Empty Then MsgBox "tempat keberangkatan tidak boleh kosong!", 0 + 64, "Konfirmasi" cbodari.SetFocusEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 23
  24. 24. Exit Sub ElseIf cbotujuan.Text = Empty Then MsgBox "tujuan keberangkatan tidak boleh kosong!", 0 + 64, "Konfirmasi" cbotujuan.SetFocus Exit Sub ElseIf cbopenumpang.Text = Empty Then MsgBox "kategori penumpang tidak boleh kosong!", 0 + 64, "Konfirmasi" cbopenumpang.SetFocus Exit Sub Else xpsimpan.Enabled = False Set Rsbeli = Nothing Rsbeli.Open "[tblbeli] where no4 =" & txtnot4 & " and tglbeli = #" & B1 & "/" & T1 & "/" & Th1 & "#", Koneksi, adOpenDynamic, adLockOptimistic If Rsbeli.EOF Then Rsbeli.AddNew Rsbeli!no4 = txtnot4.Text Rsbeli!tglbeli = dtptgljual Rsbeli!namapen = txtnama.Text Rsbeli!asal = txtalamat.Text Rsbeli!jnskel = cbojnskel.Text Rsbeli!Statust4 = "Terisi" Rsbeli!jambeli = txtjamjual.Text Rsbeli!dari = cbodari.Text Rsbeli!tujuan = cbotujuan.Text Rsbeli!jenispen = cbopenumpang.Text Rsbeli!bayar = txtbayar.Text Rsbeli!statuspen = "Ok" Rsbeli!Kasir = gg Rsbeli.Update Koneksi.Execute "update tblnotempat set status=Terisi where no4=" & txtnot4 & "" Koneksi.Execute "update tblpesant4 set status=Ok where no4=" & txtnot4 & "and status=Pesan" Else Rsbeli.AddNew Rsbeli!no4 = txtnot4.Text Rsbeli!tglbeli = dtptgljual Rsbeli!namapen = txtnama.Text Rsbeli!asal = txtalamat.Text Rsbeli!jnskel = cbojnskel.Text Rsbeli!Statust4 = "Terisi" Rsbeli!jambeli = txtjamjual.Text Rsbeli!dari = cbodari.Text Rsbeli!tujuan = cbotujuan.Text Rsbeli!jenispen = cbopenumpang.Text Rsbeli!bayar = txtbayar.Text Rsbeli!statuspen = "Ok" Rsbeli!Kasir = gg Rsbeli.Update Koneksi.Execute "update tblnotempat set status=Terisi where no4=" & txtnot4 & "" Koneksi.Execute "update tblpesant4 set status=Ok where no4=" & txtnot4 & "and status=Pesan" End If Rsbeli.Requery Tampildata cekjmltiket End IfEnd IfEnd SubPrivate Sub cekjmltiket() Set Rsnotempat = Nothing Rsnotempat.Open "[tblnotempat] ", Koneksi, adOpenDynamic, adLockOptimistic tjml = 0 ks = 0 pesan = 0 jual = 0Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 24
  25. 25. If Rsnotempat.RecordCount > 0 Then tjml = Rsnotempat.RecordCount Rsnotempat.MoveFirst Do While Not Rsnotempat.EOF If Rsnotempat!Status = "Kosong" Then ks = ks + 1 ElseIf Rsnotempat!Status = "Pesan" Then pesan = pesan + 1 ElseIf Rsnotempat!Status = "Terisi" Then jual = jual + 1 End If Rsnotempat.MoveNext Loop End If stb.Panels(1).Width = 2050 stb.Panels(2).Width = 2050 stb.Panels(3).Width = 2050 stb.Panels(4).Width = 2050 stb.Panels(1).Text = "All Tempat : " + Format(tjml, "###,##0") stb.Panels(2).Text = "T4 yg kosong : " + Format(ks, "###,##0") stb.Panels(3).Text = "T4 yg Dipesan : " + Format(pesan, "###,##0") stb.Panels(4).Text = "T4 yg Terisi : " + Format(jual, "###,##0")End SubPrivate Sub aksesedit()Dim lihat, passlihat = "Masukkan Hak Akses Edit !"pass = InputBox(lihat, "Masukkan")If pass <> txtnot4.Text Then MsgBox "Hak akses anda tidak sesuai !", , "Ulangi lagi" edit.Value = novbchecked Exit SubElse MsgBox "Hak akses terbuka!", , "Konfirmasi" Ada1 = True txtnot4.Enabled = False xpsimpan.Enabled = True aktif txtnama.SetFocusEnd IfEnd SubPrivate Sub akseshps()Dim lihat, passlihat = "Masukkan Hak Akses Pembatalan !"pass = InputBox(lihat, "Masukkan")If pass <> Grid1.Columns(1) Then MsgBox "Hak akses anda tidak sesuai !", , "Ulangi lagi" xpbatal.Enabled = False Exit SubElse MsgBox "Hak akses pembatalan terbuka!", , "Konfirmasi" xpbatal.Enabled = True xpbatal.SetFocus Ada1 = TrueEnd IfEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 25
  26. 26. Form Info – FrmInfo Grid1 AdoListing FrminfoPublic Kode, Teks As StringPrivate Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyEscape Then Kode = "" Teks = "" Unload Me Exit SubEnd If If KeyCode = vbKeyReturn Then If Ado.Recordset.RecordCount = 0 Then Kode = "" Teks = "" Else Kode = Grid1.Columns(1) Teks = Grid1.Columns(0) End If Unload Me End IfEnd SubPrivate Sub Form_Load()Ado.ConnectionString = KoneksiIf frmjualtiket.Ada Then Ado.RecordSource = frmjualtiket.sql Ado.RefreshEnd If Grid1.Col = 0 Grid1.Columns(0).Width = 2500 Grid1.Columns(1).Width = 1500 Grid1.Columns(1).Alignment = dbgCenterEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 26
  27. 27. Desain Tiket pada Cystal ReportHasil Ketika pencetakkan :----------------------------------------------------------------------------------------------------------------------------- ------ Form Laporan Penumpang – Frmcetakpen Dtptgl2 xptampil Dtptgl1 xpcetak optbatal xpkeluar optok lbljml Grid1Listing FrmcetakpenDim RsTampil As New ADODB.RecordsetPublic T1, T2, B1, B2, Th1, Th2 As IntegerPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load()BukaDatabasedtptgl1 = Datedtptgl2 = DatedtpTgl1_LostFocusEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 27
  28. 28. DTPTgl2_LostFocusxpcetak.Enabled = FalseEnd SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub dtpTgl1_LostFocus() T1 = Left(dtptgl1, 2) B1 = Mid(dtptgl1, 4, 2) Th1 = Right(dtptgl1, 4) DTPTgl2_LostFocusEnd SubPrivate Sub DTPTgl2_LostFocus() T2 = Left(dtptgl2, 2) B2 = Mid(dtptgl2, 4, 2) Th2 = Right(dtptgl2, 4)End SubPrivate Sub Tampildata()Set RsTampil = NothingRsTampil.Open "select namapen,no4,tglbeli,jambeli,asal from tblbeli where statuspen=Ok and (Tglbeli >=#" & B1 & "-" & T1 & "-" & Th1 & "# " & _"and Tglbeli <= #" & B2 & "-" & T2 & "-" & Th2 & "# ) order by no4,namapen", Koneksi,adOpenDynamic, adLockOptimisticSet Grid1.DataSource = RsTampilGrid1.Columns(0).Width = 2000Grid1.Columns(1).Width = 750Grid1.Columns(2).Width = 1000Grid1.Columns(3).Width = 1250Grid1.Columns(4).Width = 1500Grid1.Columns(1).Alignment = dbgCenterGrid1.Columns(2).Alignment = dbgCenterGrid1.Columns(3).Alignment = dbgCenterGrid1.Columns(0).Caption = " Nama Penumpang"Grid1.Columns(1).Caption = " No.T4"Grid1.Columns(2).Caption = "Tgl.Beli Tiket"Grid1.Columns(3).Caption = "Jam Beli Tiket"Grid1.Columns(4).Caption = " Asal"If dtptgl1 = dtptgl2 Then gg = Format(dtptgl1)Else gg = Format(dtptgl1) + " s/d " + Format(dtptgl2)End IfIf RsTampil.RecordCount > 0 Then Grid1.Enabled = True xpcetak.Enabled = True Grid1.Caption = "Penumpang Yg Jadi Berangkat Tgl. " + gg lbljml.Caption = RsTampil.RecordCountElse Grid1.Enabled = False xpcetak.Enabled = False lbljml.Caption = RsTampil.RecordCountEnd IfEnd SubPrivate Sub optbatal_Click()xpcetak.Enabled = FalseEnd SubPrivate Sub optok_Click()xpcetak.Enabled = FalseEnd SubPrivate Sub xpcetak_Click()If optok = True Then crpcetak1.ReportFileName = App.Path & "" & "rptcetakpen.rpt" crpcetak1.SelectionFormula = " {tblbeli.statuspen} =Ok and {tblbeli.tglbeli} >= #" & B1 & "-" & T1& "-" & Th1 & "# " & _ "and {tblbeli.tglbeli} <= #" & B2 & "-" & T2 & "-" & Th2 & "#"Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 28
  29. 29. If dtptgl1 = dtptgl2 Then tt = Format(dtptgl1) Else tt = Format(dtptgl1) + " s/d " + Format(dtptgl2) End If crpcetak1.Formulas(0) = "tgl =" & tt & "" crpcetak1.Formulas(1) = "status =Jadi Berangkat" crpcetak1.RetrieveDataFiles crpcetak1.WindowState = crptMaximized crpcetak1.Action = 1End IfIf optbatal = True Then crpcetak1.ReportFileName = App.Path & "" & "rptcetakpen.rpt" crpcetak1.SelectionFormula = " {tblbeli.statuspen} =Batal and {tblbeli.tglbeli} >= #" & B1 & "-" & T1& "-" & Th1 & "# " & _ "and {tblbeli.tglbeli} <= #" & B2 & "-" & T2 & "-" & Th2 & "#" If dtptgl1 = dtptgl2 Then tt = Format(dtptgl1) Else tt = Format(dtptgl1) + " s/d " + Format(dtptgl2) End If crpcetak1.Formulas(0) = "tgl =" & tt & "" crpcetak1.Formulas(1) = "status =Batal Berangkat" crpcetak1.RetrieveDataFiles crpcetak1.WindowState = crptMaximized crpcetak1.Action = 1End IfEnd SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub xptampil_Click()If optok = True Then TampildataEnd IfIf optbatal = True Then Tampildata1End IfEnd SubPrivate Sub Tampildata1()Set RsTampil = NothingRsTampil.Open "select namapen,no4,tglbeli,jambeli,asal from tblbeli where statuspen=Batal and (Tglbeli>= #" & B1 & "-" & T1 & "-" & Th1 & "# " & _"and Tglbeli <= #" & B2 & "-" & T2 & "-" & Th2 & "# ) order by no4,namapen", Koneksi,adOpenDynamic, adLockOptimisticSet Grid1.DataSource = RsTampilGrid1.Columns(0).Width = 2000Grid1.Columns(1).Width = 750Grid1.Columns(2).Width = 1000Grid1.Columns(3).Width = 1250Grid1.Columns(4).Width = 1500Grid1.Columns(1).Alignment = dbgCenterGrid1.Columns(2).Alignment = dbgCenterGrid1.Columns(3).Alignment = dbgCenterGrid1.Columns(0).Caption = " Nama Penumpang"Grid1.Columns(1).Caption = " No.T4"Grid1.Columns(2).Caption = "Tgl.Beli Tiket"Grid1.Columns(3).Caption = "Jam Beli Tiket"Grid1.Columns(4).Caption = " Asal"If dtptgl1 = dtptgl2 Then gg = Format(dtptgl1)Else gg = Format(dtptgl1) + " s/d " + Format(dtptgl2)End IfEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 29
  30. 30. If RsTampil.RecordCount > 0 Then Grid1.Enabled = True xpcetak.Enabled = True Grid1.Caption = "Penumpang Yg Batal Berangkat Tgl. " + gg lbljml.Caption = RsTampil.RecordCountElse Grid1.Enabled = False xpcetak.Enabled = False lbljml.Caption = RsTampil.RecordCountEnd IfEnd Sub-----------------------------------------------------------------------------------------------------------------------------------Desain Laporan Penumpang pada Crystal Report seperti gambar berikut ini :----------------------------------------------------------------------------------------------------------------------------------- Form Kosongkan Tempat – Frmubahstst4 xpubah xpkeluar edit xprefresh Grid1 cbostatus Opt1 Opt2Listing Frmubahstst4Public T1, B1, Th1 As IntegerDim RsTampil As New ADODB.RecordsetPrivate Sub edit_Click()If edit.Value = vbChecked Then akseseditElse tdkaktifEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 30
  31. 31. xpkeluar.SetFocusEnd IfEnd SubPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load()BukaDatabaseTampildatatdkaktifcbostatus.List(0) = "Terisi"cbostatus.List(1) = "Pesan"Grid1.Enabled = Falsexpubah.Enabled = FalseEnd SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEnd SubPrivate Sub Tampildata()T1 = Left(Date, 2)B1 = Mid(Date, 4, 2)Th1 = Right(Date, 4)If cbostatus.Text = "Pesan" Then Set RsTampil = Nothing RsTampil.Open "select tblnotempat.jnstiket,tblpesant4.no4,tblpesant4.tglpesan fromtblnotempat,tblpesant4 where tblpesant4.no4=tblnotempat.no4 and tblpesant4.status=Pesan andtblpesant4.tglpesan < #" & B1 & "/" & T1 & "/" & Th1 & "# order by tblpesant4.no4 ", Koneksi,adOpenDynamic, adLockOptimistic Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 2000 Grid1.Columns(1).Width = 750 Grid1.Columns(2).Width = 1000 Grid1.Columns(1).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgCenter Grid1.Columns(0).Caption = " Jenis Tiket" Grid1.Columns(1).Caption = " No.T4" Grid1.Columns(2).Caption = " Tgl.Pesan" If RsTampil.RecordCount > 0 Then Grid1.Caption = "Data Tempat yang berstatus " + cbostatus Grid1.Enabled = True xpubah.Enabled = True Else Grid1.Caption = "ga ada tu datanya " Grid1.Enabled = False xpubah.Enabled = False End IfEnd IfIf cbostatus.Text = "Terisi" Then Set RsTampil = Nothing RsTampil.Open "select tblnotempat.jnstiket,tblbeli.no4,tblbeli.tglbeli from tblnotempat,tblbeli wheretblbeli.no4=tblnotempat.no4 and tblbeli.statust4=Terisi and tblbeli.tglbeli < #" & B1 & "/" & T1 & "/" &Th1 & "# order by tblbeli.no4 ", Koneksi, adOpenDynamic, adLockOptimistic Set Grid1.DataSource = RsTampil Grid1.Columns(0).Width = 2000 Grid1.Columns(1).Width = 750 Grid1.Columns(2).Width = 1000 Grid1.Columns(1).Alignment = dbgCenter Grid1.Columns(2).Alignment = dbgCenter Grid1.Columns(0).Caption = " Jenis Tiket" Grid1.Columns(1).Caption = " No.T4" Grid1.Columns(2).Caption = " Tgl.Terisi" If RsTampil.RecordCount > 0 Then Grid1.Caption = "Data Tempat yang berstatus " + cbostatus Grid1.Enabled = True xpubah.Enabled = TrueEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 31
  32. 32. Else Grid1.Caption = "ga ada tu datanya " Grid1.Enabled = False xpubah.Enabled = False End IfEnd IfEnd SubPrivate Sub Grid1_Click()xpubah.Enabled = TrueEnd SubPrivate Sub xpkeluar_Click()Unload Mefrmmenuutama.Enabled = TrueEnd SubPrivate Sub xprefresh_Click()TampildataEnd SubPrivate Sub cbostatus_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub xprefresh_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then SendKeys vbTab End IfEnd SubPrivate Sub xpubah_Click()If cbostatus.Text = Empty Then MsgBox "Pilih pilih status tempat!", , "Konfirmasi" cbostatus.SetFocus Exit SubEnd Ifxpubah.Enabled = Falsekk = Grid1.Columns(1)If opt1 = True Then If cbostatus.Text = "Terisi" Then Koneksi.Execute "update tblnotempat set status=Kosong where no4=" & kk & "and status=Terisi" Koneksi.Execute "update tblbeli set statust4=Ok where no4=" & kk & "and statust4=Terisi" End If If cbostatus.Text = "Pesan" Then Koneksi.Execute "update tblnotempat set status=Kosong where no4=" & kk & "and status=Pesan" Koneksi.Execute "update tblpesant4 set status=Batal where no4=" & kk & "and status=Pesan" End IfEnd IfIf opt2 = True Then If cbostatus.Text = "Terisi" Then Koneksi.Execute "update tblnotempat set status=Kosong where status=Terisi" Koneksi.Execute "update tblbeli set statust4=Ok where statust4=Terisi" End If If cbostatus.Text = "Pesan" Then Koneksi.Execute "update tblnotempat set status=Kosongwhere status=Pesan" Koneksi.Execute "update tblpesant4 set status=Batal where status=Pesan" End IfEnd IfTampildataEnd SubPrivate Sub aksesedit()Dim lihat, passlihat = "Masukkan Hak Akses Edit !"pass = InputBox(lihat, "Masukkan")If pass <> Login.TxtPass Then MsgBox "Hak akses anda tidak sesuai !", , "Ulangi lagi" edit.Value = novbchecked Exit SubEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 32
  33. 33. Else MsgBox "Hak akses terbuka!", , "Konfirmasi" edit.Visible = False aktif cbostatus.SetFocus Ada1 = TrueEnd IfEnd SubPrivate Sub tdkaktif()cbostatus.Enabled = False: xprefresh.Enabled = False: xpubah.Enabled = FalseEnd SubPrivate Sub aktif()cbostatus.Enabled = True: xprefresh.Enabled = True: xpubah.Enabled = TrueEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------ Form Ubah / Tambah Password - Frmubahpass TxtNm TxtPas cmdhapus cmdbatal cmdsimpan cmdkeluarListing FrmubahpassDim RsTampil As New ADODB.RecordsetPrivate Sub CmdBatal_Click() txtnm.Text = "" txtpas.Text = "" Cmdsimpan.Enabled = False Cmdhapus.Enabled = False txtnm.SetFocusEnd SubPrivate Sub CmdHapus_Click()Cmdhapus.Enabled = FalseRskasir.MoveFirst Rskasir.Find ("kasir = " & Trim(txtnm.Text) & "") If Rskasir.EOF Then Y = MsgBox("Nama kasir & Password tidak dikenal ???", vbOKOnly, "Konfirmasi") CmdBatal_Click Exit Sub Else If Rskasir.RecordCount = 1 Then Y = MsgBox("Maaf Password tidak dapat dihapus ?", vbOKOnly, "Konfirmasi") CmdBatal_Click Exit Sub Else Y = MsgBox("Benar Anda Ingin Hapus ???", vbYesNo + vbQuestion + vbDefaultButton2, "HapusPassword") Select Case Y Case vbYes Rskasir.Delete Case vbNo End Select End If End If CmdBatal_ClickEnd SubPrivate Sub cmdkeluar_Click() Unload MeEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 33
  34. 34. frmmenuutama.Enabled = TrueEnd SubPrivate Sub CmdSimpan_Click() IsiTabel CmdBatal_ClickEnd SubPrivate Sub Form_Activate()frmmenuutama.Enabled = FalseEnd SubPrivate Sub Form_Load() BukaDatabase txtnm.Text = "" txtpas.Text = "" Cmdsimpan.Enabled = False Cmdhapus.Enabled = FalseEnd SubPrivate Sub IsiTabel()Rskasir.MoveFirstRskasir.Find ("kasir = " & Trim(txtnm.Text) & "") If Rskasir.EOF Then Rskasir.AddNew Rskasir!Kasir = txtnm Rskasir!Pss = txtpas.Text Rskasir.Update Else Rskasir.Requery Rskasir!Kasir = txtnm Rskasir!Pss = txtpas.Text Rskasir.Update End IfEnd SubPrivate Sub Form_Unload(Cancel As Integer) Koneksi.CloseEnd SubPrivate Sub txtpas_Change() If Len(txtnm.Text) > 1 And Len(txtpas.Text) > 1 Then Cmdsimpan.Enabled = True Cmdhapus.Enabled = True Else Cmdsimpan.Enabled = False Cmdhapus.Enabled = False End IfEnd Sub----------------------------------------------------------------------------------------------------------------------------------- Form Menu Utama – Frmmenuutama Timer1 StbEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 34
  35. 35. Menu dan Sub Menu mnberkas mntiket mnnot4 mnlayanan mnpesantiket ubahnosts mnjual mnubahpass mnlap mnexit mnpen mnbackup mnutilityListing FrmMenuutamaDim jdl As StringPrivate Sub Form_Activate() stb.Panels(1).Text = "Kasir : " + Login.TxtNamap.Text stb.Panels(4).Text = "Aplikasi Penjualan Tiket Kapal"End SubPrivate Sub Form_Load() Me.Caption = "<<< Aplikasi Penjualan Tiket Kapal >>>" jdl = Me.Caption Login.Show Login.TxtNamap.SetFocus stb.Panels(1).Text = "Kasir : " + Login.TxtNamap.Text stb.Panels(1).Width = 2500 stb.Panels(2).Text = Format(Date, "Dddd, dd Mmmm yyyy") stb.Panels(2).Width = 2700 stb.Panels(4).Text = "Aplikasi Penjualan Tiket Kapal" stb.Panels(4).Width = 4500 stb.Panels(5).Width = 1000 stb.Panels(5).Text = "Admin"End SubPrivate Sub mnexit_Click()Y = MsgBox("Benar Anda Ingin Keluar Dari Sistem ?", vbYesNo + vbQuestion + vbDefaultButton1,"Konfirmasi") Select Case Y Case vbYes End Case vbNo End SelectEnd SubPrivate Sub mnjual_Click()frmjualtiket.ShowEnd SubPrivate Sub mnnot4_Click()frmnot4.ShowEnd SubEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 35
  36. 36. Private Sub mnpen_Click()frmcetakpen.ShowEnd SubPrivate Sub mnpesantiket_Click()frmpesant4.ShowEnd SubPrivate Sub mntiket_Click()frmbytiket.ShowEnd SubPrivate Sub mnubahpass_Click()FrmUbahPass.ShowEnd SubPrivate Sub Timer1_Timer() jdl = Mid(jdl, 2, Len(jdl) - 1) & Mid(jdl, 1, 1) Me.Caption = jdl stb.Panels(3).Text = Format(Time, "hh:mm:ss AM/PM") stb.Panels(3).Width = 1800End SubPrivate Sub ubahnosts_Click()frmubahstst4.ShowEnd Sub----------------------------------------------------------------------------------------------------------------------------- ------ Form Login Kasir – FrmLogin Txtnamap Txtpass cmdok cmdbatalListing FrmLoginPrivate Sub Form_Load()BukaDatabasefrmmenuutama.Enabled = Falsefrmmenuutama.ShowEnd SubPrivate Sub CmdBatal_Click() EndEnd SubPrivate Sub cmdok_Click() Rskasir.MoveFirst Rskasir.Find ("Kasir = " & Trim(TxtNamap.Text) & "") If Rskasir.EOF Then x = MsgBox("Maaf !, Nama Kasir Salah Ulangi Lagi ", 0 + 16, "Konfirmasi") TxtNamap.SetFocus Exit Sub End If If TxtNamap = Rskasir!Kasir And TxtPass = Rskasir!Pss Then Login.Hide Koneksi.Close frmmenuutama.Enabled = True frmmenuutama.Show Else x = MsgBox("Maaf !, Password Salah Ulangi Lagi ", 0 + 16, "Konfirmasi") TxtPass.SetFocus Exit Sub End IfEnd SubPrivate Sub Form_Unload(Cancel As Integer)Koneksi.CloseEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 36
  37. 37. End SubPrivate Sub TxtNamap_GotFocus() TxtNamap.SelStart = 0 TxtNamap.SelLength = Len(TxtNamap)End SubPrivate Sub TxtNamap_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys vbTab End IfEnd SubPrivate Sub TxtPass_GotFocus() TxtPass.SelStart = 0 TxtPass.SelLength = Len(TxtPass)End SubPrivate Sub TxtPass_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdok_Click End IfEnd Sub------------------------------------------------------------------------------------------------- ----------------------------------Database Penjualan Tiket – dbsTiket_kapal DATABASE PENJUALAN TIKET KAPAL BANGKEP TblpesanT4 TblBeli No. Nam a Field Type Width Keterangan No. Nam a Field Type Width Keterangan 1 No4 C 4 No tempat 1 No4 C 4 Nomor tempat 2 Tglpesan D Date Tanggal pesan tiket 2 Tglbeli D Date Tanggal beli 3 Nama C 50 Nama pemesan 3 Jambeli T Time Jam beli 4 Notelp C 13 No telpon / hp 4 Namapen C 50 Nama penumpang 5 Status C 15 Status tempat 5 Asal C 50 Asal penumpang 6 Jampesan T Time Jam pesan 6 Jnskel C 15 Jenis kelamin 7 Dari C 30 Tempat keberangkatan 7 Statust4 C 15 Status tempat 8 Tujuan C 30 Tujuan Kapal 8 Bayar N Single Bayaran 9 Kasir C 25 Nama Kasir 9 Statuspen C 15 Status penumpang 10 Dari C 30 Tempat keberangkatan 11 Tujuan C 30 Tujuan Kapal 12 Jenispen C 10 Jenis Penumpang 13 Kasir C 25 Nama Kasir TblByTiket TblNotempat No. Nam a Field Type Width Keterangan No. Nam a Field Type Width Keterangan 1 Jnstiket * C 15 Jenis Tiket 1 Jnstiket C 15 Jenis Tiket 2 Anak2 N Single Tiket Anak 2 No4 * C 4 No Tempat 3 Pelajar N Single Tiket Pelajar 3 Status C 15 Status tempat 4 Umum N Single Tiket Umum 5 Fasilitas C 150 Fasilitas Tblkasir No. Nam a Field Type Width Keterangan 1 Kasir C 25 Nama kasir 2 Pss C 10 Passw ordEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 37
  38. 38. Untuk pembuatan Database dapat anda gunakan Ms. Access, seperti tampilan gambar berikut ini :Jika direlasikan, maka akan menjadi :Ebook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 38
  39. 39. PROSES LAYANAN PENJUALAN TIKET KAPAL DELLSA SECARA UMUM MULAI TEMPAT PENJUALAN TIKET DIBUKA TIDAK BATALKAN INPUT YA TEMPAT ? LAYANAN PERIKSA T4 YA INGIN PESAN TIDAK BELI TIKET ? KELUAR KOSONG T4? YA TIDAK SUDAH BELUM PERIKSA T4 PESAN T4? KOSONG INPUT TEMPAT YA CEK T4 YANG DIPESAN TIDAK ADA ? YA BUAT TIKET DATABASE CETAK TIKET TIDAK CETAK BATALKAN PENUMPANG TIKET ? TIDAK YA CEK T4 SELESAI YANG ADA ? BATALKAN DIPAKAI TEMPAT YAEbook Pembuatan Aplikasi Tiket Kapal Menggunakan Visual Basic 6.0 Mudah dipelajari dan dikembangkan --------------------- 39

×