酒店客房管理系统系统.docx
《酒店客房管理系统系统.docx》由会员分享,可在线阅读,更多相关《酒店客房管理系统系统.docx(15页珍藏版)》请在冰豆网上搜索。
![酒店客房管理系统系统.docx](https://file1.bdocx.com/fileroot1/2022-12/12/e76e42ca-338f-4c39-b4a3-b01f8b477bf1/e76e42ca-338f-4c39-b4a3-b01f8b477bf11.gif)
酒店客房管理系统系统
石河子大学信息科学与技术学院
数据库原理课程设计
题目:
酒店客房管理系统系统
姓名:
学号:
院系:
信息科学与技术学院
专业:
计算机科学与技术专业
班级:
指导教师:
[二零一零年1月六日]
目录
1.引言2
1.1编写目的2
2.外部设计2
2.1支持软件2
3.结构设计3
3.1概念结构设计3
3.2功能模块图5
3.3业务流程图…………………………………………………………………8
3.4数据库的E-R图:
9
4.数据库设计……………………………………………………………………….9
5.代码编写…………………………………………………………………………10
5.1存储过程……………………………………………………………………10
5.2触发器………………………………………………………………………13
.
数据库设计说明书
1.引言
1.1编写目的
为了让本系统的管理员能很好的对本系统进行管理和维护,对本系统的数据能很好的管理,从而为用户提供帮助,提高管理效率和绩效,通过阅读本说明书还可以提高对系统数据库的整体认识。
2.外部设计
2.1支持软件
本数据库主要采用微软公司的成熟数据库系统SQLServer2000,2005,2008,提供了较为灵活操作简单的功能,可以为数据库管理员和系统开发人员提供很好的支持。
3.结构设计
3.1概念结构设计
本数据库将反映的现实世界中的实体、属性和它们之间的关系等的原始数据形式,包括各数据项、记录、系、文卷的标识符、定义、类型、度量单位和值域,建立本数据库的每一幅用户视图,如下图所示:
包间状态
客房状态
客历表
总体关系图
3.2功能模块图:
总图
包间预定
来客接待
结帐系统
3.3业务流程图:
3.4数据库的E-R图:
4.数据库设计:
一.客房表:
1.房号2.房间类型号3.状态4.预定备注
二.客房类型表:
1.类型号2.价位3.单/双/多人间4.状态号5.状态
三.房客表:
1.身份证号2.姓名3.性别号4.房间号5.开房日期6.退房日期7.电话
四.性别表:
1.性别号2.性别
五.消费表:
1.房号2.姓名3.身份证号4.开房日期5.退房时间6.结账日期7.账目信息8.备注
5.代码编写:
5.1存储过程:
包间到位登记
CREATEPROCEDUREpro_bjdwdj
@hnochar(10),@pnochar(17),@pnamechar(20),@telchar(20),@sexnochar
(1),@shourschar(4)
AS
updatehousesettexno=1wherehno=@hno
updatehousesetinfo='null'wherehno=@hno
insertintoformvalues(@hno,0,'null')
insertintopersonvalues(@pno,@pname,@sexno,@tel,@hno,@shours)
insertintohistoryvalues(@pno,@pname,'null',@tel)
updatehousesetfno=@hnowherehno=@hno
GO
包间未预订查询
CREATEPROCEDUREpro_bjwydcx
@hnochar(10)output,@hstylechar(10)output,@pricechar(10)output,@personschar(10)output,@infochar(10)='null',@texchar(10)='空'
AS
select@hno=hno,@hstyle=hstyle,@price=price,@persons=personsfromhouse,hstyle,tex
wheretex.texno=house.texnoandhouse.hstyleno=hstyle.hstylenoandinfo=@infoandtex=@tex
GO
查询包间预定信息
CREATEPROCEDUREpro_cxbjyjxx
@hnochar(10),@infochar(20)output
AS
select@info=infofromhousewherehno=@hno
GO
查询包间状态
CREATEPROCEDUREpro_cxbjzt
@hnochar(10),@hstylechar(10)output,@texchar(8)output,@infochar(20)output,@fnochar(20)output
as
select@hstyle=hstyle,@tex=tex,@info=info,@fno=fno
fromhouse,hstyle,tex
wherehouse.hstyleno=hstyle.hstylenoandtex.texno=house.texnoandhno=@hno
GO
查询住房预定信息
CREATEPROCEDUREpro_cxzfydxx
@rnochar(10),@rinfochar(20)output
AS
select@rinfo=rinfofromroomwhererno=@rno
GO
查账
CREATEPROCEDUREpro_cz
@fnochar(10),@moneychar(10)output,@infochar(20)
as
select@fno=fno,@money=money,@info=info
fromform
wherefno=@fno
GO
空包间
createprocedurepro_kbjcx
@hnochar(10)output,@hstylechar(10)output,@infochar(20),@texnochar
(1)=0
as
select@hno=hno,@hstyle=hstyle,@info=info
fromhouse,hstlye
wherehouse.hstyleno=hstyle.hstylenoandhno=@hno
GO
房间查询
CREATEPROCEDUREpro_kfcx
@rnochar(10),@stylechar(10),@pricechar(10),@personschar(10),@texchar(10),@rinfochar(10),@fnochar(10)
AS
select@style=style,@price=price,@persons=persons,@tex=tex,@rinfo=rinfo,@fno=fnofromroom,roomstyle,tex
wheretex.texno=room.texnoandroom.styleno=roomstyle.stylenoandrno=@rno
GO
客户入住登记
CREATEPROCEDUREpro_khrzdj
@rnochar(10),@pnochar(17),@pnamechar(20),@telchar(20),@sexnochar
(1),@shourschar(4)
AS
updateroomsettexno=1whererno=@rno
updateroomsetrinfo='null'whererno=@rno
insertintoformvalues(@rno,0,'null')
insertintopersonvalues(@pno,@pname,@sexno,@tel,@rno,@shours)
updateroomsetfno=@rnowhererno=@rno
GO
空余住房查询
createprocedurepro_kyzfcx
@rnochar(10)output,@stylechar(10)output,@rinfochar(20),@texnochar
(1)=0
as
select@rno=rno,@style=style,@rinfo=rinfo
fromroom,stlye
whereroom.styleno=style.stylenoandtexno=@texno
GO
录入预定住房信息
CREATEPROCEDUREpro_lrydzfcx
@rnochar(10),@rinfochar(20)
AS
updateroomsetrinfo=@rinfowhererno=@rno
GO
录入预订包间信息
CREATEPROCEDUREpro_lryjbjxx
@hnochar(10),@infochar(20)
AS
updatehousesetinfo=@infowherehno=@hno
GO
录入账单
CREATEPROCEDUREpro_lrzd
@fnochar(10),@moneychar(10)
as
updateformsetmoney=money+@moneywherefno=@fno
GO
消除包间预定信息
CREATEPROCEDUREpro_scbjyjxx
@hnochar(10)
AS
updatehousesetinfo='null'wherehno=@hno
GO
消除住房预定信息
CREATEPROCEDUREpro_sczfyjxx
@rnochar(10)
AS
updateroomsetrinfo='null'whererno=@rno
GO
退包间结账
CREATEPROCEDUREpro_tbjjz
@fnochar(10)
as
updatehousesetinfo='null',fno='null'wherehno=@fno
deletefromformwherefno=@fno
GO
退房结账
CREATEPROCEDUREpro_tfjz
@fnochar(10)
as
updateroomsetrinfo='null',fno='null'whererno=@fno
deletefromformwherefno=@fno
GO
修改查询包间客户信息
createprocedurepro_xfcxgjkhxx
@fnochar(20),@hnochar(5)
as
updatepersonsetfno=@hnowherefno=@hno
updatehousesettexno=0wherehno=@fno
updatehousesetfno=@hnowherehno=@fno
updateformsetfno=@hnowherefno=@fno
GO
修改查询住房客户信息
createprocedurepro_xgcxzffkxx
@fnochar(20),@rnochar(5)
as
updatepersonsetfno=@rnowherefno=@rno
updateroomsettexno=0whererno=@fno
updateroomsetfno=@rnowhererno=@fno
updateformsetfno=@rnowherefno=@fno
GO
住房未预订查询
CREATEPROCEDUREpro_zfwydcx
@rnochar(10)output,@stylechar(10)output,@pricechar(10)output,@personschar(10)output,@rinfochar(10)='null',@texchar(10)='空'
AS
select@rno=rno,@style=style,@price=price,@persons=personsfromroom,roomstyle,tex
wheretex.texno=room.texnoandroom.styleno=roomstyle.stylenoandrinfo=@rinfoandtex=@tex
GO
5.2触发器
关于结账后触发器
createtriggertri_sc
onformfordelete
as
declare@money_oldchar(10),@fnochar(10),@pnochar(17)
select@money_old=money,@fno=fno
fromdeleted
select@pno=pno
fromperson
wherefno=@fno
updatehistorysetmoney=@money_oldwherepno=@pno
deletefrompersonwherepno=@pno