Sunteți pe pagina 1din 20

1

NATIONAL INSTITUTE OF TECHNOLOGY,


TIRUCHIRAPPALLI-15

Department of Computer Applications

Hotel Management System

PROJECT WORK

Submitted By

S.Nirmal Kumar – 205107055

Under the guidance of

Dr. S Nicholas

Submitted in fulfillment of the project in pl/sql.


2

NATIONAL INSTITUTE OF TECHNOLOGY,


TIRUCHIRAPPALLI-15

CERTIFICATE

This is to certify that S.Nirmal Kumar(205107055), student of


3rd semester MCA (batch 2007-2010) of National Institute of
Technology, Tiruchirappalli has successfully completed the
project Hotel Management System in PL/SQL under the
guidance of Dr. S Nicholas

Signature

(Dr. S Nicholas)
3

Problem Definition and Introduction

The System is to manage all the Boarding and lodging


activities of a hotel. It automates the task of room reservation,
bill generation, checks room availability, etc. The overall
Functioning of the system, schemas and its attributes are
mentioned below.

TASKS:

 Customer Information
 Room Reservation
 Room Availability
 Room Billing
 Hall Reservation
 Hall Availability
 Hall Billing

SCHEMAS:
 Customer
 Room Type
 Hall Type
 Check in room
 Check in hall
4

Tables

I am using the fallowing four tables:-

Table CUSTOMER
Cust id. Primary Key
Custname
Address
ph number

Table ROOMTYPE
Room no Primary key
Room type
Room rent
Availability

Table HALLTYPE
Hall no Primary key
Hall type
Hall rent
Availability
5

Table CHECKINROOM
Room id Foreign key
Cust id Foreign key
Check in
Check out

Table CHECKINHALL
Hall id Foreign key
Cust id Foreign key
Check in
Check out
6

Creating Tables

1.TABLE CUSTOMER:

create table customer(


custid number(5) not null,
custname varchar2(20),
address varchar2(30),
ph number number(10),
primary key(custid));

Table created.

2.TABLE ROOMTYPE:

create table roomtype(


roomno not null number(5)
roomtype varchar(10)
roomrent number(10)
availability varchar(5)
primary key(roomno));

Table Created.
7

3. TABLE HALLTYPE:
Create table halltype(
hallno not null number(5)
halltype varchar(10)
hallrent number(10)
availability varchar(5)
primary key(hallno));

Table Created.

4. TABLE CHECKINROOM:

create table checkinroom(


roomid number(5) ,
custid varchar(15),
checkin date ,
checkout date,
foreign key (roomid) references roomtype,
foreign key(custid)references customer );

Table Created.
8

5.TABLE CHECKINHALL:

create table checkinhall(


hallid number(5) ,
custid varchar(15),
checkin date ,
checkout date,
foreign key (hallid) references halltype,
foreign key(custid)references customer );

Table created.
9

Creating Procedures

1)PROCEDURE FOR INPUT:-

create or replace procedure insecust(cid int,cname varchar,cadd


varchar,mobileno number)
is
begin
insert into customer1 values(cid,cname,cadd,mobileno);
end;

procedure created;

create or replace procedure inseroom(rno int,rtype varchar,rrent


int) is
begin
insert into roomtype values(rno,rtype,rrent);
end

Procedure created.

create or replace procedure insehall(hno int,hname varchar,htype


varchar,hrent int) is
begin
insert into halltype values(hno,hname,htype,hrent);
end;

Procedure created.
10

2) PROCEDURE FOR MANAGING TRANSACTION:-

Procedure for CheckinRoom


create or replace procedure customer_login(cid number,type
varchar,datein date) is
cursor ac is select roomtype,available,roomno from roomtype
where roomtype=type;
aa roomtype.roomtype%type;
av roomtype.available%type;
rno roomtype.roomno%type;
begin
open ac;
loop
exit when ac%notfound;
fetch ac into aa,av,rno;
if(av='y') then
insert into
checkinroom(roomid,cid,checkin)values(rno,cid,datein);
update roomtype set available='n' where
roomno=rno ;
exit;
end if;
end loop;
if(av='n')then
dbms_output.put_line('Room is not available');
end if;
close ac;
end;
11

Procedure for CheckinHall


create or replace procedure customer_loginh(cid number,type
varchar,datein date) is
cursor ac is select halltype,available,hallno from halltype
where halltype=type;
aa halltype.halltype%type;
av halltype.available%type;
hno halltype.hallno%type;
begin
open ac;
loop
exit when ac%notfound;
fetch ac into aa,av,hno;
if(av='y') then
insert into
checkinhall(hallid,cid,checkin)values(hno,cid,datein);
update halltype set available='n' where hallno=hno ;
exit;
end if;
end loop;
if(av='n')then
dbms_output.put_line('Hall is not available');
end if;
close ac;
end;
12

Procedure for CheckoutRoom


create or replace procedure customer_logout1(cid1
number,dateout date) is
dd number;
amt number;
rno roomtype.roomno%type;
cin date;
rrent roomtype.roomrent%type;
begin
select roomid,checkin into rno,cin from checkinroom where
cid=cid1;
select roomrent into rrent from roomtype where roomno=rno;
dd:=dateout-cin;
amt:=dd*rrent;
dbms_output.put_line('Bill amount='||amt);
update roomtype set available='y' where roomno=rno;
delete from checkinroom where cid=cid1;
end;
13

Procedure for CheckoutHall


create or replace procedure customer_logout1(cid1
number,dateout date) is
dd number;
amt number;
hno halltype.hallno%type;
cin date;
hrent halltype.hallrent%type;
begin
select hallid,checkin into hno,cin from checkinhall where
cid=cid1;
select hallrent into hrent from halltype where hallno=hno;
dd:=dateout-cin;
amt:=dd*hrent;
dbms_output.put_line('Bill amount='||amt);
update halltype set available='y' where hallno=hno;
delete from checkinhall where cid=cid1;
end;
14

Entering Values in Tables

1)SQL> exec insecust(301,'Nirmal','123,k.k.nagar,madurai-


16',9486067565);

PL/SQL procedure successfully completed.

SQL> exec insecust(302,'Dineshrai','112,hai nagar,bangalore-


10',9787120240);

PL/SQL procedure successfully completed.

2)SQL> exec inseroom(101,'a/c',1500);

PL/SQL procedure successfully completed.

SQL> exec inseroom(102,'a/c',1500);

PL/SQL procedure successfully completed.

3) SQL> exec insehall(201,'breeze','a/c',20000);

PL/SQL procedure successfully completed.

SQL> exec insehall(202,'sangam','a/c',25000);


15

PL/SQL procedure successfully completed.

SQL> select * from customer;

CID CNAME CADDRESS ph number


---------------------------------------------------------------------------------------
301 Nirmal 123,k.k.nagar,madurai-16 9996564629
302 Dineshrai 112,hai nagar,bangalore-10 9879657392
303 Pandian 1,tolgate,vellore-10 9995434509
304 Selvam 6/77,ahamedcolony,chennai-28 9842333309
305 vasan 122,walaja road 9899433339
306 ganesan 33-ggstreet 9443423887

6 rows selected.

SQL> select * from roomtype;

ROOMNO ROOMTYPE ROOMRENT AVAILABILITY


------------------------------------------------------------------------------
101 a/c 1500 y
102 a/c 1500 y
103 Non a/c 750 y
104 Non a/c 750 y
105 Non a/c 750 y
106 deluxe 2500 y
107 superdeluxe 5000 y
108 a/c 1500 y
109 Non a/c 750 y
110 Non a/c 750 y

10 rows selected.

SQL> select * from halltype;


16

HALLNO HALLNAME HALLTYPE HALLRENT AV


------------------------------------------------------------------------------------
201 breeze a/c 20000 y
202 sangam a/c 25000 y
203 oranto Non a/c 15000 y
204 Garnet Non a/c 17500 y

4 rows selected

RESULTS

SQL> exec customer_login(303,'Non a/c','21-jan-2009');

PL/SQL procedure successfully completed.

SQL> select * from checkinroom;

ROOMID CID CHECKIN CHECKOUT


-------------------------------------------------------
107 306 20-JAN-09
103 303 21-JAN-09
17

ROOMNO ROOMTYPE ROOMRENT AVAILABILITY


------------------------------------------------------------------------------
101 a/c 1500 y
102 a/c 1500 y
103 Non a/c 750 n
104 Non a/c 750 y
105 Non a/c 750 y
106 deluxe 2500 y
107 superdeluxe 5000 n
108 a/c 1500 y
109 Non a/c 750 y
110 Non a/c 750 y

SQL> exec customer_loginh(302,'a/c','19-jan-2008');

PL/SQL procedure successfully completed.

SQL> select * from checkinhall;

HALLID CID CHECKIN CHECKOUT


-------------------------------------------------------
201 302 19-JAN-09
202 304 19-JAN-09
18

SQL> select * from halltype;

HALLNO HALLNAME HALLTYPE HALLRENT AV


------------------------------------------------------------------------------------
201 breeze a/c 20000 n
202 sangam a/c 25000 n
203 oranto Non a/c 15000 y
204 Garnet Non a/c 17500 y

SQL> exec customer_logout1(301,'21-jan-2009');

Bill amount=3000
PL/SQL procedure successfully completed.

ROOMNO ROOMTYPE ROOMRENT AVAILABILITY


------------------------------------------------------------------------------
101 a/c 1500 y
102 a/c 1500 y
103 Non a/c 750 y
104 Non a/c 750 y
105 Non a/c 750 y
106 deluxe 2500 y
107 superdeluxe 5000 y
108 a/c 1500 y
109 Non a/c 750 y
110 Non a/c 750 y
19

SQL> exec customer_logout1(302,'22-jan-2009');

Bill amount=7380000

PL/SQL procedure successfully completed.

HALLNO HALLNAME HALLTYPE HALLRENT AV


------------------------------------------------------------------------------------
201 breeze a/c 20000 y
202 sangam a/c 25000 y
203 oranto Non a/c 15000 y
204 Garnet Non a/c 17500 y
20

Future Enhancements

There are a lot of things which can be taken care in the project
and it can be done in better way.

We can perform operations such as room reservation ,


availability, hall reservation, billing.
Now after the web is made available at all the places and the
way in which it can be accessed easily and managed
comfortably there is a need for a software which can manage
everything for hotel room reservation. To implement this we
need a front end tool which will give a user friendly end to the
customer for easy reservation of the hotel room through online.

If we can implement the above situation the project can be used


for all the hotel depending on their requirements.

S-ar putea să vă placă și