Hallo bertemu lagi dengan saya, kali ini kita akan membuat aplikasi yang tidak biasa(sepertinya) yaitu aplikasi management hotel. ya bisa dibilang belum hotel sih , masih dalam cakupan penginapan. Tetapi disini kita akan mengambil konsepnya aja. kodingannya bakal sedikit ribet, tapi kalo diliat lebih seksama pasti gampang untuk ngertiiinya. okay here we go...
ini adalah tampilan utama dari aplikasinya, ya untuk logo sih bisa ganti terserah kita ini cuma sebagai contoh aja. disini ada berbagai macam pilihan untuk menuju form yang lain. ada tombol room monitoring yang berfungsi sebagai memonitor kamar yang sudah di pesan pelanggan. selain itu check in dan check out ya sudah kita tau untuk keluar masuknya pelanggan ke dalam hotel. adapun transaction history untuk melihat laporan pencatatan keuangan kita.
*note sebelum lanjut: jangan bersedih jangan kesal, kesalahan bukan pada program anda, dan yak saya menulisnya costumer bukan customer... R.I.P English...
selanjutnya beralih ke form check in, disini kita dapat mengisi nomor pelanggan, nama, jenis kamar yang dipilih serta lamanya dia tinggal. untuk nomor kamar sendiri akan terpilih secara otomatis yang terdapat di database. untuk melakukan penyimpanan data pelanggan dapat menklik tombol save data. selanjutnya jika pelanggan sudah ingin masuk kedalam kamarnya, kita dapat menklik tombol check in yang akan mengupdate status kamar. oh iya 1 tombol lagi yaitu find. find akan melakukan pencarian terhadap pelanggan yang lama, jadi tak usah repot jika ada pelaggan lama yang ingin melakukan reservasi...
Pilihan kamar yang beragam |
ketika sudah melakukan check-in |
ketika pelanggan sudah ingin keluar/checkout dapat melakukannya di form checkout, tinggal masukan id pelanggan dan tekan find, otomatis data akan terisi sendiri. selanjutnya dapat menklik tombol checkout dan pelanggan sudah checkout. data kamar pun akan berubah menjadi tersedia lagi.
tampilan ketika sudah berhasil checkout |
sekarang tinggal melihat laporan transaksi yang telah terjadi. tinggal klik tombol transaction history pada main menu nanti akan terlihat seperti ini.
data yang sudah checkout akan masuk kedalam laporan. lengkap dengan pembayaran yang dilakukan oleh pelanggan.
jika anda kepo sama database saya :P
dan yak saya salah menulis customer -_- |
Data ruagan yang up-to-date |
Laporan transaksinya |
Sekian aplikasi yang saya buat kali ini, walaupun masih jauh dari sempurna tetapi programnya jalan dengan halus. sampai berjumpa di lain waktu... >RDV<
~~~~~~~~~~~~
______________________________________________________________________________
Main menu
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
list_kamar.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Check_In.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Check_Out.Show()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Application.Exit()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Form2.Show()
End Sub
End Class
____________________________________________________________________
Form Check-in
Imports System.Data
Imports System.Data.OleDb
Public Class Check_In
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Users\Radactive\Documents\All bout computer data\UAS VB 2015\UAS VB 2015\Hotel_data.accdb"
Dim objkoneksi As New OleDb.OleDbConnection(koneksi)
Private xReader As OleDbDataReader
Private Sub Button4_Click(sender As Object, e As EventArgs)
End Sub
Private Sub Check_In_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Hotel_dataDataSet.room' table. You can move, or remove it, as needed.
Me.RoomTableAdapter.Fill(Me.Hotel_dataDataSet.room)
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Me.Close()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
objkoneksi.Close()
objkoneksi.Open()
Dim tambah As String = "INSERT INTO Customer values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & DateTimePicker1.Value & "' , null)"
Dim oCmd = New OleDbCommand(tambah, objkoneksi)
oCmd.ExecuteNonQuery()
MsgBox("Saved!", MsgBoxStyle.Information)
objkoneksi.Close()
End Sub
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim x As String = TextBox1.Text
objkoneksi.Close()
objkoneksi.Open()
Dim ocmd As New OleDb.OleDbCommand("select * From Customer where ID='" + x + "'", objkoneksi)
xReader = ocmd.ExecuteReader
If xReader.HasRows Then
xReader.Read()
TextBox1.Text = xReader("ID")
TextBox2.Text = xReader("Custname")
TextBox3.Text = xReader("Address")
TextBox4.Text = xReader("Tel")
TextBox5.Text = xReader("Room")
TextBox6.Text = xReader("Daystaying")
DateTimePicker1.Value = xReader("Checkin")
Else
MsgBox("ID NOT FOUND", MsgBoxStyle.Exclamation)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
objkoneksi.Close()
objkoneksi.Open()
Dim update As String = "Update room set Availability= 'Occupied', Costumer='" & TextBox2.Text & "' where Room='" & TextBox5.Text & "'"
Dim oCmd = New OleDbCommand(update, objkoneksi)
oCmd.ExecuteNonQuery()
MsgBox("Enjoy your stay :)", MsgBoxStyle.Information)
objkoneksi.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If TextBox5.Text = "" Then
TextBox5.Text = "Occupied"
End If
End Sub
End Class
____________________________________________________________________
Form Check-out
Imports System.Data
Imports System.Data.OleDb
Public Class Check_Out
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Users\Radactive\Documents\All bout computer data\UAS VB 2015\UAS VB 2015\Hotel_data.accdb"
Dim objkoneksi As New OleDb.OleDbConnection(koneksi)
Private xReader As OleDbDataReader
Private Sub Check_Out_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Hotel_dataDataSet.room' table. You can move, or remove it, as needed.
Me.RoomTableAdapter.Fill(Me.Hotel_dataDataSet.room)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim x As String = TextBox1.Text
objkoneksi.Close()
objkoneksi.Open()
Dim ocmd As New OleDb.OleDbCommand("select * From Customer where ID='" + x + "'", objkoneksi)
xReader = ocmd.ExecuteReader
If xReader.HasRows Then
xReader.Read()
TextBox1.Text = xReader("ID")
TextBox2.Text = xReader("Custname")
TextBox4.Text = xReader("Room")
Else
MsgBox("CUSTOMER NOT FOUND", MsgBoxStyle.Exclamation)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
objkoneksi.Close()
objkoneksi.Open()
Dim update As String = "Update room set Availability= 'Avail', Costumer=null where Room='" & TextBox4.Text & "'"
Dim update2 As String = "Update Customer set Checkout='" & DateTimePicker1.Value & "'"
Dim oCmd = New OleDbCommand(update, objkoneksi)
Dim oCmd2 = New OleDbCommand(update2, objkoneksi)
oCmd.ExecuteNonQuery()
oCmd2.ExecuteNonQuery()
MsgBox("Thank You! :)", MsgBoxStyle.Information)
objkoneksi.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
End Class
____________________________________________________________________
Form Room Monitoring
Public Class list_kamar
Private Sub list_kamar_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Hotel_dataDataSet.room' table. You can move, or remove it, as needed.
Me.DataGridView1.DataSource = Nothing 'clear out the datasource for the Grid view
Me.RoomTableAdapter.Fill(Me.Hotel_dataDataSet.room) ' refill the table adapter from the dataset table
Me.DataGridView1.DataSource = Me.RoomBindingSource 'reset the datasource from the binding source
Me.DataGridView1.Refresh() 'should redraw with the new data
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
____________________________________________________________________
Form Laporan
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Hotel_dataDataSet.Transaction_history' table. You can move, or remove it, as needed.
Me.Transaction_historyTableAdapter.Fill(Me.Hotel_dataDataSet.Transaction_history)
Me.ReportViewer1.RefreshReport()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class