收藏 分销(赏)

数据库课程设计程序代码(宾馆客房管理系统).doc

上传人:xrp****65 文档编号:7014663 上传时间:2024-12-24 格式:DOC 页数:4 大小:47.50KB
下载 相关 举报
数据库课程设计程序代码(宾馆客房管理系统).doc_第1页
第1页 / 共4页
数据库课程设计程序代码(宾馆客房管理系统).doc_第2页
第2页 / 共4页
数据库课程设计程序代码(宾馆客房管理系统).doc_第3页
第3页 / 共4页
数据库课程设计程序代码(宾馆客房管理系统).doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、create database hotelmanager /*创建数据库hotelmanager*/gouse hotelmanagergocreate table cusinfo /*创建数据表cusinfo*/(dingname varchar(10) not null, cname varchar(10), cid char(18), vip char(2)gocreate table ordform /*创建数据表ordform*/(ono varchar(36) not null, cname varchar(10) not null, csex char(2), cid char(

2、18), rid char(6) not null, rstyle varchar(10), arrivetime datetime, cno char(10) not null, dingname varchar(10), livetime char(10), dingph char(15) not null, ozt char(4)gocreate table roominfo /*创建数据表roominfo*/(rid char(6) not null, rstyle varchar(10), kfzt char(2) not null)gocreate table liveorder

3、/*创建数据表liveorder*/(lno varchar(36) not null, rid char(6) not null, rstyle varchar(10), btime datetime not null, cno char(10), cname varchar(10) not null, etime datetime, ono varchar(36), lzt char(4) )gocreate table bill /*创建数据表bill*/(bno varchar(36) not null, rid char(6) not null, cname varchar(10),

4、 cust money, btime datetime, etime datetime, remarks varchar(40) gocreate table roomsp /*创建数据表roomsp*/(rstyle varchar(10) not null, rprice money)gocreate table hordform /*创建数据表hordform*/(ono varchar(36) not null, cname varchar(10) not null, csex char(2), cid char(18), rid char(6) not null, rstyle va

5、rchar(10), arrivetime datetime, cno char(10) not null, dingname varchar(10), livetime char(10), dingph char(15) not null, ozt char(4)gocreate table hliveorder /*创建数据表hliveorder*/(lno varchar(36) not null, rid char(6) not null, rstyle varchar(10), btime datetime not null, cno char(10), cname varchar(

6、10) not null, etime datetime, ono varchar(36), lzt char(4) )goinsert into cusinfo values(mao,zcl,330227198805060071,n)insert into cusinfo values(qxb,zyy,330227198603070022,n)goinsert into roominfo values(2010,s,n)insert into roominfo values(2201,s,n)insert into roominfo values(2301,s,n) insert into

7、roominfo values(3010,s,y) insert into roominfo values(3012,s,n)insert into roominfo values(3015,s,n)insert into roominfo values(4210,d,n)insert into roominfo values(4110,d,n)insert into roominfo values(4010,d,n)insert into roominfo values(5220,d,n)insert into roominfo values(5210,d,n)insert into roo

8、minfo values(5201,d,n)goinsert into roomsp values(s,200)insert into roomsp values(d,300)go insert into ordform values(o0201001,zcl,f,330227198805060071,2301,s,2010-01-02,1,mao,1,883060089,n)goinsert into liveorder values(l2010001,2301,s,2010-01-02,1,zcl,2010-01-03,o0201001,n)insert into liveorder va

9、lues(l2010002,3010,s,2010-01-03,1,qxb,2010-01-04,o0201002,y)insert into liveorder(lno,rid,rstyle,btime,cno,cname,ono,lzt) values(l2010003,5220,d,2010-01-09,1,myy,o0201003,y)insert into liveorder(lno,rid,rstyle,btime,cno,cname,ono,lzt)values(l2010004,5201,d,2010-01-02,2,zxx,null,y)goinsert into bill(

10、bno,rid,cname,cust,btime) values(b2010003,5220,myy,0,2010-01-10)insert into bill(bno,rid,cname,cust,btime) values(b2010004,5201,zxx,0,2010-01-02)goalter table cusinfo add primary key(dingname)alter table ordform add primary key(ono)alter table roominfo add primary key(rid)alter table liveorder add p

11、rimary key(lno)alter table bill add primary key(bno)alter table roomsp add primary key(rstyle)gocreate proc ordformproc lno varchar(36) /*保存入住单*/asbegin tranupdate roominfo set kfzt=y from roominfo,liveorder where liveorder.rid=roominfo.rid and liveorder.lno=lno /*修改客房信息*/update ordform set ozt=y fr

12、om ordform,liveorder where liveorder.ono=ordform.ono and liveorder.lno=lno /*修改预订单信息*/insert into hordform select * from ordform where ozt=y /*将已入住的预订单放入历史*/delete from ordform where ozt=y /*清除已入住预订单*/commitgoselect * from roominfoselect * from ordformgoexec ordformproc l2010001exec ordformproc l201

13、0004select * from roominfoselect * from ordformgocreate proc liveorderproc lno varchar(36) /*收银退房*/asbegin tranupdate liveorder set etime=getdate(),lzt=n where lno=lno update roominfo set kfzt=n from roominfo,liveorder where roominfo.rid=liveorder.rid and liveorder.lno=lno /*修改客房状态*/insert into hliv

14、eorder select * from liveorder where lno=lno /*导入历史*/delete from liveorder where lno=lno /*清除入住单*/commitgoselect * from liveorderselect * from hliveordergoexec liveorderproc l2010004goselect * from liveorderselect * from hliveorder select *from roominfo where rid=5201gocreate proc billproc lno varch

15、ar(36) /*计算应收款*/asbegin trandeclare total moneydeclare datecount intupdate liveorder set etime=getdate() where lno=lno /*设置离店时间*/select datecount=datediff(dd,btime,getdate() from liveorder where lno=lno /*计算住店天数*/select total=0select total=datecount*(isnull(rprice,0) from liveorder,bill,roomsp where

16、 bill.rid=liveorder.rid and liveorder.rstyle=roomsp.rstyle and lno=lno /*计算住店金额*/update bill set etime=getdate(),cust=total from bill,liveorder where bill.rid=liveorder.rid and lno=lno /*修改账单*/commitgo select * from liveorderselect * from bill goexec billproc l2010004goselect * from liveorderselect * from bill

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 百科休闲 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服