1、 景点门票销售部1.3 参考资料 1王珊,萨师煊.数据库系统概论M.高等教育出版社,2006年5月第4版2郑人杰,马素霞,殷人昆.软件工程概率M.机械工业出版社,2009年11月3马晓梅.SQL Server实验指导M.清华大学出版社,2009年9月第3版2需求分析2.1目标这个门票管理系统主要是处理旅客买票,订票,退票,以及各类查询结算。该系统针对的用户是门票销售部门,由于门票销售,查询以及计算各天或者不同时间段的收入比较繁琐,此系统方便简单的实现了这些功能,使得管理员与职工方便很多,让这个门票销售都变得条条有理。2.2运算坏境(1)软件资源服务器端软件选择的具体说明:操作系统:Window
2、s 2007 Server 或 Windows XP。数据库管理系统:SQL Server。开发工具:visual studio 2008.软件平台:windows+iis+mssql。客户端软件选择的具体说明:web浏览器。2.3 需求概述本系统的开发是为了提高门票销售以及管理的效率,尽可能杜绝各个销售环节中可能出现的资金流失不明现象,满足系统化的门票管理域收入需求。系统功能主要包括:登陆管理(包括管理员登陆以及职工登陆,职工注册情况),系统管理(系统启用,及其系统截止),直接销售(个人购买与团购),订票管理(订票与查看订票状态),退票管理(处理当天所要退的票),查询管理(按时间查询,按职工
3、号查询,游客种类查询,按时间票号查询,按时间,职工号查询,按时间,游客种类查询,以及当天销售查询),结算管理(具体时间查询以及时间段查询),最后是系统简介。3结构设计3.1逻辑结构设计3.1.1 局部 E-R 图图4. 营业员E-R图图5. 游客E-R图图6. 门票E-R图图7. 门票类型E-R图3.1.2 全局 E-R 图图8总体E-R图3.1.3关系模式Admin_T( Sell_operator,User_name,password,Sex,Realname,Cardnumber,Age,Phone,User_type) 该表为管理表,表项包括销售营业员,用户姓名,密码,性别,真实姓名,
4、卡号,年龄,电话号码,用户类型的信息。主键为销售营业员。Dd_T( Order_ID,Custom_ID,Ticker_ID,Ticker_type,Ticker_Price,Sell_operator,Sell_date,Sell_month) 该表为订单表,表项有订单号,游客号,门票号,门票类型,门票价格,销售营业员,销售日期和销售月份。该表的主键为订单号,外键有游客号,门票号,门票类型,门票价格和销售营业员。Custom_T(Custom_ID,Custom_name,Sex,Age,Cardnumber,Custom_type,Custom_phone) 该表为游客信息表,表项有游客号
5、,游客姓名,身份证号,游客类型,游客电话。该表主键为游客号,无外键。Ticket_summary(Sell_ID,Ticket_type, Sell_amount,Sell_money,Sell_month)该表为门票信息统计表,表项有出售号码,门票类型,出售时间,出售月份,出售价格。该表主键为出售号,外键为门票类型。Ticket_T(Ticket_type,Ticket_type_name,Ticket_price,Ticket_Count,Ticket_comment,Date) 该表为门票信息表,表项有门票类型,类型名,门票价格,门票数量,日期。主键为门票类型,无外键。Ticket_Li
6、st(Ticket_ID,Ticket_type,Sell_flag) 该表为门票属性信息表,表项为门票号,门票类型,和是否出售标记。主键为门票号,外键为门票类型。3.1.1关系图3.2物理结构设计表1 Admin_T表列名数据类型允许空Sell_operatornvarchar(10)NO NULLUser_namevarchar(20)PasswordSexchar(5)NULLRealnamecardnumberchar(18)AgeintPhonechar(11)User_typechar(10)表2 Custom_T表Custom_IDCustom_nameCardnumberCus
7、tom_typeCustom_phone表3 dd_T表Order_IDTicket_IDchar(17)Ticket_typechar(3)Ticket_Pricedecimal(5,2)Sell_datedatetimeSell_month表4 Ticket_List表Sell_flag表5 Ticket_summary表Sell_IDchar(20)Sell_amountSell_money表6 Ticket_T表Ticket_type_name char(50)Ticket_priceTicket_CountTicket_commentchar(200)Date4.存储过程4.1统计指
8、定日期的门票销售情况create Procedure Pro_QTicsinf starttime datetime,endtime datetime,sSell_amount_out int output, sSell_money_out decimal(5, 2) outputAS select sSell_amount_out=count(Ticket_ID), sSell_money_out=sum(dd_T.Ticket_Price)from dd_T,Ticket_Twhere Ticket_T.Ticket_type=dd_T.Ticket_type and Sell_date
9、between starttime and endtimedeclare starttime datetime, endtime datetime,sSell_amount_out int , sSell_money_out decimal(5, 2) select starttime=2013/1/13 00:00:00 select endtime=2013/1/13 19:40:exec Pro_QTicsinf starttime,endtime,sSell_amount_out output,sSell_money_out outputselect sSell_amount_out
10、as 门票数量,sSell_money_out as 金额4.2统计指定月份的门票销售情况create Procedure Pro_QTicsminf sSell_month nvarchar(10),sSell_amount_out int output,sSell_money_out decimal(5, 2) outputwhere Ticket_T.Ticket_type=dd_T.Ticket_type and Sell_month=sSell_monthdeclare sSell_month nvarchar(10),sSell_amount_out int, select sSe
11、ll_month=2013/1exec Pro_QTicsminf sSell_month,sSell_amount_out output,sSell_money_out output4.3统计指定日期各种价格的门票销售情况create Procedure Pro_QTicsPinf starttime datetime,endtime datetime, sTicket_type char(3), sTicket_Price_out decimal(5, 2) output,sSell_amount_out int output,AS select sTicket_Price_out=Tic
12、ket_Price, sSell_amount_out=count(Ticket_ID), sSell_money_out=sum(dd_T.Ticket_Price)from dd_Twhere sTicket_type=dd_T.Ticket_type and Sell_date between starttime and endtimegroup by Ticket_Pricedeclare starttime datetime, endtime datetime,sTicket_type char(3), sTicket_Price_out decimal(5, 2), sSell_a
13、mount_out int , sSell_money_out decimal(5, 2) 00 select sTicket_type=T01exec Pro_QTicsPinf starttime,endtime,sTicket_type,sTicket_Price_out output,sSell_amount_out output,sSell_money_out outputselect sTicket_Price_out as 门票价格,sSell_amount_out as 门票数量,sSell_money_out as 门票金额T02T034.3统计指定营业员指定日期的收费情况c
14、reate Procedure Pro_QTicsCinf starttime datetime,endtime datetime, sSell_operator nvarchar(10), sSell_amount_out int output,sSell_money_out decimal(5, 2) outputwhere sSell_operator=dd_T.Sell_operator and Sell_date between starttime and endtimegroup by Sell_operatordeclare starttime datetime, endtime
15、 datetime,sSell_operator nvarchar(10),2013/1/13 23: select sSell_operator=001exec Pro_QTicsCinf starttime,endtime,sSell_operator,sSell_amount_out output,sSell_money_out output select sSell_operator as 营业员,sSell_amount_out as 销售门票数量,sSell_money_out as 收费总金额0025 触发器a.有人买票时,自动更改门票标志位create trigger TRIG
16、GER_BUY_TIC on dd_T for insertas begin Declare Ticket_ID_IN char(17) Select Ticket_ID_IN=Ticket_ID from inserted update Ticket_List set Sell_flag=1 where Ticket_ID=Ticket_ID_IN endinsert into dd_T values(O006,1005S0006,40,2013/2/13 19:50:2013/2)b.若有人退票,对各表所有有关该人的信息进行级联删除create trigger TRiGGER_EXIT_T
17、IC on dd_T for deleteas Declare Order_ID_DEL char(10),Custom_ID_DEL char(10),Ticket_ID_ALT char(17) Select Order_ID_DEL=Order_ID,Custom_ID_DEL=Custom_ID,Ticket_ID_ALT=Ticket_ID from deleted update Ticket_List set Sell_flag=0 where Ticket_ID=Ticket_ID_ALT delete from Custom_T where Custom_ID=Custom_I
18、D_DELgoDELETE from dd_T where Order_ID=c.当门票销售时自动减少该该类型门票的总量create trigger tri_Tic_Sell on Ticket_summary for insert as declare oldcount int,newcount int,sTicket_type char(3) select sTicket_type=Ticket_type,newcount=Sell_amount from inserted select oldcount=Ticket_Count from Ticket_T where Ticket_ty
19、pe=sTicket_type if newcount0 and oldcount update Ticket_T set Ticket_Count=oldcount-newcount where Ticket_type=sTicket_type return rollback transactioninsert into Ticket_summary values(C00042013-01-17 18:47, ,2,40,2013-01d.当门票修改类型时自动修改门票各类型的数量create trigger tri_Ticxg on Ticket_List for update as dec
20、lare sTic_ID char(17),sTicket_type char(3),saTicket_type char(3),scount int,sacount int select sTicket_type=Ticket_type,sTic_ID=Ticket_ID from inserted select saTicket_type=Ticket_type from Ticket_List where Ticket_ID=sTic_ID select scount=Ticket_Count from Ticket_T where Ticket_type=sTicket_type se
21、lect sacount=Ticket_Count from Ticket_T where Ticket_type=saTicket_type update Ticket_T set Ticket_Count=scount+1 where Ticket_type=sTicket_type update Ticket_T set Ticket_COunt=sacount-1 where Ticket_type=saTicket_typeupdate Ticket_List set Ticket_type= where Ticket_ID=S00016完整性约束USE Attraction_Man
22、agego alter table Admin_T with check add constraint CHECK_SEX check(Sex=男 or Sex=女), constraint CHECK_AGE check(Age=0)alter table Custom_T with check add constraint CHECK1_SEX check(Sex= constraint CHECK1_AGE check(Agealter table Admin_alter table Ticket_summary with check add constraint CHECK_Sell_amount check(Sell_amount=0), constraint CHECK_Sell_money check(Sell_money=0.00)7.数据库备份7.1 完整数据库备份use Attraction_Managebackup database Attraction_Manage
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1