You are on page 1of 86

Hotel Management System Chapter #1 INTRODUCTION Theoretical background Hotel industry is one of the important sectors in modern life.

In hotel, number of guests is visited and wants to book a room. But maintaining their record manually is a teditious task. Currently, the hotels are facing a number of problems that leads to customer dissatisfaction. Due to low performance a hotel cant provide better service in time. A large time is being spent towards getting information about staffs that are free, in duty or in absent as well as information about guests. Suppose the record was damage the admin face louts of problem for all the information. So we design software which is to decrease the problem. In our project we design a form which is to give the guest a report and in this report a payment details & all information about that guest. Easily maintain the staff record in the hotel sector & maintain the room details. Objects It reduces the time complexity. It gives better & equal services to the hotel. It gives the officers better to manage the transaction. Scope: It is used in every star hotel. It is used in lodge sector. It is used in any apartment.
Page - 1 -

Hotel Management System

REQUIREMENT AND ANALYSIS


Problem Definition This project is a desktop application that can be run on a single system or on a LAN. This project solves the problems faced in hotel industry, from registering customers to searching and managing staffs. Requirement Specification 1. The project need to be secure, that is it should authenticate and authorize resources to its users only. 2. Guest/customer has to be registered. 3. Staffs must be engaged for guest. 4. Daily report on guest/customer need to be produced with details. 5. Search on room available should be produced on instance. Planning and Scheduling Planning is process of determining the guidelines on which action to be taken. In the planning process we must define the time when to start and when to complete a given task. Planning and scheduling can be represented using

Page - 2 -

Hotel Management System PERT CHART (Program Evaluation Review Technique) PERT chart is organized for events, activities or tasks. It is a scheduling device that shows graphically the order of the tasks to be performed.It enables the calculation of the critical path. The time and cost associated along a path is calculated and the path requires the greatest amount of elapsed time in critical path.
Design Database Part Code database Part Integrate and Test Code GUI Part

Specification

Design GUI part

Implementation Write User Manual

Figure2: PERT Chart representation

Page - 3 -

Hotel Management System GANTT CHART It is also known as Bar chart is used exclusively for scheduling purpose. It is a project controlling technique. It is used for scheduling. Budgeting and resourcing planning. A Gantt is a bar chart with each bar representing activity. The bars are drawn against a time line. The length of time planned for the activity. The Gantt chart in the figure shows the gray parts is slack time that is the latest by which a task has been finished.
5-19 MAR 2011 21-23 DEC 2011 MARCH 10 Specification Design Database Part 5 -30 MAY 2011 1-15 JUNE 11 JUN 18

Design GUI Part

Modulation

CODE DATABASE PART

CODE GUI PART

BLACK BOX TESTING

INTEGRATE AND TEST

IMPLEMENTATION

WRITE USER MANUAL

System Attributes

FIGURE 3: GANTT CHART Page - 4 -

Hotel Management System

Hardware Requirements The project Hotel Management System can be executed in a system having the following hardware and software configurations: Pentium/Celeron microprocessor. 512 MB SDRAM. 2.1GB secondary memory. VGA display card. Monitor. Keyboard. Mouse.

Software Requirements to implement Windows x (95,98,98se , 2000,XP sp 1,2 ,NT, or higher) Microsoft .net Framework ver. 2.0 Sql Server 2005

Page - 5 -

Hotel Management System

Preliminary product descriptions Basic Input to the System Guest Registration Staff entry Room allocation Item add Relative entry Payment entry Room Charges Room entry Country entry These are all the system forms where the outside world data or data regarding the trains or stations are entered in to the system database as per the requirement specification and train or station details. All the data received by this forms are stored and processed for further applications and performing other prepared records, pay slips, cancellation forms, reservation forms etc

Page - 6 -

Hotel Management System

Basic Output From the System Guest Search Staff Search Item Order Manage User Item bill

Conceptual Modeling A conceptual data model is a representation of organizational data. The purpose of a conceptual data model is to show as many rules about the meaning and interrelationship among data as are possible. Conceptual data modeling is one kind of data modeling and database design carried out throughout the systems development process. Entity Relationship Diagram E-R Model is a popular high level conceptual data model. This model and its variations are frequently used for the conceptual design of database application and many database design tools employ its concept.

Page - 7 -

Hotel Management System

A database that conforms to an E-R diagram can be represented by a collecton of tables in the relational system. The mapping of E-R diagram to the entities are:

Attributes Relations o Many-to-many o Many-to-one o One-to-many o One-to-one Weak entities Sub-type and super-type The entities and their relationshops between them are shown using the following conventions. An entity is shown in rectangle A diamond represent the relationship among number of entities. The attributes shown as ovals are connected to the entities or relationship by lines Diamond,oval and relationships are labeled.

Page - 8 -

Hotel Management System

E.R.DIAGRAM:Country Code Country Name Country State Name Belongs to Alloca te Pay s Has Payment Details Relative Details
name Phone no Guest id Arrival from

State Nam e

H as State H as

Guest book Has Guest id Rel name Relationship

Town details

Town Name

Room details
Tow n code

Guest name Occupation

Has

Books for

Receip t no

Amount

Guest id

Charges Staff Work as Designation

Staff id Page - 9 Staff name Contact no

Hotel Management System Chapter # 4

SYSTEM DESIGN
Software design is the first of three technical activities: design, code generation and testing. System design involves the development of logical and physical design for an information system that meets the system requirements developed by the system analysis process. System design involves the detailed design of input documents, output reports, database & processing procedure. Analysis phase focus on what needs to be done independent of how it done. During design decisions are made about, how the problem will be solved? Design is the highly creative phase in the software development where the designer plans how a software system should be produced in order to make it functionally reliable and easy to understand, modified and maintain. Each element of analysis mode provides information that is necessary to create the four-design model required for a complete specification of design. Design methodologies The logical methods for developing system that meet user requirements should be clearly designed. This led to Improve the productivity of analysis and programmers, Improve documentation and subsequent maintenance and enhancements,
Page -10-

Hotel Management System Cut down drastically on cost overruns and delays, Simplify design by segmentations Modularization details The above s/w tool is meant for analyzing the automation of poll which is composition of number of modules to reduce the complicity of the entire system. The term complicity is closely related to the program or project work, as the complicity go on increasing. It leads and more difficulties in understanding the problem structure and process logic, so it is good practice to divide the whole program into number of modules. BASIC MODULES The project Hotel Management system can be broadly divided into 4 modules. These are ; 1. Customer / guest 2. Staff module 3. Room 4. items

Page -11-

Hotel Management System Data Design Schema design and constraints STAFF DETAILS: Column Staff_id Staff name Country_code State_code Town_code Pin Contact_no Gender Age Designation_cod e User_ID Password Role GUEST BOOK: Column Guest_id Guest_name Country_code State_code Town_code Street_name Pin Phone_no Mobile_no Purpose Arrival_from Gender Age Occupation_code Arrival_date Data type Int Nvarchar Int Int Int Nvarchar Nvarchar Nvarchar Nvarchar text Nchar Char int int Datetime
Page -12-

Data type int Nvarchar int int Int int int Nchar Int int nchar nchar nchar

Hotel Management System Ariival_time char

ROOM ALLOCATION: Column Data type guest_id int Room_no int Arrival_date datetime Depart_date datetime House_keeping_code int Room_service_code int Type_of_booking nchar Contact_type nchar RELATIVE DETAILS: Column Data type Guest_id Int Rel_id Int relative_name Nvarchar age Int gender Nchar Relation_with_gues Nchar t

Column Occupation_code Occupation_name Column Designation_code Designation_name

Data type Int nvarchar Data type Int nvarchar

OCCUPATION: DESIGNATION:

Page -13-

Hotel Management System ROOM DETAILS: Column Room_no Room_type_code Booking_status Data type nchar Int bit

ROOM CHARGES: Column Data type Sl_no int Room_type Nvarchar Single_rent money Double_rent money ITEM DETAILS: Column Item_code Item_name price ORDER DETAILS: Column Sl_no Item_code Quantity Order_no Amount BILL BOOK: Column Sl_no description Amount Bill_no Date_of_bill Guest_no Order_no Data type int Int Float Int Money Data type int Nvarchar Money Int Datetime Int Int Data type int Nvarchar money

Page -14-

Hotel Management System

VIEWS: GUEST DETAILS: VIEW ROOM ALLOCATED Column Guest_name Guest_id Mobile_no Phone_no Purpose Age Gender State_name Town_name Country_name Relative_name Relation_with_gues t Table Guest_book Guest_book Guest_book Guest_book Guest_book Guest_book Guest_book States Town_deatils Country Relative_details Relative_deatils

Column Guest_id Arrival_date Depart_date Room_no Room_type

Table Room_allocation Room_allocation Room_allocation Room_allocation Room_allocation

Column Guest_id Guest_name Item_code Item_name Price Quantity Amount Order_no Bill_no Date_of_bill

table Guest_book Guest_book Order_deatils Item_deatiils Item_deatils Order_details Order_details Bill_book Bill_book Bill_book

Page -15-

Hotel Management System

VIEW BILL REPORT:

Data Dictionary A data dictionary defines each term (data element) required during the analysis and design of a new system. Data elements can describe files, data flows or processes. For example, suppose you want to print the vendors name and address at the bottom of cheque. The data dictionary defines vendors name and address as follows: Street + City +
Page -16-

Hotel Management System State + Pin + Phone + Fax + E-Mail Major Symbols Used In Data Dictionary: = Equal to + And [ ] Either/ or ( ) Optional Entry

Rules for Data Dictionary Entries: i) Words should be defined to stand for what they mean and not the variable name by which they may be described in the program Ex: - s_name not ABCD or ABC05 ii) Each word must be unique; we cant have two definition of the same s_name (Client name) iii) Aliases or synonyms are allowed when two or more entries show the same meaning. A vendor number may also be called a customer number. However, aliases should be used only when absolutely necessary. iv) Self defining words should not be decomposed.
Page -17-

Hotel Management System Data dictionary allows analysis to define precisely what they mean by a particular file, data flow or process. Some commercial software packages usually called Data Dictionary Systems, help analysts maintain their dictionaries with the help of their computer. There are two types of data dictionary (a) Integrated (b) Stand alone. Structured Design It is a data flow based methodology. The approach begins with a system specification that identifies inputs and outputs and describes the functional aspects of the system. The system specifications then are used as a basis for the graphic representations.

Data Flow Diagram: Data flow gram is the starting point of the design phase that functionally decomposes the requirements specification. From the DFD, the next step is the definition of the modules and their relationships to one another in a form called a structured chart. Structured design partitions a program into small independent modules. The partitions can be organized as a hierarchy that approximates a model of the system in a top down manner as detained below. Structured design is an attempt
Page -18-

Hotel Management System to minimize complexity and make problem manageable by decomposing it into smaller segments, which is called modularization.

System Design Diagram


6 1 7 8

Data Strurcture
2

Design Specification

Design Phase walkthough

Implementation

Allocation of Resources

Program Design
3 4 5

System Test

Program Test Requirement

System Interface Speci.

Input Design Once the output requirements have been finalized, the next most important step is to find out what data are need to produced the desired outputs. Inaccurate data are the most common cause of the errors in data processing. Errors entered by data entry operators can be controlled by input design. Input design is the process of converting the user-originated inputs to a computer-based format.

The main objectives of input design are:


Page -19-

Hotel Management System Identifying the basic document Controlling amount of input Avoiding delays Avoiding error in data Avoiding extra steps Keeping the process simple Data Flow Diagram (DFD) Data flow gram is the starting point of the design phase that functionally decomposes the requirements specification. A DFD consists of a series of bubbles joined by lines. The bubbles represent data transformation and the lines represent data flows in the system. A DFD describes what data flow rather than how they are processed, so it does not hardware, software and data structure. In our project various DFDs are drawn to describe the system requirements. The data flow diagram is a graphical description of a systems data and how to process transform the data is known as Data Flow Diagram (DFD).

p ro c e s s

D a ta s to re

S o u r c e /s in k D a t a F lo w D e M a rc o & Y o u rd o n s y m b o ls

Page -20-

G a n e & S a rs o n s y m b o ls

Hotel Management System

Unlike details flow chart, DFDs dont supply detail descriptions of modules that graphically describe a systems data and how the data interact with the system. Data flow diagram number of symbols and the following symbols are of by DeMarco. There are seven rules for construct a data flow diagram. i) Arrows should not cross each other. ii) Squares, circles and files must wears names. iii) Decomposed data flows must be balanced. iv) No two data flows, squares or circles can be the same names. v) Draw all data flows around the out side of the diagram. vi) Choose meaningful names for data flows, processes & data stores. vii) Control information such as record units, password and validation

requirements are not penitent to a data flow diagram. (Context Digram) 0 Level

Page -21-

Hotel Management System

Request for room & services Guest Allocates room and services

Hotel Management System Reports Manager

Context Digram(1 level)

Guest

Request for a room Reports availability or non availability

Room Availabilit y

Registers Allocates

Guest Book Bill Book

Room Details

Bill

Item details Order Items Processes order Order details Provides Items Show Items

Manager Staff

Bill

Presents

Page -22-

Hotel Management System

Use Case A use case Diagram shows the relationship among use cases within a system or other semantic entity and their actors. Use cases diagram shows actors and use cases together with their relationship. It represents functionality of a system or classifier, like a system or a class as manifested to external interactions with the system or the classifier.

Use case diagram:

Staff details

Manage User

Item Details Admin Staff

Bill Book

User Interface Design Splash Screen


Page -23-

Hotel Management System

Login

Main form :

Page -24-

Hotel Management System

Guest Registration Form

payment details
Page -25-

Hotel Management System

country Entry

State Entry Form


Page -26-

Hotel Management System

Town Entry

Page -27-

Hotel Management System Room Entry

Staff Details
Page -28-

Hotel Management System

Occupation Entry

Edit Menu Change Password


Page -29-

Hotel Management System

View Menu Guest Search

Room Available

Page -30-

Hotel Management System

Room Allocation

Item Menu
Page -31-

Hotel Management System Item Add

Item Order

Bill Book
Page -32-

Hotel Management System

Manage User

Page -33-

Hotel Management System Reports Staff Report

Gusest Report

Page -34-

Hotel Management System

Security Issues The Project entitled hotel management system is quite secure on the following ground. Application secure: The application at first asks for user id and password. Unless a valid user id and password has been given, a user cant be accessed. Database secure: The backend for this application is SQL server 2005, which has its own security system. It also checks authentication by providing login form.


Page -35-

Hotel Management System

Chapter # 5

IMPLEMENTATION AND TESTING

Implementation Approaches First the login form will display then the authenticated user login and enter into the next form if he/she is a valid user. then main form will display , from the menu the valid user entry all the useful information which is need to the project entitled Hotel Management System.

Page -36-

Hotel Management System Coding Details and Code Efficiency SPLASH FORM Public Class frmsplash Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Hide() Timer1.Enabled = False frmlogin.Show() End Sub Private Sub frmsplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim myobj As New Databasecollect Label7.Text = myobj.GetHotelName End Sub End Class LOGIN Public Class frmlogin Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myobj As New Databasecollect If myobj.CheckUser(TextBox1.Text, TextBox2.Text) Then Dim rl As String = myobj.getrole(TextBox1.Text, TextBox2.Text).Trim If rl = "Administrator" Then frmmain.AdministratorToolStripMenuItem.Enabled = True ElseIf rl = "User" Then
Page -37-

Hotel Management System

frmmain.AdministratorToolStripMenuItem.Enabled = False End If frmmain.Show() Me.Hide() Else MessageBox.Show("Invalid user! Try again!!!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning) End If End Sub End Class

MAIN FORM Public Class frmmain Private Sub CountryEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountryEntryToolStripMenuItem.Click frmcountry.Show() End Sub Private Sub guestregistrationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles guestregistrationToolStripMenuItem.Click Dim x As New frmguestregistration x.MdiParent = Me x.Show() End Sub Private Sub RoomAllocationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Page -38-

Hotel Management System frmRoomAllocation.Show() End Sub Private Sub PaymentEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaymentEntryToolStripMenuItem.Click frmPaymentDetail.Show() End Sub Private Sub StateEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StateEntryToolStripMenuItem.Click frmstate.Show() End Sub Private Sub TownEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TownEntryToolStripMenuItem.Click frmtown.Show() End Sub Private Sub RoomEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RoomEntryToolStripMenuItem.Click frmroomavailable.Show() End Sub Private Sub StaffDetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaffDetailsToolStripMenuItem.Click frmStaffDetails.Show() End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Page -39-

Hotel Management System guestregistrationToolStripMenuItem_Click(New Object, New EventArgs) End Sub Private Sub ChangePasswordToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangePasswordToolStripMenuItem1.Click frmchangepsd.Show() End Sub Private Sub ItemAddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemAddToolStripMenuItem.Click frmitemadd.Show() End Sub Private Sub ItemOrderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemOrderToolStripMenuItem.Click frmorder.Show() End Sub Private Sub ItemBillToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemBillToolStripMenuItem.Click frmbillbook.Show() End Sub Private Sub GuestSearchToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuestSearchToolStripMenuItem.Click frmguestsearch.Show() End Sub
Page -40-

Hotel Management System

Private Sub RoomAvaiableToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RoomAvaiableToolStripMenuItem.Click frmroomavailable.Show() End Sub Private Sub RoomDetailsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RoomDetailsToolStripMenuItem1.Click frmRoomAllocation.Show() End Sub Private Sub GuestReportToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuestReportToolStripMenuItem1.Click FRMGUESTLIST.Show() End Sub Private Sub StaffReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaffReportToolStripMenuItem.Click staffreport.Show() End Sub Private Sub ItemReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItemReportToolStripMenuItem.Click frmbillreport.Show() End Sub Private Sub CreateUserToolStripMenuItem_Click(ByVal sender As
Page -41-

Hotel Management System System.Object, ByVal e As System.EventArgs) Handles CreateUserToolStripMenuItem.Click manageuser.Show() End Sub Private Sub BillToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillToolStripMenuItem.Click frmbillsummary.Show() End Sub Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click frmoccupation.Show() End Sub Private Sub ExitToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() End Sub End Class

Page -42-

Hotel Management System GUEST CODE Public Class frmguestregistration Dim MYOBJ As New Databasecollect Dim isedit As Boolean Private Sub guestregistrationform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MYOBJ.fillcombo("country", "*", "", cmbcountry) MYOBJ.fillcombo("occupations", "*", "", cmboccupation) txtarrivetime.Text = TimeOfDay DataGridView1.DataSource = MYOBJ.getrowsfromtable("guest_book", "*", "") End Sub Private Sub ComboBox2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbstate.GotFocus MYOBJ.fillcombo("states", "*", "country_code=" & cmbcountry.SelectedValue.ToString, cmbstate) End Sub Private Sub ComboBox3_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbcity.GotFocus MYOBJ.fillcombo("town_details", "*", "state_code=" & cmbstate.SelectedValue.ToString, cmbcity) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' check if all data has been filled If txtgname.TextLength = 0 Then

Page -43-

Hotel Management System MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If Dim values As String = "", gndr As String = "" If (RadioButton1.Checked) Then gndr = "M" ElseIf RadioButton2.Checked Then gndr = "F" End If values = txtguid.Text & ",'" & txtgname.Text & "'," & cmbcountry.SelectedValue & "," & cmbstate.SelectedValue & "," & cmbcity.SelectedValue & ",'" & txtstreet.Text & "','" & txtpin.Text & "','" & txtcontact.Text & "','" & txtmobile.Text & "','" & txtpurpose.Text & "','" & txtarrive.Text & "','" & dtdate.Value & "','" & txtarrivetime.Text & "','" & gndr & "'," & txtage.Text & "," & cmboccupation.SelectedValue MYOBJ.SaveData("insert", "guest_book", "", values, ) DataGridView1.DataSource = MYOBJ.getrowsfromtable("guest_book", "*", "") Button1.Enabled = True Button4.Enabled = True Button2.Enabled = False Button3.Enabled = False End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Button1.Enabled = True Button4.Enabled = True Button2.Enabled = False Button3.Enabled = False End Sub

Page -44-

Hotel Management System Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True txtguid.Text = MYOBJ.GetnextNO("GUEST_BOOK", "GUEST_ID") txtgname.Focus() Button2.Enabled = True Button1.Enabled = False Button3.Enabled = True Button4.Enabled = False txtgname.Clear() txtstreet.Clear() txtpin.Clear() txtcontact.Clear() txtmobile.Clear() txtpurpose.Clear() txtarrive.Clear() txtarrivetime.Clear() txtage.Clear() txtarrivetime.Text = TimeOfDay End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click frmRelatives.TextBox1.Text = txtguid.Text frmRelatives.Show() End Sub Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click txtguid.Text = DataGridView1.SelectedRows.Item(0).Cells(0).Value End Sub End Class
Page -45-

Hotel Management System

Payment Details Public Class frmPaymentDetail Dim myobj As New Databasecollect Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True TextBox5.Text = myobj.GetnextNO("payment_details", "receipt_no") TextBox1.Focus() Button2.Enabled = True Button1.Enabled = False Button3.Enabled = True TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim values As String = "" Dim mop As String If TextBox3.TextLength = 0 Then MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If If (RadioButton1.Checked) Then mop = "cash" ElseIf RadioButton2.Checked Then mop = "credit" End If Button1.Enabled = True Button2.Enabled = False
Page -46-

Hotel Management System values = TextBox5.Text & ",'" & DateTimePicker1.Value & "'," & TextBox1.Text & "," & TextBox2.Text & ",'" & mop & "'," & ComboBox1.SelectedValue myobj.SaveData("insert", "payment_details", "receipt_no,payment_date,guest_id,guest_name,mode_of_ payment,amount,towards,", values, ) DataGridView1.DataSource = myobj.getrowsfromtable("payment_details", "*", "") End Sub Private Sub frmPaymentDetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("payment_details", "*", "") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.F2 Then frmguestsearch.frmnm = "payment" frmguestsearch.Show() End If End Sub End Class

Page -47-

Hotel Management System Country Entry Public Class frmcountry Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click isedit = False GroupBox1.Enabled = True TextBox2.Focus() Button1.Enabled = False Button2.Enabled = True Button3.Enabled = False Button4.Enabled = False TextBox1.Text = myobj.GetnextNO("country", "country_code") TextBox2.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox2.TextLength = 0 Then MessageBox.Show("u must fill the country name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Focus() Else If isedit = True Then myobj.SaveData("update", "country", "", "country_name='" & TextBox2.Text & "'", "country_code=" & TextBox1.Text) Else myobj.SaveData("insert", "country", "country_name", "'" & TextBox2.Text & "'") End If

Page -48-

Hotel Management System DataGridView1.DataSource = myobj.getrowsfromtable("country", "*", "") Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True GroupBox1.Enabled = False End If End Sub Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress If Not (e.KeyChar Like "[A-Z a-z]" Or e.KeyChar = ControlChars.Back) Then e.Handled = True End If End Sub Private Sub frmcountry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("country", "*", "") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode
Page -49-

Hotel Management System TextBox2.Text = myobj.GETCOLUMNVALUE("country", "country_name", "country_code=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "country", "", "", "country_code=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("country", "*", "") End If End Sub End Class

Page -50-

Hotel Management System State Entry Public Class frmstate Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click isedit = False GroupBox1.Enabled = True TextBox2.Focus() TextBox1.Enabled = False Button1.Enabled = False Button2.Enabled = True Button3.Enabled = False Button4.Enabled = False TextBox1.Clear() TextBox1.Text = myobj.GetnextNO("states", "state_code") TextBox2.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox2.TextLength = 0 Then MessageBox.Show("u must fill the states name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Focus() Else If isedit = True Then myobj.SaveData("update", "states", "", "state_name='" & TextBox2.Text & "',country_code=" & ComboBox1.SelectedValue.ToString, "state_code=" & TextBox1.Text) Else myobj.SaveData("insert", "states", "state_name,country_code", "'" & TextBox2.Text & "'," & ComboBox1.SelectedValue.ToString())
Page -51-

Hotel Management System End If DataGridView1.DataSource = myobj.getrowsfromtable("states", "*", "") Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True GroupBox1.Enabled = False End If End Sub Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress If Not (e.KeyChar Like "[A-Z a-z]" Or e.KeyChar = ControlChars.Back) Then e.Handled = True End If End Sub Private Sub frmcountry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("states", "*", "") myobj.fillcombo("country", "*", "", ComboBox1) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True
Page -52-

Hotel Management System Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode TextBox2.Text = myobj.GETCOLUMNVALUE("states", "state_name", "state_code=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "states", "", "", "state_code=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("states", "*", "") End If End Sub End Class

Page -53-

Hotel Management System

Town Entry Public Class frmtown Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click isedit = False GroupBox1.Enabled = True TextBox2.Focus() TextBox1.Enabled = False Button1.Enabled = False Button2.Enabled = True Button3.Enabled = False Button4.Enabled = False TextBox1.Clear() TextBox1.Text = myobj.GetnextNO("town_details", "town_code") TextBox2.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox2.TextLength = 0 Then MessageBox.Show("u must fill the states name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Focus() Else If isedit = True Then myobj.SaveData("update", "town_details", "", "town_name='" & TextBox2.Text &
Page -54-

Hotel Management System "',town_code=" & ComboBox1.SelectedValue.ToString, "town_code=" & TextBox1.Text) Else myobj.SaveData("insert", "town_details", "town_name,state_code", "'" & TextBox2.Text & "'," & ComboBox1.SelectedValue.ToString()) End If DataGridView1.DataSource = myobj.getrowsfromtable("town_details", "*", "") Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True GroupBox1.Enabled = False End If End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress If Not (e.KeyChar Like "[A-Z a-z]" Or e.KeyChar = ControlChars.Back) Then e.Handled = True End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub frmtown_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("town_details", "*", "") myobj.fillcombo("states", "*", "", ComboBox1) End Sub
Page -55-

Hotel Management System

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode TextBox2.Text = myobj.GETCOLUMNVALUE("town_details", "town_name", "town_code=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "town_details", "", "", "town_code=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("town_details", "*", "") End If End Sub End Class
Page -56-

Hotel Management System

Room Details Public Class Room_Detail_Form Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True TextBox1.Focus() Button1.Enabled = False Button2.Enabled = True TextBox1.Clear() TextBox1.Text = myobj.GetnextNO("room_details", "room_type_code") End Sub Private Sub Room_Detail_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("room_charges", "*", "") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode TextBox2.Text = myobj.GETCOLUMNVALUE("room_charges", "room_type", "sl_no=" & ccode)
Page -57-

Hotel Management System TextBox3.Text = myobj.GETCOLUMNVALUE("room_charges", "single_rent", "sl_no=" & ccode) TextBox4.Text = myobj.GETCOLUMNVALUE("room_charges", "double_rent", "sl_no=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim values As String = "" If TextBox2.TextLength = 0 Then MessageBox.Show("u must fill the data", "!Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error) End If If TextBox3.TextLength = 0 Then MessageBox.Show("u must fill the data", "!Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error) End If If TextBox4.TextLength = 0 Then MessageBox.Show("u must fill the data", "!Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error) End If TextBox2.Focus() If isedit = True Then End If values = "'" & TextBox2.Text & "'," & TextBox3.Text & "," & TextBox4.Text & "" myobj.SaveData("insert", "room_charges", " room_type, single_rent, double_rent", values)
Page -58-

Hotel Management System DataGridView1.DataSource = myobj.getrowsfromtable("room_charges", "*", "") End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "room_charges", "", "", "sl_no=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("room_charges", "*", "") End If TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub End Class

Page -59-

Hotel Management System Staff Details Public Class frmStaffDetails Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub frmStaffDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("staff_details", "*", "") End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True txtsID.Text = myobj.GetnextNO("staff_details", "staff_id") txtsnm.Focus() Button2.Enabled = True Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True Button5.Enabled = True txtsnm.Clear() txtage.Clear() txtcno.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try ' check if all data has been filled ' IF VALID If txtsnm.TextLength = 0 Then MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If
Page -60-

Hotel Management System If txtage.TextLength = 0 Then MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If txtcno.TextLength = 0 Then MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If txtp.TextLength = 0 Then MessageBox.Show("U Must Fill All The Data ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If Dim values As String = "", gndr As String = "" If (RadioButton1.Checked) Then gndr = "M" ElseIf (RadioButton2.Checked) Then gndr = "F" End If values = "'" & gndr & "','" & txtsnm.Text & "'," & cmbdes.SelectedValue & "," & cmbcnm.SelectedValue & "," & cmbsnm.SelectedValue & "," & cmbtnm.SelectedValue & "," & txtp.Text & "," & txtage.Text & "," & txtcno.Text myobj.SaveData("insert", "staff_details", "gender,staff_name,designation_code,country_code,stat e_code,town_code,pin,age,contact_no", values, ) DataGridView1.DataSource = myobj.getrowsfromtable("staff_details", "*", "")
Page -61-

Hotel Management System

Catch ex As Exception MessageBox.Show(ex.Message) End Try Button1.Enabled = True Button4.Enabled = True Button2.Enabled = False Button3.Enabled = True Button5.Enabled = False txtsnm.Clear() txtage.Clear() txtcno.Clear() txtp.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value txtsnm.Text = myobj.GETCOLUMNVALUE("staff_details", "staff_name", "staff_id=" & ccode) txtage.Text = myobj.GETCOLUMNVALUE("staff_details", "age", "staff_id=" & ccode) txtcno.Text = myobj.GETCOLUMNVALUE("staff_details", "contact_no", "staff_id=" & ccode) ''txteid.Text = myobj.GETCOLUMNVALUE("staff_details", "user_id", "staff_id=" & ccode) txtp.Text = myobj.GETCOLUMNVALUE("staff_details", "pin", "staff_id=" & ccode) '' txtpsw.Text = myobj.GETCOLUMNVALUE("staff_details", "password", "staff_id=" & ccode) txtsnm.Focus() isedit = True Button2.Enabled = True
Page -62-

Hotel Management System End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "staff_details", "", "", "staff_id=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("staff_details", "*", "") End If txtsnm.Clear() txtage.Clear() txtcno.Clear() ''txteid.Clear() txtp.Clear() ''txtpsw.Clear() '' txtrepsw.Clear() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub cmbdes_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdes.GotFocus myobj.fillcombo("designation_details", "*", "", cmbdes) End Sub Private Sub cmbcnm_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbcnm.GotFocus myobj.fillcombo("country", "*", "", cmbcnm)
Page -63-

Hotel Management System End Sub Private Sub cmbsnm_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbsnm.GotFocus myobj.fillcombo("states", "*", "country_code=" & cmbcnm.SelectedValue.ToString, cmbsnm) End Sub Private Sub cmbtnm_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbtnm.GotFocus myobj.fillcombo("town_details", "*", "state_code=" & cmbsnm.SelectedValue.ToString, cmbtnm) End Sub End Class Occupation Entry Public Class frmoccupation Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox2.TextLength = 0 Then MessageBox.Show("u must fill the occupation name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Focus() Else If isedit = True Then myobj.SaveData("update", "occupations", "", "occupation_name='" & TextBox2.Text & "'", "occupation_code=" & TextBox1.Text) Else myobj.SaveData("insert", "occupations", "occupation_name", "'" & TextBox2.Text & "'")
Page -64-

Hotel Management System End If DataGridView1.DataSource = myobj.getrowsfromtable("occupations", "*", "") Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True GroupBox1.Enabled = False End If End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress If Not (e.KeyChar Like "[A-Z a-z]" Or e.KeyChar = ControlChars.Back) Then e.Handled = True End If End Sub Private Sub frmoccupation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("occupations", "*", "") End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click isedit = False GroupBox1.Enabled = True TextBox1.Focus() Button1.Enabled = False Button2.Enabled = True TextBox1.Text = myobj.GetnextNO("occupations", "occupation_code") TextBox2.Clear() End Sub
Page -65-

Hotel Management System Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click GroupBox1.Enabled = True Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode TextBox2.Text = myobj.GETCOLUMNVALUE("occupations", "occupation_name", "occupation_code=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "occupations", "", "", "occupation_code=" & ccode) DataGridView1.DataSource = myobj.getrowsfromtable("occupations", "*", "") End If End Sub End Class

Page -66-

Hotel Management System Change Password Public Class frmchangepsd Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'CHECK IF VALID USER Dim MYOBJ As New Databasecollect If MYOBJ.CheckUser(TextBox1.Text, TextBox2.Text) Then ' IF VALID If TextBox3.Text = TextBox4.Text Then ' new password matche MYOBJ.SaveData("update", "staff_details", "", "password='" & TextBox3.Text & "'", "user_id='" & TextBox1.Text & "' and password='" & TextBox2.Text & "'") MessageBox.Show("Password changed successfully") Else ' password not match MessageBox.Show("Password Mismatch", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox3.Clear() TextBox4.Clear() TextBox3.Focus() End If Else 'IF NOT VALID MessageBox.Show("Invalid User!!! Access Denied.", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox1.Clear() TextBox2.Clear() TextBox1.Focus() End If
Page -67-

Hotel Management System End Sub End Class Item Add Public Class frmitemadd Dim myobj As New Databasecollect Dim isedit As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True isedit = False TextBox1.Enabled = True TextBox2.Enabled = True TextBox1.Focus() Button1.Enabled = False Button2.Enabled = True Button3.Enabled = False Button4.Enabled = False TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.TextLength = 0 Then MessageBox.Show("u must fill the item name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) TextBox2.Focus() End If If TextBox1.TextLength = 0 Then MessageBox.Show("u must fill the item name", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error) If isedit = True Then End If
Page -68-

Hotel Management System myobj.SaveData("update", "item_details", "price", "='" & TextBox2.Text & "'", "item_name='" & TextBox1.Text) Else myobj.SaveData("insert", "item_details", "item_name,price", "'" & TextBox1.Text & "'," & TextBox2.Text) End If Button2.Enabled = False Button1.Enabled = True Button3.Enabled = True Button4.Enabled = True End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value TextBox1.Text = ccode TextBox2.Text = myobj.GETCOLUMNVALUE("item_details", "item_name", "price=" & ccode) TextBox2.Focus() isedit = True Button2.Enabled = True TextBox1.Enabled = True TextBox2.Enabled = True End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim ccode As Integer = DataGridView1.SelectedRows.Item(0).Cells(0).Value Dim response As MsgBoxResult = Nothing response = MessageBox.Show("Are you sure to Delete ?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If response = MsgBoxResult.Yes Then myobj.SaveData("delete", "item_details", "", "", "item_code=" & ccode)
Page -69-

Hotel Management System DataGridView1.DataSource = myobj.getrowsfromtable("item_details", "*", "") End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub frmitemadd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("item_details", "*", "") End Sub End Class Item Order Public Class frmorder Dim myobj As New Databasecollect Dim i As Integer = 0 Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.F2 Then frmguestsearch.frmnm = "frmorder" frmguestsearch.Show() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim k As Integer For k = 0 To ListView1.Items.Count - 1
Page -70-

Hotel Management System myobj.SaveData("insert", "order_details", "item_code,quantity,order_no,amount", ListView1.Items(k).Text & "," & ListView1.Items(k).SubItems(2).Text & "," & TextBox5.Text & "," & ListView1.Items(k).SubItems(3).Text, "") Next frmbillbook.TextBox1.Text = TextBox5.Text frmbillbook.TextBox3.Text = lbltot.Text frmbillbook.TextBox4.Text = TextBox1.Text frmbillbook.Show() GroupBox1.Enabled = False End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True TextBox5.Text = myobj.GetnextNO("order_details", "order_no") TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() 'TextBox5.Clear() i = 0 End Sub Private Sub frmorder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myobj.fillcombo("item_details", "*", "", ComboBox1) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Page -71-

Hotel Management System

ListView1.Items.Add(ComboBox1.SelectedValue.ToString( )) ListView1.Items(i).SubItems.Add(ComboBox1.Text) ListView1.Items(i).SubItems.Add(TextBox2.Text) ListView1.Items(i).SubItems.Add(TextBox4.Text) i += 1 calculattotal() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim j As Integer For j = 0 To ListView1.SelectedIndices.Count - 1 ListView1.Items.RemoveAt(ListView1.SelectedIndices(j) .ToString) i -= 1 Next calculattotal() End Sub Private Sub calculattotal() Dim j As Integer Dim tot As Double = 0 For j = 0 To ListView1.Items.Count - 1 tot += ListView1.Items(j).SubItems(3).Text Next lbltot.Text = Format(tot, "0.00") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub
Page -72-

Hotel Management System Private Sub ComboBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.LostFocus TextBox2.Text = myobj.GETCOLUMNVALUE("item_details", "price", "item_code=" + ComboBox1.SelectedValue.ToString()) End Sub Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.LostFocus TextBox4.Text = Format(TextBox2.Text * TextBox3.Text, "0.00") End Sub End ClasS Item Bill Public Class frmbillbook Dim myobj As New Databasecollect Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim values As String = "", mop As String If (RadioButton1.Checked) Then mop = "cash" ElseIf RadioButton2.Checked Then mop = "credit" End If myobj.SaveData("insert", "bill_book", "description,amount,bill_no,date_of_bill,guest_id,ord er_no", "'" & mop & "'," & TextBox3.Text & "," & TextBox2.Text & ",'" & DateTime.Today & "'," & TextBox4.Text & "," & TextBox1.Text, "") frmbillreport.ordno = TextBox1.Text frmbillreport.Show() End Sub

Page -73-

Hotel Management System Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub frmbillbook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox2.Text = myobj.GetnextNO("bill_book", "bill_no") End Sub End Class Guest Serach Public Class frmguestsearch Dim myobj As New Databasecollect Public frmnm As String Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If frmnm = "payment" Then frmPaymentDetail.TextBox1.Text = DataGridView1.SelectedRows.Item(0).Cells(0).Value frmPaymentDetail.TextBox2.Text = DataGridView1.SelectedRows.Item(0).Cells(1).Value ElseIf frmnm = "roomallocate" Then frmRoomAllocation.guid = DataGridView1.SelectedRows.Item(0).Cells(0).Value ElseIf frmnm = "frmorder" Then
Page -74-

Hotel Management System frmorder.TextBox1.Text = DataGridView1.SelectedRows.Item(0).Cells(0).Value End If Me.Close() End Sub Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown DataGridView1.Focus() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim condi As String = " guest_name like '" & TextBox1.Text & "%'" DataGridView1.DataSource = myobj.getrowsfromtable("guest_book", "*", condi) End Sub Private Sub frmguestsearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = myobj.getrowsfromtable("guest_book", "*", "") End Sub Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown If e.KeyCode = Keys.Up Then If Not IsDBNull(DataGridView1.SelectedRows.Item(0).Cells(0). Value) Then If DataGridView1.SelectedRows.Item(0).Cells(0).Value = 1 Then TextBox1.Focus() End If End If End If End Sub End Class
Page -75-

Hotel Management System Room Available Public Class frmroomavailable Dim myobj As New Databasecollect Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cond As String = "arival_date<='" & DateTimePicker1.Value.ToString("MM/dd/yyyy") & "' and depart_date>='" & DateTimePicker1.Value.ToString("MM/dd/yyyy") & "'" If ComboBox1.Text <> Nothing Then cond = cond & " and room_type='" & ComboBox1.Text & "'" End If DataGridView1.DataSource = myobj.getrowsfromtable("viewroomallocated", "*", cond) End Sub Private Sub frmroomavailable_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myobj.fillcombo("room_charges", "*", "", ComboBox1) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click DataGridView1.ClearSelection() End Sub End Class
Page -76-

Hotel Management System Room Allocation Public Class frmRoomAllocation Dim MYOBJ As New Databasecollect Public guid As Integer = 0 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim values As String = " ", booking As String If (RadioButton1.Checked) Then booking = "advance" ElseIf RadioButton2.Checked Then booking = "current" End If Dim value As String = " ", contact As String If (RadioButton3.Checked) Then contact = "self" ElseIf RadioButton4.Checked Then contact = "phone" values = txtgid.Text & "," & cmbroomtype.SelectedValue & "," & DateTimePicker1.Value & "," & DateTimePicker2.Value & ",'" & cmbhouse.SelectedValue & "','" & cmbroom.SelectedValue & "'" MYOBJ.SaveData("insert", "room_allocation", " ", values) End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GroupBox1.Enabled = True txtgid.Text = MYOBJ.GetnextNO("room_allocation", "guest_id") Button2.Enabled = True Button1.Enabled = False Button3.Enabled = True txtgid.Clear() End Sub
Page -77-

Hotel Management System Private Sub frmRoomAllocation_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated If guid <> 0 Then txtgid.Text = guid lblname.Text = MYOBJ.GETCOLUMNVALUE("GUEST_BOOK", "GUEST_NAME", "GUEST_ID=" & txtgid.Text) LBLCOUNTRY.Text = MYOBJ.GETCOLUMNVALUE("country", "country_name", "country_code=(select country_code from guest_book where Guest_id=" & txtgid.Text & ")") LBLSTATE.Text = MYOBJ.GETCOLUMNVALUE("states", "state_name", "state_code=(select state_code from guest_book where Guest_id=" & txtgid.Text & ")") LBLCITY.Text = MYOBJ.GETCOLUMNVALUE("town_details", "town_name", "town_code=(select state_code from guest_book where Guest_id=" & txtgid.Text & ")") LBLMOBILE.Text = MYOBJ.GETCOLUMNVALUE("GUEST_BOOK", "mobile_no", "GUEST_ID=" & txtgid.Text) End If End Sub Private Sub txtgid_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtgid.KeyDown If e.KeyCode = Keys.F2 Then frmguestsearch.frmnm = "roomallocate" frmguestsearch.Show() End If End Sub Private Sub txtgid_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtgid.TextChanged End Sub

Page -78-

Hotel Management System Private Sub frmRoomAllocation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MYOBJ.fillcombo("designation_Details", "*", "designation_name='house keeping'", cmbhouse) MYOBJ.fillcombo("designation_details", "*", "designation_name='room service'", cmbroom) MYOBJ.fillcombo("room_charges", "*", "", cmbroomtype) End Sub Private Sub cmbroomno_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbroomno.GotFocus MYOBJ.fillcombo("room_details", "distinct room_no,room_no", "room_type_code=" & cmbroomtype.SelectedValue.ToString, cmbroomno) End Sub Private Sub cmbroomno_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmbroomno.KeyDown If e.KeyCode = Keys.F2 Then frmroomavailable.Show() End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Hide() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click frmroomavailable.Show() End Sub End Class

Page -79-

Hotel Management System Manage User Public Class manageuser Dim myobj As New Databasecollect Private Sub manageuser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load showdata("") End Sub Private Sub showdata(ByVal condi) DataGridView1.DataSource = myobj.getrowsfromtable("staff_details", "*", condi) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim condition As String = "staff_name like '" & TextBox1.Text & "%'" showdata(condition) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click showdata("") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim sid As String = DataGridView1.SelectedRows(0).Cells(0).Value If TextBox4.Text = TextBox3.Text Then myobj.SaveData("update", "staff_details", "", "user_id='" & TextBox2.Text & "',password='" & TextBox3.Text & "',role='" & ComboBox1.SelectedItem & "'", "staff_id=" & sid) MsgBox("User created") showdata("STAFF_ID=" & sid) Else MsgBox("password mismatch") End If
Page -80-

Hotel Management System End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim sid As String = DataGridView1.SelectedRows(0).Cells(0).Value myobj.SaveData("update", "staff_details", "", "user_id=NULL,password=NULL,ROLE=NULL", "STAFF_ID=" & sid) showdata("STAFF_ID=" & sid) End Sub End Class

Page -81-

Hotel Management System Testing of the System Testing and implementation of the developed information system from the most important task of the project. A brief description of the testing procedure followed to test various modules of the information system given below. Testing is a process to check if the code written is performing well and produces output as required or not. Testing can be Software testing is a criterion of software equality assurance and presents the ultimate review of specified design and coding. System testing reveals the presence of errors in the software development. Software testing all so to find discrepancies between system objectives, current specification and system documentation .Objectives: The objective of testing as follows: Verification- Verification checks whether the results agrees with the specification. Validation- Validation checks whether the results really is what the order actually wanted. This focus on customer satisfaction in concerned with getting the specification and the result right.
Page -82-

Hotel Management System

Unit Testing: In this testing each module of the information system is tested individually. The database is also tested rigorously for the performance of each of the module. Integrated Testing: After completing all the modules, they are integrated to form the end results. This testing was done with simple data. The developed system has run successfully for the simple data. The need for the integrated test is to find the overall system performance. Black Box Testing: Black box testing is done to find incorrect or missing functions. Interface error Error in external database access Performance error Initialization Initialization and termination error
Page -83-

Hotel Management System

White Box Testing: Using this type of testing the following tests are successfully tested for this application. Check whether all independent paths with out module having exercise at least once. Exercise all logical decision on there true and false side. Execute all loops at their boundaries and within their bounds. Exercise internal data structure to ensure their validity. All the possible validity checks all validity look-up has been provided to ensure valid data heading. System Testing: Each use case is initially tested separately, from an external viewpoint. These tests are thus based on requirement models. When all use cases have been tested separately, the entered system is tested as whole. Modification and Improvements The project

Page -84-

Hotel Management System

Chapter # 6

CONCLUSION

SCOPE: The Hotel Management System has been developed, even if not totally flexible but it has the best flexibility and efficiency within the available resources and time. Every steps has been taken to initiate the existing manual system to make it more user friendly and to incorporate new features where ever necessary so that users could find the worth using the automated system. The system is highly user friendly, the menu and messages have been properly placed so as to make the user comfortable using the system. Frequently requested queries have been provided. Even a lay man can early use the system, after a small training. Whenever required the system can be expanded to incorporate new queries or, modify the existing queries. For the system maintenance and modification the source code has been properly documented which will make it easier for future modification of coding if required.

Page -85-

Hotel Management System

BIBILIOGRAPHY
The following books/resources have been referred, while preparing this HOTEL MANAGEMENT SYSTEM project
1. Analysis and Design of Information Systems by V.Rajaraman

(TATA McGRAW HILL EDITION)


2. Complete Reference to Microsoft Access 2010 by Scott Urman

(TATA McGRAW-HILL EDITION)


3. Personal Oracle And Power-object by Jose A.Ramalho (BPB

publication)
4. Teach Yourself Visual Basic 6.0 by Scott Wamer (TATA

McGRAW-HILL EDITION)
5. Mastering Visual Basic 6.0 by Evangclos Petroutsos (BPB

Publication)
6. MSDN Help file (Microsoft Corporation)

Page -86-

You might also like