Hotel

Download as pdf or txt
Download as pdf or txt
You are on page 1of 87

Project Report of

Hotel Management
System
By
Name:Rahul Kumar
Roll No:802427

Submitted in partial fulfillment of the requirements


for the degree of

Bachelor of Computer Applications


Institute of Computer & Information Science
Khanadari Campus
Dr. B.R. Ambedkar University
Agra

Submitted to Submitted By

Mr. Amit Singhal Rahul Kumar


ACKNOWLEDGEMENT

I offer my sincere appreciation to all people who provide their support to

this project. I feel great pleasure while working on this project work.

There are some people who help me a lot by providing valuable

suggestions and time during this project work.

First I want to thank Mr. Amit Singhal who gave knowledge through

which I have developed this project.

RAHUL KUMAR

BCA -VI

Roll no:802427
Table of Contents

S. No. Topic

1. Introduction

2. Objective of the Project

3. Problem Statement

4. Requirement Analysis

5. Feasibility Analysis And Design

6. System Design

7. Form Layouts

8. Coding

9. Testing

12. Future Scope of the Project

13. Conclusion

14. Bibliography
Introduction Of Project

A Hotel is an organization where delicacy, hospitability and service

matter a lot. And the hotel always try to be better the in all the areas

where ever the possibilities are there. The Computer has made this

possible by providing the internet, email, and networking and by other

software. In the same fashion the “Dummy “software Named “Hotel

Management System” is the project designed for the hotel industry

people who found their work quite hardly manageable because of keeping

all wears and tears because each and every thing is the matter which

should be recorded. For this purpose the following project is quit helpful

and handy because almost all the areas are covered in the project. Like

Restaurant, Rooms Health club, and transport. So the project is quite

easy to use and easy to carry. Today the efficiency of the computerized

department is best and do work speedily. Following are the departments

which covered in the projects:-

1. Front Office(Reception)

2. Restaurant

3. Room Services

4. Transport Enquiry

5. Different Department (Products, Employees Etc...)


Objective Of Project

The objective of the project is to make the hotel computerized

almost every area, and the block of the hotel like restaurant,

rooms, entertainment, sport, transport etc... Can keep their

records separately.

The hotel people will have to make login of each and every one

therefore security of the data is kept secured.

The facilities given into the project makes the project useful to the

hotel and the workers of the hotel because their work will be easy

and they will find their work easy and correct, all the details can be

checked as any time and can be changed.


System Analysis

Problem Statement

The Major problems during the designing of this project occurred were:-

1. Facts Collection

2. Attribute Collection

3. Decision Making

4. Meeting to the Hotel people

All the problems took place during the preparation of the project to give

the shape of actual project it was quite difficult to collect the facts like

what attribute they use to store the relevant data of any area.

Meeting to the hotel people was quit tough task as they were not ready

to talk about their personal matters as the working style of any hotel

make the hotel unique. And then decision making that whether the facts

given to me was appropriate to meet the requirement of the project.


Requirement Analysis

The requirement of the project was the working style of a hotel which is

working as its own way

1. The choice of the hotel

a. Selecting the meeting persons

i. His area of work

ii. His duty or role

iii. His Contribution to the project

b. Selecting the Details

i. Selection of the detail required for the project

ii. Selection of the Data and requirement of the working

department

c. Making the detail useful

i. Arranging the details in to table

ii. Connection of the table

2. Creation of the project

a. Making the tables

b. Making the ER Diagrams

c. Making the forms


d. Taking the proper name (as they are unique)

3. Testing

a. Testing the project at the site

b. Testing the project according the use

4. Trouble shooting

a. Sorting out the problems occurred

b. Taking the details of the troubles faced

Feasibility Analysis And Design

The feasibility study proposes one or more conceptual solutions to the

problem set of the project. It is a test of a system proposal according to

its workability impact on the organization, ability to meet user needs and

effective use of resources .The objective of a feasibility study is not to

solve the problem but to acquire a sense of its scope. Cost benefit

analysis is also done .The result is a format proposal detailing the nature

and nature and scope of the proposed solution.

Feasibility analysis usually considers a number of project alternatives and

the most satisfactory solution is selected among the alternatives. The

alternatives are also need to be evaluated in a broad way without

committing too many resources.

Four primary areas of interest in feasibility study are: -


1. ECONOMIC FEASIBILITY: - An evaluation of development cost

weighed against the ultimate income of benefit derived from the

development system or product.

This project can run on DOS or Windows 98 operating system, which are

most commonly available at nominal price. Hence, there are no

economical constraints.

2. TECHNICAL FEASIBILITY: A study of function, performance &

constraints that many affect the ability to achieve an acceptable system.

This project can run on any Pentium processor & does not require any

additional hardware.

3. BEHAVIOURAL FEASIBILITY: This project is very user friendly &

menu driven project & it will be readily accepted by the user.


Waterfall Model

This project is based on a Waterfall technique, which is based on top –

down approach i.e. the user will get finally whatever is desire without

having any intermediate interference in between.

Numerical system is based on waterfall model. The explicit model of

software development process was derived from other engineering

process. The waterfall model offered a means of making the development

process more visible.

Requirements analysis and


specification.

Design and Specification

Coding and Module


Testing

Integration and System


Testing

Delivery and
Maintenance
SYSTEM REQUIREMENTS

Hard ware Specification:

Processor : Intel P-III based system

Processor Speed : 250 MHz to 833MHz

RAM : 64MB to 256MB

Hard Disk : 10GB

Key Board : 104 keys

Software Specification

Language : VB.NET

Database : MS-ACCESS

Operating System : WindowsNT/95/98/2000

Development Tool : Microsoft Visual Studio 2005


VISUAL BASIC.NET
All .NET languages create code called intermediate language and as long

as that code was written to the Common Language Specification the

intermediate language can be used by any other .NET language. This

means that all languages are first class languages as far as .NET is

concerned. VB.NET is a .NET language with VB syntax. It is not VB 6, but

VB6 programmers will be familiar with the syntax. Most of the .NET

facilities are available to VB.NET programmers, but interestingly, some

features are only available in VB.NET and have no equivalent in other

languages. If you are a VB6 programmer then the first .NET language

you will want to learn will be VB.NET.

The day starts with an overview of the runtime, and an explanation of

how .NET applications are structured and how you create the various

parts of the application. You will then learn about intermediate language

and just in time compilation, assemblies and modules, and metadata.

Next, the VB.NET compiler is introduced and the most often used

command line switches will be explained and you will be introduced to

the various supported application types.

Console applications will be used throughout the seminar, so you will be

introduced to the Console class and using and formatting strings. Next,

the seminar will cover basic features of VB.NET: branching; logical and
bitwise tests, loops and bitwise shift operators. This gives you the tools

for creating and using .NET types.

.NET types defined in one assembly can be used in another, and this is

performed through exporting classes and metadata. The seminar will

show you how to do this and how to importing types.

.NET is object orientated and so all types are derived ultimately from the

Object base class. The seminar will cover the various class members:

properties, fields and methods, and the members used to initialize and

clean up an object (constructors and finalizers). You will also learn about

static members. Next, you will learn further details about classes

including the ways to pass method parameters, indexers, exporting

members and access modifers.

.NET supports single implementation inheritance, so you will be taught

how to derive from a class and how to access the base class. You will

also be shown how to declare virtual and abstract members and how to

override them and how to hide the base member.

.NET allows multiple interface inheritance, that is, a class can implement

more than one interface. You will learn the benefit of interface

programming and how to implement interfaces using implicit and explicit

implementation. You will also learn about casts and the as keyword, and

how to test for interface implementation using the is operator.

.NET strives to solve many of the security problems inherent in native

and one way it does this is by controlling how memory is allocated and
accessed. In particular, arrays are used to access .NET allocated memory

and the runtime imposes bounds checking. You will learn the VB.NET for

accessing arrays and the various System.Array members. .NET memory

is managed by the Garbage collector which will be described. .NET

objects can be managed by the GC and exist on the managed heap and

these are called reference types. In addition, another type of .NET object

can be allocated on the stack (or as a class member on the heap, but

without a reference) and these are called value types. The differences

between the two will be explained as will the mechanism of converting

between value type objects and reference types: boxing and unboxing.

.NET defines rules called the Common Language Specification. Code that

follows these rules can be used by code written in any other .NET

language. One area where this is important is exceptions. .NET defines

an exception object type that can be thrown and caught in all .NET

languages. You will learn the syntax of guarding code for exceptions and

catching the exceptions, you will also learn about how you can pass

information through the exception objects and some of the subtle issues.

The framework library contains classes for containing objects, and

provide mechanisms to iterate through those members. You will learn

about those classes and the For Each statement in VB.NET to access all

members.

.NET allows you to create type safe function pointer objects called

delegates. You will learn the types of delegates that the runtime offers

you, how to initialize them and how to invoke them. You will also be
informed about some of the issues with delegates with respect to

threading and exceptions. .NET uses delegates to provide a standard

notification mechanism called events. You will learn how to declare and

use an even and also how to customise events.

All .NET languages can create multi threaded code. You will learn how to

creating threads and how to control them. You will be made aware of the

problems with multi threaded code and how to alleviate them using

synchronization. You will learn about the process thread pool, how you

can use it and how it is used by the framework. Also in this section you'll

learn about asynchronous code and how you can invoke delegates

asynchronously.

At this point you will have learned the mandatory parts of the seminar.

The following topics are optional and will be covered if there is time.

One reason why .NET is type safe is its use of metadata. You will learn

about metadata and how it is used. .NET compilers add metadata to .NET

code and this can be customized using attributes. You will learn about

the various types of attributes, and how to write your own. You will also

learn how .NET reflection can be used to access attributes.

.NET provides a mechanism to serialize objects. Serialization is useful if

you want to save the state used in your application, but it is vital for

framework features like .NET remoting. You will earn about streams,

encoders, readers and writers. You will also learn about how to make an

object serializable, formatters and how to use them to serializing objects.


The .NET framework has a library which has more than a passing

resemblance to the VB6 forms library called Windows Forms Classes. You

will learn the basics of using Windows Forms, the form events, controls

and the graphics library, GDI+, that is used to draw on forms.

Much of the code that you will write will be .NET code. However, there is

a vast amount of code available that has been already written. Some

code has been compiled to native DLLs, other code is available as COM

libraries. .NET provides a mechanism called interop that allows you to

access such code: Platform Invoke allows you to access native DLLs;

COM Interop allows you to access COM objects. You will learn how to use

VB.NET to use both of these technologies. You will learn how you use the

Runtime Callable Wrapper from VB.NET to access COM objects, and how

you can use the COM Callable Wrapper from unmanaged code to call

.NET objects.
MS-ACCESS

Microsoft Access 2003 is a powerful, yet easy to learn, relational

database application for Microsoft Windows. This tutorial is designed for

users who are new or only have little experience using Access 2003. It

introduces fundamental database concepts and operations and illustrates

how they are performed in Microsoft Access 2003. This tutorial does not

cover all of the features and functions of Microsoft Access 2003;

emphasis will be on basic and frequently-used features, such as the

creation of tables and queries, or importing spreadsheet into Access.

Relational Database: in relational databases such as Access, data is

stored in tables made up of one or more fields (Access calls a column a

field). The data stored in each column must be of a single data type such

as Character, Number or Date. A collection of values from each column of

a table is called a record or a row in the table.

Different tables can have the same column in common. This feature is

used to explicitly specify a relationship between two tables. Values

appearing in column A in one table are shared with another table

Table: tables are the main units of data storage in a database. A table is

a collection of data about a specific topic; it is made up of one of more

fields.
Field: a field is a column in a table and defines a data type for a set of

values in a table. For example, a mailing list table might include fields for

first name, last name, address, city, state, zip code, and telephone

number.

Record: a record in a row in a table and is a set of values defined by

fields.

In a mailing list table, each record would contain the data for one person

as specified by the intersecting fields.

Data type: data types are the properties of each field. A field only has

one data type, such as Character, Number or Date.

Primary Key: a primary key is a value that can be used to identify a

unique record in a table.

Design View: it provides the tools for creating fields in a table.

Datasheet View: it allows you to update, edit, and delete in formation

from a table.
System Design

System design is an essential activity in the System Development Life

Cycle. System design is the general detailed specification of the computer

based solution that was selected during system analysis. Design

specification forms the basis for system development. The design is a

solution, the translation of requirements into ways of meeting them. In

the process the end user requirement were translated into specification

for a computer based information system. System design consists of two

phases:-

1. LOGICAL DESIGN

2. PHYSICAL DESIGN

In logical design the detailed specification of the new system is described

i.e. output, the inputs and the databases, all in manner that meets

project requirements.

The activity following logical design, are the procedure followed in the

physical design i.e. producing programs, software, files and a working

system.

Logical Design

Database Design

This phase is one of the most crucial as well as important

part of the System Design. The complete database description must

confirm to the rule of logical and physical data structures imposed by the

database management system that will manage the database.


The Database Structure used in the proposed system are :-
FORM LAYOUTS
FORM1-WELCOME SCREEN
FORM2-LOGIN
FORM 3-MAIN FORM
FORM 4-NEW STAFF ENTRY FORM
FORM 5-EDIT STAFF INFORMATION FORM
FORM 6-DEPATARTMENT ENTRY FORM
FORM 7-ROOM BOOKING FORM
FORM 8-EDIT BOOKING INFORMATION FORM
FORM 9-CHECK OUT FORM
FORM 10-BILL GENERATION FORM
FORM 11-NEW ROOM ENTRY FORM
FORM 12-EDIT ROOM INFORMATION FORM
FORM 13-CUSTOMER REPORT GENERATION FORM
FORM 14-MONTHLY COLLECTION FORM
FORM 15-CHANGE USER INFORMATION FORM
Splash Screen(frmSplash)
Public Class frmSplash
Inherits System.Windows.Forms.Form
Dim i, j As Object
Dim ch As Short

Private Sub frmSplash_Load(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles MyBase.Load
ch = 0
i=0
j=5
End Sub

Private Sub Frame1_Click()


Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles Timer1.Tick
If j >= 100 Then
j=5
Else
j=j+5
End If
If i >= 100 Then
Me.Hide()
frmLogin.Show()
Timer1.Enabled = False
Exit Sub
End If
i=i+1
ProgressBar1.Value = i
lblpercent.Text = i & "%"
End Sub
End Class
Login Screen(frmLogin)
Imports System.Data.OleDb
Public Class frmLogin
Inherits System.Windows.Forms.Form
Dim i As Single
Dim j As Single
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
End
End Sub

Private Sub cmdLogin_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdLogin.Click
If txtUsername.Text = "" Then
txtUsername.Focus()
MsgBox("Username should not be blank")
Exit Sub
End If
If txtPassword.Text = "" Then
txtPassword.Focus()
MsgBox("Password should not be blank")
Exit Sub
End If
Dim sqlStr As String
sqlStr = "select * from login where UserName=" & "'" & txtUsername.Text & "' and
Pass='" & txtPassword.Text & "'"
cmd = New OleDbCommand(sqlStr, cn)
rdr = cmd.ExecuteReader
If Not rdr.HasRows Then
MsgBox("Invalid Username/Password")
txtPassword.Text = ""
txtUsername.Text = ""
txtUsername.Focus()
Else

frmMain.Show()
Me.Hide()
End If
rdr.Close()
End Sub
Private Sub frmLogin_Load(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles MyBase.Load
i=4
j=i+4
cn = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
cn.Open()
End Sub

Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles Timer1.Tick
If i < j Then
i=i+4
j=j+4
Else
i=i-4
j=j-4
End If
If i = 44 Then
j=i-4
End If
If i = 4 Then
j=i+4
End If
Label1.Font = New Font(Label1.Font.Name, i)
End Sub

Private Sub Shape1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Shape1.Click

End Sub

Private Sub Shape2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Shape2.Click

End Sub
End Class
Main Screen(frmMain)
Public Class frmMain
Inherits System.Windows.Forms.Form
Dim i As Object
Dim j As Short

Public Sub addNewStaff_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles addNewStaff.Click
frmNewStaff.Show()
End Sub

Public Sub addRoom_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles addRoom.Click
frmRoomEntry.Show()
End Sub

Public Sub Bill_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles Bill.Click
frmBill.Show()
End Sub

Public Sub ChangeUser_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles ChangeUser.Click
frmChangeUser.Show()
End Sub

Public Sub Departure_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles Departure.Click
frmCheckOut.Show()
End Sub

Public Sub DeptEntry_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles DeptEntry.Click
frmDeptEntry.Show()
End Sub

Public Sub editCust_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles editCust.Click
frmEditRoomBooking.Show()
End Sub

Public Sub editRoom_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles editRoom.Click
frmEditRoomDetail.Show()
End Sub

Public Sub editStaff_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles editStaff.Click
frmEditStaff.Show()
End Sub

Public Sub MonthlyCollectionRpt_Click(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MonthlyCollectionRpt.Click
frmMonthlyColl.Show()
End Sub
Public Sub NewCust_Click(ByVal eventSender As System.Object, ByVal eventArgs As
System.EventArgs) Handles NewCust.Click
frmRoomBooking.Show()
End Sub

Public Sub Quit_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles Quit.Click
End
End Sub

Public Sub StaffRpt_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles StaffRpt.Click
frmStaffRpt.Show()
End Sub

Public Sub StatusRpt_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles StatusRpt.Click
frmDailyCust.Show()
End Sub

Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles Timer1.Tick

Dim str As String


str = "Hotel Management System"

If i > Len(str) Then


i=1
End If
lbltitle.Text = str.Substring(0, i)
i=i+1
End Sub

Private Sub frmMain_Disposed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Disposed
End
End Sub

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
i=1
End Sub

Private Sub DailyStatus_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles DailyStatus.Click
frmRoomStatusRpt.Show()
End Sub
End Class
NewstaffEntryForm(frmNewStaff)
Imports System.Data.OleDb
Public Class frmNewStaff
Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Dim cnt As String
Dim dcode As String

Private Sub cmdAdd_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles cmdAdd.Click
Try
cmd.CommandText = "select * from EmpDetail"
rdr = cmd.ExecuteReader()
If rdr.HasRows = False Then
cnt = "E101"
Else
Do While rdr.Read
cnt = "E" & Val(Mid(rdr.Item(0).ToString, 2,
rdr.Item(0).ToString.Length)) + 1
Loop
End If
rdr.Close()
cmd.CommandText = "select * from Department"
rdr = cmd.ExecuteReader()
If rdr.HasRows Then
Do While rdr.Read
cmbDName.Items.Add(rdr(1).ToString())
Loop
End If
rdr.Close()
txtCode.Text = cnt
cmbDName.Focus()
cmdAdd.Enabled = False
cmdSave.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdSave.Click
If txtDOB.Text <> "" Then
If Not IsDate(txtDOB.Text) Then
txtDOB.Focus()
MsgBox("Date of Birth is not valid")
Exit Sub
End If
End If
If txtDOJ.Text <> "" Then
If Not IsDate(txtDOJ.Text) Then
txtDOJ.Focus()
MsgBox("Date of Joining is not valid")
Exit Sub
End If
End If
If txtPhone.Text <> "" Then
If Not IsNumeric(txtPhone.Text) Then
txtPhone.Focus()
MsgBox("Phone No. is not valid")
Exit Sub
End If
End If
If txtBasic.Text <> "" Then
If Not IsNumeric(txtBasic.Text) Then
txtBasic.Focus()
MsgBox("Basic Salary should be a number")
Exit Sub
End If
End If
If txtHRA.Text <> "" Then
If Not IsNumeric(txtHRA.Text) Then
txtHRA.Focus()
MsgBox("HRA should be a number")
Exit Sub
End If
End If
If txtTA.Text <> "" Then
If Not IsNumeric(txtTA.Text) Then
txtTA.Focus()
MsgBox("TA should be a number")
Exit Sub
End If
End If
If txtDA.Text <> "" Then
If Not IsNumeric(txtDA.Text) Then
txtDA.Focus()
MsgBox("DA should be a number")
Exit Sub
End If
End If

Dim str As MsgBoxResult


str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
Try
If str = MsgBoxResult.Yes Then
cmd.CommandText = "select * from department where dept_name='" &
cmbDName.Text & "'"
rdr = cmd.ExecuteReader
rdr.Read()
Dim dcode As String
dcode = rdr(0).ToString
rdr.Close()
Dim sqlstr As String
sqlstr = "insert into EmpDetail values('" & txtCode.Text & "','" & dcode & "','"
& txtDesig.Text & "','" & _
txtEName.Text & "','" & txtFName.Text & "','" & txtAddress.Text & "',#" &
txtDOB.Text & "#,#" _
& txtDOJ.Text & "#,'" & txtPhone.Text & "','" & txtQualification.Text & "'," &
Val(txtBasic.Text) _
& "," & Val(txtHRA.Text) & "," & Val(txtDA.Text) & "," & Val(txtTA.Text) & ")"
cmd.CommandText = sqlstr
Dim c As Short
c = cmd.ExecuteNonQuery()
If c > 0 Then
MsgBox("Record has been saved")
cmdAdd.Enabled = True
cmdSave.Enabled = False
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub frmNewStaff_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
cn = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
cn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
cmd = New OleDbCommand
cmd.Connection = cn
txtCode.Enabled = False
cmdSave.Enabled = False
End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label3.Click

End Sub

Private Sub txtDesig_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txtDesig.TextChanged

End Sub
End Class
EditStaffInformationForm(frmeditstaff)
Imports System.Data.OleDb
Public Class frmEditStaff
Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Dim dcode As String
Dim ecode As String

Private Sub cmbDept_SelectedIndexChanged(ByVal eventSender As System.Object,


ByVal eventArgs As System.EventArgs) Handles cmbDept.SelectedIndexChanged
Try
cmd.CommandText = "select * from Department where Dept_Name ='" &
cmbDept.Text & "'"
rdr = cmd.ExecuteReader
rdr.Read()
dcode = rdr(0)
rdr.Close()
cmd.CommandText = "select * from EmpDetail where Dept_Code=" & "'" &
dcode & "'" & ""
rdr = cmd.ExecuteReader
If rdr.HasRows Then
List1.Items.Clear()
Do While rdr.Read
List1.Items.Add(rdr("Emp_Code").ToString & "-" & rdr("Name").ToString)
Loop
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdUpdate_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdUpdate.Click

If txtDOB.Text <> "" Then


If IsDate(txtDOB.Text) = False Then
txtDOB.Focus()
MsgBox("Date of Birth is not valid")
Exit Sub
End If
End If
If txtDOJ.Text <> "" Then
If Not IsDate(txtDOJ.Text) Then
txtDOJ.Focus()
MsgBox("Date of Joining is not valid")
Exit Sub
End If
End If
If txtPhone.Text <> "" Then
If Not IsNumeric(txtPhone.Text) Then
txtPhone.Focus()
MsgBox("Phone No. is not valid")
Exit Sub
End If
End If
If txtBasic.Text <> "" Then
If Not IsNumeric(txtBasic.Text) Then
txtBasic.Focus()
MsgBox("Basic Salary is not valid")
Exit Sub
End If
End If
If txtHRA.Text <> "" Then
If Not IsNumeric(txtHRA.Text) Then
txtHRA.Focus()
MsgBox("HRA is not valid")
Exit Sub
End If
End If
If txtDA.Text <> "" Then
If Not IsNumeric(txtDA.Text) Then
txtDA.Focus()
MsgBox("DA is not valid")
Exit Sub
End If
End If
If txtTA.Text <> "" Then
If Not IsNumeric(txtTA.Text) Then
txtTA.Focus()
MsgBox("TA is not valid")
Exit Sub
End If
End If

Dim str As MsgBoxResult


str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
If str = MsgBoxResult.Yes Then
Try
cmd.CommandText = "select * from Department where Dept_Name=" & "'"
& cmbDName.Text & "'"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
rdr.Read()
dcode = rdr("Dept_Code")
End If
rdr.Close()
Dim sqlstr As String
sqlstr = "Update EmpDetail set Dept_Code='" & dcode & "',Desig='" &
txtDesig.Text & "',Name='" & _
txtEName.Text & "',FatherName='" & txtFName.Text & "',Address='" &
txtAddress.Text & "',DOB=#" & txtDOB.Text & "#,DOJ=#" _
& txtDOJ.Text & "#,Phone='" & txtPhone.Text & "',Qualification='" &
txtQualification.Text & "',Basic=" & Val(txtBasic.Text) _
& ",Hra=" & Val(txtHRA.Text) & ",DA=" & Val(txtDA.Text) & ",TA=" &
Val(txtTA.Text) & " where Emp_Code='" & txtECode.Text & "'"
cmd.CommandText = sqlstr
Dim c As Short = cmd.ExecuteNonQuery()
If c > 0 Then
cmdUpdate.Enabled = False
MsgBox("Record has been updated")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If

End Sub

Private Sub frmEditStaff_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
cmd = New OleDbCommand("select * from Department", con)
rdr = cmd.ExecuteReader()
If rdr.HasRows Then
Do While rdr.Read
cmbDept.Items.Add(rdr(1).ToString)
cmbDName.Items.Add(rdr(1).ToString)
Loop
End If
rdr.Close()
cmdUpdate.Enabled = False
txtECode.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub List1_SelectedIndexChanged(ByVal eventSender As System.Object,


ByVal eventArgs As System.EventArgs) Handles List1.SelectedIndexChanged
Dim pos As Short
pos = InStr(1, List1.Text, "-")
ecode = Mid(List1.Text, 1, pos - 1)
Try
cmd.CommandText = "select * from EmpDetail where Emp_Code=" & "'" &
ecode & "'"
rdr = cmd.ExecuteReader
rdr.Read()
cmbDName.Text = cmbDept.Text
txtECode.Text = rdr("Emp_Code").ToString
txtEName.Text = rdr("Name").ToString
txtFName.Text = rdr("FatherName").ToString
txtDesig.Text = rdr("Desig").ToString
txtAddress.Text = rdr("Address").ToString
txtDOB.Text = rdr("DOB").ToString
txtQualification.Text = rdr("Qualification").ToString
txtDOJ.Text = rdr("DOJ").ToString
txtPhone.Text = rdr("Phone").ToString
txtBasic.Text = rdr("Basic").ToString
txtHRA.Text = rdr("HRA").ToString
txtDA.Text = rdr("DA").ToString
txtTA.Text = rdr("TA").ToString
rdr.Close()
cmdUpdate.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label3.Click

End Sub
EndClass
DepartmentEntryForm(frmDeptEntry)
Imports System.Data.OleDb
Public Class frmDeptEntry
Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Private Sub cmbCode_SelectedIndexChanged(ByVal eventSender As System.Object,
ByVal eventArgs As System.EventArgs) Handles cmbCode.SelectedIndexChanged
Dim str As String
str = "select * from Department where Dept_Code=" & "'" & Trim(cmbCode.Text)
& "'" & ""
Try
cmd = New OleDbCommand(str, con)
rdr = cmd.ExecuteReader
If rdr.HasRows Then
rdr.Read()
txtName.Text = rdr("Dept_Name").ToString
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmdAdd_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles cmdAdd.Click
txtNewCode.Text = ""
txtNewName.Text = ""
txtNewCode.Focus()
cmdSave.Enabled = True
cmdAdd.Enabled = False
End Sub

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdEdit_Click(ByVal eventSender As System.Object, ByVal eventArgs As


System.EventArgs) Handles cmdEdit.Click
Try
cmd.CommandText = "select * from Department"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
cmbCode.Items.Clear()
Do While rdr.Read
cmbCode.Items.Add(rdr("Dept_Code").ToString)
Loop
cmbCode.Text = cmbCode.Items(0).ToString
Else
MsgBox("Please Add a Department" & vbCrLf & "No Record found in
Department Table")
End If
rdr.Close()
cmdUpdate.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdSave.Click
If txtNewCode.Text <> "" Then
Try
cmd.CommandText = "select * from Department where Dept_Code=" & "'" &
txtNewCode.Text & "'"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
MsgBox("Code is already exist")
txtNewCode.Text = ""
txtNewCode.Focus()
rdr.Close()
Exit Sub
Else
rdr.Close()
End If

Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
Dim yn As MsgBoxResult
yn = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
If yn = MsgBoxResult.Yes Then
Try
Dim sqlStr = "Insert into Department values('" & txtNewCode.Text & "','" &
txtNewName.Text & "')"
cmd.CommandText = sqlStr
Dim c As Short
c = cmd.ExecuteNonQuery()
If c > 0 Then
MsgBox("Record has been saved")
cmdAdd.Enabled = True
cmdSave.Enabled = False
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
Private Sub cmdUpdate_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdUpdate.Click
Dim yn As MsgBoxResult
yn = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
If yn = MsgBoxResult.Yes Then
Try
Dim sqlstr As String
sqlstr = "update Department set Dept_Name='" & txtName.Text & "' where
Dept_Code='" & cmbCode.Text & "'"
cmd.CommandText = sqlstr
Dim c As Short = cmd.ExecuteNonQuery()
If c > 0 Then
MsgBox("Record has been updated successfully")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub

Private Sub frmDeptEntry_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
cmd = New OleDbCommand
cmd.Connection = con
Catch ex As Exception
MsgBox(ex.Message)
End Try
cmdSave.Enabled = False
cmdUpdate.Enabled = False
End Sub
EndClass
RoomBookingForm(frmRoomBooking)
Imports System.Data.OleDb
Public Class frmRoomBooking
Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Dim cnt As Short

Private Sub cmbFloorNo_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbFloorno.SelectedIndexChanged
Dim sql As String
Try
sql = "select * from RoomDetail where Status=" & "'" & "Free" & "'" & " and
Type=" & "'" & cmbRoomType.Text & "'" & " and FloorNo=" & cmbFloorno.Text & " "
cmd.CommandText = sql
cmbRoomNo.Items.Clear()
rdr = cmd.ExecuteReader
If rdr.HasRows Then
Do While rdr.Read
cmbRoomNo.Items.Add(rdr("roomno").ToString)
Loop
cmbRoomNo.Text = cmbRoomNo.Items(0)
Else
MsgBox("Room is not available at this floor")
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmbRoomType_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbRoomType.SelectedIndexChanged
Try
Dim str As String
str = "select floorno from RoomDetail group by floorno"
cmd.CommandText = str
rdr = cmd.ExecuteReader
cmbFloorno.Items.Clear()
If rdr.HasRows Then
Do While rdr.Read
cmbFloorno.Items.Add(rdr(0).ToString)
Loop
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmdAddNew_Click(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles cmdAddNew.Click
Try
cmd.CommandText = "select max(Cust_No) as cn from BookingDetail"
rdr = cmd.ExecuteReader
If rdr.HasRows = False Then
cnt = 1
Else
rdr.Read()
cnt = Val(rdr("cn")) + 1
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
txtCustNo.Text = CStr(cnt)
txtName.Text = ""
txtAddress.Text = ""
txtNationality.Text = ""
txtAdvance.Text = ""
txtCommingfrm.Text = ""
txtGoingTo.Text = ""
txtNo_Persons.Text = ""
txtOccDate.Text = ""
txVaccDate.Text = ""
txtTotal.Text = ""
txtName.Focus()
cmdSave.Enabled = True
cmdAddNew.Enabled = False
End Sub

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdSave.Click
If txtPhoneNo.Text <> "" Then
If Not IsNumeric(txtPhoneNo.Text) Then
txtPhoneNo.Focus()
MsgBox("Phone No. is not valid")
Exit Sub
End If
End If
If txtOccDate.Text <> "" Then
If Not IsDate(txtOccDate.Text) Then
txtOccDate.Focus()
MsgBox("OccupationDate is not valid")
Exit Sub
End If
End If
If txtNo_Persons.Text <> "" Then
If Not IsNumeric(txtNo_Persons.Text) Then
txtNo_Persons.Focus()
MsgBox("Not a valid number")
Exit Sub
End If
End If
If txtAdvance.Text <> "" Then
If Not IsNumeric(txtAdvance.Text) Then
txtAdvance.Focus()
MsgBox("Not a valid number")
Exit Sub
End If
End If
If txtTotal.Text <> "" Then
If Not IsNumeric(txtTotal.Text) Then
txtTotal.Focus()
MsgBox("Not a valid number")
Exit Sub
End If
End If
Dim str As MsgBoxResult
str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
If str = MsgBoxResult.Yes Then
Try
Dim sql As String
sql = "Insert into BookingDetail
(Cust_No,Name,Address,RoomNo,Nationality,PhoneNo,No_Of_Persons,CommingFrom,G
oingTo," & _
"OccupationDate,Advance,TotalAmount) values(" & cnt & ",'" & txtName.Text
& "','" & txtAddress.Text & "'," & _
Val(cmbRoomNo.Text) & ",'" & txtNationality.Text & "','" & txtPhoneNo.Text
& "'," & Val(txtNo_Persons.Text) & ",'" & _
txtCommingfrm.Text & "','" & txtGoingTo.Text & "',#" & txtOccDate.Text &
"#," & _
Val(txtAdvance.Text) & "," & Val(txtTotal.Text) & ")"
cmd.CommandText = sql
Dim c As Short = cmd.ExecuteNonQuery()
If c > 0 Then
sql = "Update RoomDetail set Type='" & cmbRoomType.Text &
"',Status='Booked' where RoomNo=" & cmbRoomNo.Text & ""
cmd.CommandText = sql
cmd.ExecuteNonQuery()
cmdAddNew.Enabled = True
cmdSave.Enabled = False
MsgBox("Record has been Saved")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub

Private Sub frmRoomBooking_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
cmd = New OleDbCommand
cmd.Connection = con
cmd.CommandText = "select * from RoomType"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
Do While rdr.Read
cmbRoomType.Items.Add(rdr(0).ToString)
Loop
End If
rdr.Close()
cmdSave.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
EndClass
EditCustomerDetailForm(frmeditRoom

Booking)
Imports System.Data.OleDb

Public Class frmEditRoomBooking


Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Dim rNO As Short
Dim fNo As Short
Dim strType As String

Private Sub cmbRoomType_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbRoomType.SelectedIndexChanged
Try
cmd.CommandText = "select floorno from RoomDetail where Status=" & "'" &
"Free" & "'" & " and Type=" & "'" & cmbRoomType.Text & "'" & " or RoomNo=" & rNO &
" group by floorno"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
cmbFloorNo.Items.Clear()
Do While rdr.Read
cmbFloorNo.Items.Add(rdr("floorno").ToString)
Loop
End If
rdr.Close()
cmbFloorNo.Text = cmbFloorNo.Items(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmbFloorNo_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbFloorNo.SelectedIndexChanged
Try
cmd.CommandText = "select * from RoomDetail where Status=" & "'" & "Free"
& "'" & " and Type=" & "'" & cmbRoomType.Text & "'" & " and FloorNo=" &
cmbFloorNo.Text & " or RoomNo=" & rNO & ""
cmbRoomNo.Items.Clear()
rdr = cmd.ExecuteReader
If rdr.HasRows Then
Do While rdr.Read
cmbRoomNo.Items.Add(rdr("roomno").ToString)
Loop
End If
rdr.Close()
cmbRoomNo.Text = cmbRoomNo.Items(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdUpdate_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdUpdate.Click
Dim str As MsgBoxResult
If Not IsNumeric(txtPhone.Text) Then
txtPhone.Focus()
MsgBox("Phone No. is not valid")
Exit Sub
End If
If Not IsNumeric(txtNOP.Text) Then
txtNOP.Focus()
MsgBox("No. of Person should be a number")
Exit Sub
End If
If Not IsNumeric(txtAdvance.Text) Then
txtAdvance.Focus()
MsgBox("Advance should be a number")
Exit Sub
End If
If Not IsNumeric(txtTotal.Text) Then
txtTotal.Focus()
MsgBox("Total Amount should be a number")
Exit Sub
End If
str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
Try
If str = MsgBoxResult.Yes Then
Dim sql As String
sql = "update BookingDetail set Name='" & UCase(Trim(txtName.Text)) &
"',Address='" & UCase(Trim(txtAddress.Text)) & _
"',Nationality='" & UCase(Trim(txtNationality.Text)) & "',CommingFrom='" &
UCase(Trim(txtCommingFrm.Text)) & "',GoingTo='" & _
UCase(Trim(txtGoingto.Text)) & "',PhoneNo='" &
UCase(Trim(txtPhone.Text)) & "', OccupationDate=#" & txtOccupationDate.Text & _
"#,No_of_Persons=" & txtNOP.Text & ",RoomNo=" & cmbRoomNo.Text &
",Advance=" & _
txtAdvance.Text & " where Cust_No=" & txtCustNo.Text
cmd.CommandText = sql
cmd.ExecuteNonQuery()
If txtVaccDate.Text <> "" And IsDate(txtVaccDate.Text) Then
sql = "update RoomDetail set Status ='Free' where RoomNo=" & rNO
cmd.CommandText = sql
cmd.ExecuteNonQuery()
sql = "update RoomDetail set Status='Booked' where RoomNo=" &
cmbRoomNo.Text
cmd.CommandText = sql
cmd.ExecuteNonQuery()
End If
MsgBox("Record has been updated")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub frmEditRoomBooking_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
cmd = New OleDbCommand
cmd.Connection = con
Catch ex As Exception
MsgBox(ex.Message)
End Try
txtCustNo.Enabled = False
End Sub

Private Sub List1_SelectedIndexChanged(ByVal eventSender As System.Object,


ByVal eventArgs As System.EventArgs) Handles List1.SelectedIndexChanged
rNO = Val(List1.Text.Substring(0, 3))
cmd.CommandText = "select * from BookingDetail where OccupationDate=" & "#"
& FormatDateTime(CDate(pictOccDate.Text), DateFormat.ShortDate) & "#" & " and
RoomNo=" & rNO & ""
rdr = cmd.ExecuteReader
If rdr.HasRows Then
rdr.Read()
txtCustNo.Text = rdr("cust_no").ToString
txtName.Text = rdr("Name").ToString
txtAddress.Text = rdr("Address").ToString
txtNationality.Text = rdr("Nationality").ToString
txtCommingFrm.Text = rdr("CommingFrom").ToString
txtGoingto.Text = rdr("GoingTo").ToString
txtPhone.Text = rdr("pHONENO").ToString
txtNOP.Text = rdr("NO_of_Persons").ToString
txtAdvance.Text = rdr("Advance").ToString
txtTotal.Text = rdr("TotalAmount").ToString
txtOccupationDate.Text = rdr("OccupationDate").ToString
txtVaccDate.Text = rdr("VaccantDate").ToString
rNO = Val(rdr("RoomNo").ToString)
End If
rdr.Close()
cmd.CommandText = "select * from RoomDetail where RoomNo=" & rNO
rdr = cmd.ExecuteReader
If rdr.HasRows Then
rdr.Read()
fNo = rdr("floorNo").ToString
strType = rdr("Type").ToString
End If
rdr.Close()
cmbRoomType.Items.Clear()
cmbRoomNo.Items.Clear()
cmbFloorNo.Items.Clear()
cmd.CommandText = "select * from RoomType"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
Do While rdr.Read
cmbRoomType.Items.Add(rdr("type").ToString)
Loop
End If
rdr.Close()
cmbRoomType.Text = strType
cmbFloorNo.Text = fNo
cmbRoomNo.Text = rNO
End Sub

Private Sub pictOccDate_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles pictOccDate.ValueChanged
Try
cmd.CommandText = "select * from BookingDetail where OccupationDate=" &
"#" & pictOccDate.Text & "#"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
List1.Items.Clear()
Do While rdr.Read
List1.Items.Add(rdr("roomno").ToString & "-" & rdr("Name").ToString)
Loop
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
EndClass
Bill Form(frmCheckOut)
Public Class frmBill
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdBill.Click
frmBillReport.Show()
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub
End Class
New Room Entry Form(frmRoomEntry)
Imports System.Data.OleDb

Public Class frmRoomEntry


Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub cmdAddNew_Click(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles cmdAddNew.Click
txtFloorNo.Text = ""
txtRoomNo.Text = ""
txtFloorNo.Focus()
cmdAddNew.Enabled = False
cmdSave.Enabled = True
End Sub

Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdSave.Click
If Not IsNumeric(txtFloorNo.Text) Or txtFloorNo.Text = "" Then
txtFloorNo.Focus()
MsgBox("Floor No is not valid")
Exit Sub
End If
If Not IsNumeric(txtRoomNo.Text) Or txtRoomNo.Text = "" Then
txtRoomNo.Focus()
MsgBox("Room No is not valid")
Exit Sub
End If
Dim str As MsgBoxResult
str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
If str = MsgBoxResult.Yes Then

Try
Dim sql As String
sql = "select * from roomdetail where RoomNo=" & txtRoomNo.Text
cmd.CommandText = sql
rdr = cmd.ExecuteReader
If rdr.HasRows Then
MsgBox("Room No already exist")
txtRoomNo.Text = ""
txtRoomNo.Focus()
Exit Sub
End If
rdr.Close()
sql = "insert into RoomDetail values(" & txtRoomNo.Text & "," &
txtFloorNo.Text & _
",'" & cmbType.Text & "','" & cmbStatus.Text & "')"
cmd.CommandText = sql
Dim c As Short = cmd.ExecuteNonQuery
If c > 0 Then
MsgBox("New Room Added")
cmdAddNew.Enabled = True
cmdSave.Enabled = False
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub

Private Sub frmRoomEntry_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim sql As String
sql = "select * from roomType"
cmd = New OleDbCommand(sql, con)
rdr = cmd.ExecuteReader
If rdr.HasRows Then
Do While rdr.Read
cmbType.Items.Add(rdr("type").ToString)
Loop
End If
rdr.Close()
cmbType.Text = cmbType.Items(0)
cmdSave.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Edit Room Detail

Form(frmeditRoomDetail)
Imports System.Data.OleDb
Public Class frmEditRoomDetail
Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader

Private Sub cmbFloorNo_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbFloorNo.SelectedIndexChanged
Try
cmd.CommandText = "select RoomNo from RoomDetail where FloorNo=" &
cmbFloorNo.Text & " order by RoomNo"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
cmbRoomNo.Items.Clear()
Do While rdr.Read
cmbRoomNo.Items.Add(rdr("RoomNo").ToString)
Loop
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmbRoomNo_SelectedIndexChanged(ByVal eventSender As


System.Object, ByVal eventArgs As System.EventArgs) Handles
cmbRoomNo.SelectedIndexChanged
Try
cmd.CommandText = "select * from RoomDetail where RoomNo=" &
cmbRoomNo.Text
rdr = cmd.ExecuteReader
rdr.Read()
If rdr.HasRows Then
cmbType.Text = rdr("Type").ToString
cmbStatus.Text = rdr("Status").ToString
End If
rdr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub
Private Sub cmdUpdate_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdUpdate.Click
Dim str As MsgBoxResult
str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question,
"Confirmation")
Try
If str = MsgBoxResult.Yes Then
Dim sql As String
sql = "update RoomDetail set type='" & cmbType.Text & "',status='" &
cmbStatus.Text & "' where RoomNo=" & cmbRoomNo.Text
cmd.CommandText = sql
Dim c As Short = cmd.ExecuteNonQuery
If c > 0 Then
MsgBox("Record has been updated")
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub frmEditRoomDetail_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim sql As String = "select FloorNo from RoomDetail Group by FloorNo"
cmd = New OleDbCommand(sql, con)
rdr = cmd.ExecuteReader
If rdr.HasRows Then
cmbFloorNo.Items.Clear()
Do While rdr.Read
cmbFloorNo.Items.Add(rdr("FloorNo").ToString)
Loop
End If
rdr.Close()
cmd.CommandText = "select Type from RoomType"
rdr = cmd.ExecuteReader
If rdr.HasRows Then
cmbType.Items.Clear()
Do While rdr.Read
cmbType.Items.Add(rdr("Type").ToString)
Loop
End If
rdr.Close()
cmbType.Text = cmbType.Items(0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Customer Report Form(frmDailyCust)
Public Class frmDailyCust
Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdShow.Click
frmDailyCustRpt.Show()
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub
End Class
Monthly Collection Report

Form(frmMomthlycoll)
Public Class frmMonthlyColl

Private Sub cmdMonColl_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdMonColl.Click
frmMonthlyCollRpt.Show()
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub frmMonthlyColl_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub
End Class
Change User Information

Form(frmChangeUser)
Imports System.Data.OleDb
Public Class frmChangeUser
Inherits System.Windows.Forms.Form
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rdr As OleDbDataReader

Private Sub cmdChange_Click(ByVal eventSender As System.Object, ByVal eventArgs


As System.EventArgs) Handles cmdChange.Click
If IsNumeric(Trim(txtusername.Text)) Then
MsgBox("Invalid Username")
txtusername.Focus()
Exit Sub
End If
If txtold.Text = "" Then
MsgBox("Password do not match")
txtold.Focus()
Exit Sub
End If
If txtnew.Text = "" Then
MsgBox("New Password is should not be blank")
txtnew.Focus()
Exit Sub
End If
Try
cmd = New OleDbCommand
cmd.Connection = con
cmd.CommandText = "select * from login where Username='" &
txtusername.Text & "'"
rdr = cmd.ExecuteReader
Dim str As MsgBoxResult
If rdr.HasRows Then
rdr.Read()
If txtold.Text = rdr("Pass").ToString Then
rdr.Close()
str = MsgBox("Are you sure ?", MsgBoxStyle.YesNo +
MsgBoxStyle.Question, "Confirmation")
If str = MsgBoxResult.Yes Then
Dim sql As String
sql = "update Login set Pass ='" & txtnew.Text & "' where
UserName='" & txtusername.Text & "'"
cmd.CommandText = sql
Dim c As Short = cmd.ExecuteNonQuery
If c > 0 Then
MsgBox("User Information has been changed")
cmdCancel.Focus()
End If
End If
Else
txtold.Text = ""
txtold.Focus()
MsgBox("Old Password do not match")
End If
Else
MsgBox("No such user exist")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub

Private Sub frmChangeUser_Load(ByVal eventSender As System.Object, ByVal


eventArgs As System.EventArgs) Handles MyBase.Load
Try
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Reports
Reports

1. Bill

This report will show the bill at the checkout


of a customer.
Imports System.Data.OleDb
Public Class frmBillReport
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Activated
Dim ocdate As String
Dim rno As Short
ocdate = frmBill.txtOccDate.Text
rno = Val(frmBill.txtRno.Text)
Dim con As OleDbConnection
con = New OleDb.OleDbConnection
con.ConnectionString = My.Settings.HotelDataBaseConnectionString
con.Open()
Dim dt As New DataTable
Dim str As String
str = "SELECT BookingDetail.Cust_No, BookingDetail.Name,
BookingDetail.Address, BookingDetail.RoomNo, BookingDetail.Nationality,
BookingDetail.PhoneNo, " & _
"BookingDetail.No_of_Persons, BookingDetail.CommingFrom, BookingDetail.GoingTo,
BookingDetail.OccupationDate, BookingDetail.VaccantDate," & _
"BookingDetail.Advance, BookingDetail.TotalAmount, RoomDetail.Type,
RoomDetail.FloorNo, RoomType.Rent" & _
" FROM ((BookingDetail INNER JOIN" & _
" RoomDetail ON BookingDetail.RoomNo = RoomDetail.RoomNo) INNER
JOIN" & _
" RoomType ON RoomDetail.Type = RoomType.Type)" & _
" WHERE BookingDetail.OccupationDate = #" & ocdate & "# AND
BookingDetail.RoomNo =" & rno & ""
Dim da As New OleDbDataAdapter(str, con)
da.Fill(dt)
Dim cr As New rptBill
cr.SetDataSource(dt)
CrystalReportViewer1.ReportSource = cr
End Sub

Private Sub frmBillReport_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub
EndClass
Formatofreport

2.Daily Room Status


Imports System.Data.OleDb
Public Class frmRoomStatusRpt
Private Sub frmRoomStatusRpt_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim con As OleDbConnection
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim dt As New DataTable
Dim str As String
str = "SELECT RoomNo, FloorNo, Type, Status FROM(RoomDetail) ORDER BY
FloorNo, RoomNo"
Dim da As New OleDbDataAdapter(str, con)
da.Fill(dt)
Dim cr As New rptRoomStatus
cr.SetDataSource(dt)
CrystalReportViewer1.ReportSource = cr
End Sub
End Class

FormatofReport
3.MonthlyCollectionReport
Imports System.Data.OleDb
Public Class frmMonthlyCollRpt
Private Sub frmMonthlyCollRpt_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim mon, yr As Short
mon = Val(frmMonthlyColl.txtMonth.Text)
yr = Val(frmMonthlyColl.txtYear.Text)
Dim con As OleDbConnection
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim dt As New DataTable
Dim str As String
str = "SELECT BookingDetail.Cust_No, BookingDetail.Name,
BookingDetail.Address, BookingDetail.VaccantDate, BookingDetail.Advance,
BookingDetail.TotalAmount, " & _
"RoomType.Rent, BookingDetail.vaccantdate - BookingDetail.occupationdate
AS NOD FROM ((BookingDetail INNER JOIN RoomDetail ON BookingDetail.RoomNo =" &
_
"RoomDetail.RoomNo) INNER JOIN RoomType ON RoomDetail.Type =
RoomType.Type) WHERE(Month(bookingdetail.vaccantdate) = " & mon & " And
Year(BookingDetail.VaccantDate) = " & yr & ")"
Dim da As New OleDbDataAdapter(str, con)
da.Fill(dt)
Dim cr As New rptMonthlyCollection
cr.SetDataSource(dt)
CrystalReportViewer1.ReportSource = cr
End Sub
End Class

Format of Report
4.Customer Report
Imports System.Data.OleDb
Public Class frmDailyCustRpt

Private Sub frmDailyCustRpt_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Dim OccDate As String
OccDate = frmDailyCust.txtOccDate.Text
Dim con As OleDbConnection
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim dt As New DataTable
Dim str As String
str = "SELECT Cust_No, Name, Address, RoomNo, Nationality, PhoneNo,
No_of_Persons, CommingFrom, GoingTo, OccupationDate, VaccantDate, Advance, " & _
"TotalAmount FROM(BookingDetail) WHERE(OccupationDate = #" & OccDate &
"#)"
Dim da As New OleDbDataAdapter(str, con)
da.Fill(dt)
Dim cr As New rptDailyCustomer
cr.SetDataSource(dt)
CrystalReportViewer1.ReportSource = cr
End Sub
EndClass

Format of report
5.Staff Report
Imports System.Data.OleDb
Public Class frmStaffRpt

Private Sub frmStaffRpt_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Dim con As OleDbConnection
con = New OleDbConnection(My.Settings.HotelDataBaseConnectionString)
con.Open()
Dim dt As New DataTable
Dim str As String
str = "SELECT EmpDetail.Emp_Code, EmpDetail.Desig, EmpDetail.Name,
EmpDetail.FatherName, EmpDetail.Address, EmpDetail.DOB, EmpDetail.DOJ," & _
"EmpDetail.Qualification, EmpDetail.Phone, EmpDetail.Basic,
Department.Dept_Name, EmpDetail.Dept_Code " & _
"FROM (Department INNER JOIN EmpDetail ON Department.Dept_Code =
EmpDetail.Dept_Code)ORDER BY EmpDetail.Dept_Code"
Dim da As New OleDbDataAdapter(str, con)
da.Fill(dt)
Dim cr As New rptStaff
cr.SetDataSource(dt)
CrystalReportViewer1.ReportSource = cr
End Sub
End Class

Format of Report
Testing
Testing is a set of activities that can be planned in advance and

conducted systematically. For this reasona template for software testing

a set of steps into which can place specific test case design and testing

methods should be defined for the software process. All provide the

software developer with a template for testing and alll have the following

generic characteristics :

• To perform effective testing, a software team should conduct

effective normal technical reviews.

• Testing begins at the component level and works “outward” toward

the integeration of the entire computer-bassed system.

• Different testing techniques are appropriate at different points in

time.

• Testing is conducted by the developers of the software and (for

large project) an independent test groups.

• Testing and debugging are the different activities, but debugging

must be accomodated in any testing strategy.

TESTING PRINCIPLES: There are many principles that guide software

testing. Before applying methods to design effective test cases, a

software engineer must understand the basic principles that guide

software testing. Following are main principles for testing.


• All test should be traceable to customer requirements: This

is in order to uncover any defects that might cause the program or

systemto fail to meet the the clients requirements.

• Tests should be planned long before testing begins: Soon

after requirements model is completed, test planning can begin.

Detailled test cases can begin as soon as the design model is

designed.

• The Pareto principle applies to software testing: Stated

simply, the pareto principles implies that 80 of errors uncovered

during testing will likely be traceable to 20 percent of program

components and to throughly test them.

• Testing should begin “in the small” and progress towards

testing “il the large”: The first tests planned and executed

generally focus on individual components. As testing progresses,

focus shifts inan attempt to find errors in integrated clusters of

progresses and ultimately in the entire system.

• Exhaustive testing is not possible: The number of path

peramutation for even a moderately sized program is exceptionally

large. It is impossible to execute every combination of path during

testing.

• To be most effective, testing should be conducted by an

independent third party: The software engineer who has created


the system is not the best person to conduct all tests of the

software.

Testing Objectives: This objectives also demonstrates that the software

functions are working according to software requirement specifications

(SRS) with regard to functionallity, features, Facilities and performance.

• Testing is a process of executing a program with the intent of

finding an errors.

• A good test case is one that has a high probabillity of finding an as

yet undescovered error.

• A successful test is one that uncovers an as yet undiscovered

errors.

LEVELS OF TESTING:

There are three levels of testing individual module to the entire software

systems

Unit Testing: In unit testing individual components are tested to ensure

that they operate correctly.

• There are number of reasons in support of unit testing the entire

product.

• The size of a single module is small enough that we can locate an

error fairly easily.

• The module is small enough that we can attempt to test it in some

demonstrably exhaustive fashion.


• Confusing interactions of multiple errors in widely different parts of

the of software are eliminated.

Commans errors in Computation are:

1) Incorrect arithmetic precedence

2) Mixed code operations

3) Incorrect intializations

4) Precision inaccuracy

5) Incorrect symbolic representation of an expression.

Test cases in unit testing shiuld uncover error such as:

1) Comparision of different data types

2) Incorrect logical operation or precedence

3) Exception of equality when precision error makes equality unlikely

4) Incorrect comparison of variables

5) Improper loop termination

6) Failure to exit when divergent iteration is encountered

7) Improperly modified loop variables

Unit testing is a simplified when a component with a high cohesion is

designed. When only one functionis addressed by a component, the

number of test cases is reduced and errors can be more easily predicted

and uncovered.
Integration Testing :The second level of testing is called integration

testing. Integration testing is a systematic technique for constructing the

program structure while at same time conducting tests to uncover errors

is associated with interfacing.

In this testing many unit tested modules are combined into sub-system ,

which are then tested. The goal here is to see if the modules can be

integrated property.

Approches to Integration Testing: The various approaches , which are

used for the integration testing are:-

1) Incremental approaches

2) Top-down approaches

3) Bottam-up integration

4) Regression testing

5) Smoke testing

6) Sandwich Integration testing

System Testing: The sub-systems are inegrated to make up the entire

system. The testing process is concerned with finding error that result

most unanticipated between sub systems and system components. Its is

also concerend with validating that the system need its functional or non-

functional requirements.

There are essentially three main kinds of system testing:

1) Alpha Testing

2) Beta Testing

3) Acceptance Testing
Alpha Testing: Alpha Testing refers to the system testing caried out by

the test team with in development organization.

Beta Testing: Beta testing is the system testing performed by a selected

group of friendly customers.

1. Acceptance Testing: Acceptance testing is the testing performed

by the customer to determine whether to accept or reject the

delivery of the system.


Future Application

Various new features can be added so that it can attract more and more

people:

• The project can also be used in the hotel room so the customer

can also be familiar to the hotel system.

• This project can also be used for the future booking & provides the

report about any transaction.


CONCLUSION

The HOTEL MANAGEMENT SYSTEM is indeed a great help in simplifying

the collection of fine. The project will eliminate the need to maintain

resisters and makes the task easy.

It helps to maintain all the information about the customers, staff

members and rooms but there is a great scope of improvement of the

system as more improvisation would be added into the system, it would

become better.

I hope my project has given any reader a clear understatnding of the

type of computerized Hotel Managament System.


Bibliography

For the development this project I have to follow some books. The

methods and concepts of these books help me to solve conceptual

& syntax detailed problems.

1. Visual Basic.Net WROX

2. System Analysis & Design Elias M. Award

3. S/W Engineering Roger S.

Pressman

You might also like