酒店管理系统介绍.doc

上传人:scccc 文档编号:12281977 上传时间:2021-12-03 格式:DOC 页数:12 大小:288.50KB
返回 下载 相关 举报
酒店管理系统介绍.doc_第1页
第1页 / 共12页
酒店管理系统介绍.doc_第2页
第2页 / 共12页
酒店管理系统介绍.doc_第3页
第3页 / 共12页
酒店管理系统介绍.doc_第4页
第4页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《酒店管理系统介绍.doc》由会员分享,可在线阅读,更多相关《酒店管理系统介绍.doc(12页珍藏版)》请在三一文库上搜索。

1、酒店客房餐饮管理系统实现酒店客房餐饮管理系统功能完善,能管理普通酒店的客房住宿和餐饮等服务。本系统采用 DELPHI 和 SQL SERVER 工具开发,分为前台和后台管理。前台与后台管理程序相对独立,均共用一个数据库。下面对该系统的部份功能和模块以及代码进行分析。一前台管理1 数据模块该模块是整个程序数据的提供者,以及包括大部分的处理函数和实现功能。单元文件名: u_data.pas,数据模块名: DM_main 。部分代码分析:返回指表中某字段的最大值,返回值为整型。因此该函数只能应用字段为整型的表。function TDM_main.GetMaxId(aTable,aField:stri

2、ng):integer;varsSql:string;beginResult:=0;sSql:='select max(%s) from %s'with Q_getmax dobeginSQL.Text:=Format(sSql,aField,aTable);Open;if not IsEmpty thenResult:=Fields0.AsInteger+1;Close;end;end;接下来这个函数也是返回最大值,但是其为一个订单的最大编号为字符型。function TDM_main.GetMaxOrderId:string;varid:String;count:Integ

3、er;beginwith Q_count_order dobeginOpen;count:=Fields0.Value;Close;end;id:='000'+IntToStr(count);id:=Copy(id, length(id)-3, 4);id:='F'+FormatDateTime('yymmdd',now)+id;Result:=id;end;系统登陆函数:在进行系统的操作处理时,必须登陆。该函数对用户输入的用户名和密码数据库验证。其密码是进行加密的(加密模块稍后分析)function TDM_main.Login(user, p

4、asswd:String):String;varFlag:Boolean;beginif Database.Connected=false thenDatabase.Connected:=True;passwd:=Copy(passwd+passwd, 1, 10);/加密处理passwd:=Encrypt(passwd, 111);with Q_login dobeginClose;Params.ParamValues'ID':=user;Params.ParamValues'PASSWD':=passwd;Open;/在用户请中查询该用户和密码是否存在Fla

5、g:=( not IsEmpty);if Flag thenbeginLogin:=FieldValues'NAME'IsPass:=Flag;endelsebeginLogin:=''Application.MessageBox(' 请重新输入!', '登录失败 ', MB_OK);end;Close;end;end;系统登出:procedure TDM_main.Logout;beginDatabase.Connected:=False;/断开数据库的连接end;2 加密模块:单元文件名: crypt.pas。简单的加密算法。

6、constC1 = 52845;C2 = 22719;function Encrypt( S: String; Key: Word): String;/S:加密的字符串;Key :密钥varI: Integer; j: Integer;beginResult := S;for I := 1 to Length(S) dobeginResultI := char(byte(SI) xor (Key shr 8);Key := (byte(ResultI) + Key) * C1 + C2;end;s:=Result;Result:=''for i:=1 to length(s)

7、dobeginj:=Integer(si);Result:=Result + Char(65+(j div 26)+Char(65+(j mod 26);end;end;3 主模块系统的主界面,包括系统登陆。在没有进行登陆之前4 个功能按钮为灰色。第一个按钮为客房管理,其次是餐饮管理,再次是客户查询,最后是收费管理。4 客房管理模块客房管理包括客房预定,入住,调整。其界面如下:操作介绍:预定:首先在证件编号文体框中输入相关的证件编号,按回车键,显示如下窗口:输入完整后单击添加则返回上一个界面, 相关的数据将自动填写。 然后在右边选择相应的客房等级。在网格中将显示该等级的所有空闲房号。选择一个房

8、间,再点击“新建”按钮,然后点击“添加” 。客房预定完毕。入住:在证件编号文体框中输入相关的证件编号, 按回车键。 如果该客户已经预定则自动显示信息,否则将弹出上面的窗口要求输入信息。5 餐饮管理包括选菜、点菜、打单:下面是其相代码说明:procedure TF_foodorder.btnOkClick(Sender: TObject);varid:integer;total:single;beginif sid='' thenbeginB_neworderClick(nil);end;/ 订单明细id:=DM_main.GetMaxId('order_detail&#

9、39;,'id');with Q_foodetail dobeginAppend;Fields0.AsInteger:=id;Fields1.AsString:=sid;Fields2.AsString:=dbtext1.Caption;Fields3.AsString:=edtNum.Text;Fields4.AsString:=dbtext4.Caption;Post;DisableControls;Close;Open;EnableControls;end;/ 更新总订单的总金额with DM_main.T_foodorder dobeginEdit;total:=DM_

10、main.GetSumPrice(sid);Fields3.AsFloat:=total;Post;end;end;/撤销选择的一项菜目procedure TF_foodorder.btnCancelClick(Sender: TObject);vartotal:Single;beginwith Q_foodetail dobeginif IsEmpty thenExit;if not Active thenbeginParamByName('sid').Value:=sid;Open;end;Delete;end;total:=DM_main.GetSumPrice(sid)

11、;with DM_main.T_foodorder dobeginif not Active then Open;Locate('id',sid,);Edit;Fields3.AsFloat:=total;Post;end;end;procedure TF_foodorder.B_neworderClick(Sender: TObject);begin/ 新建总订单sid:=DM_main.GetMaxOrderId;with DM_main.T_foodorder dobeginOpen;Append;Fields0.AsString:=sid;Fields1.AsStrin

12、g:=DateTimeToStr(Now);Fields2.AsString:=Trim(edtName.Text);Post;end;with Q_foodetail dobeginClose;ParamByName('sid').Value:=sid;Prepare;Open;end;end;打单:票据示例如下。二后台管理1 数据模块该模块是整个程序数据的提供者,以及包括大部分的处理函数和实现功能。单元文件名: u_data.pas,数据模块名: DM_main 。部分代码分析:设置前台操作员的密码:procedure TDM_main.SetOperatorPasswor

13、d(password:String); beginpassword:=Copy(password+password, 1, 10);password:=Encrypt(password, 111);/加密单元with T_operator dobeginEdit;FieldValues'PASSWD':=password;end;end;根据客房ID筛选客房:procedure TDM_main.SetModifyFilter(RoomID:String);beginwith T_room_modify dobeginClose;if length(RoomID)>0 t

14、henbeginFilter:='ID='''+RoomID+''''Filtered:=True;endelseFiltered:=False;Open;end;end;获得客房级别:procedure TDM_main.GetRoomLevel(RoomLevel:TStrings);beginRoomLevel.Clear;RoomLevel.Add(' 全部级别 ');with Q_room_level dobeginOpen;First;while not Eof dobeginRoomLevel.Add

15、(FieldValues'DESCRIPT');Next;end;Close;end;end;客房统计图实现函数:/StarDate:开始日期;EndDate:结束日期;procedure TDM_main.GetRoomStat(StartDate,EndDate:TDate; TimeStep, StatType:Boolean;RoomLevel:Integer; BarSeries:TBarSeries);varStatResult:integer;MidDate:TDate;StatLabel:String;beginBarSeries.Clear;while Sta

16、rtDate<EndDate dobeginMidDate:=GetNextDate(StartDate, TimeStep);if StatType thenStatResult:=SumTurnover(StartDate, MidDate)elseStatResult:=SumUsedRoom(StartDate, MidDate, RoomLevel); if TimeStep thenStatLabel:=FormatDateTime('dd', StartDate)+' 日 'elseStatLabel:=FormatDateTime('

17、;mm', StartDate)+' 月'BarSeries.AddY(StatResult,StatLabel);StartDate:=MidDate;end;end;换算下个月(日)日期:function TDM_main.GetNextDate(StartDate:TDate;TimeStep:Boolean):TDate; varTimeYear,TimeMonth:String;beginif TimeStep thenResult:=StartDate+1elsebeginTimeYear:=FormatDateTime('yyyy', St

18、artDate);TimeMonth:=FormatDateTime('mm', StartDate);if TimeMonth='12' thenbeginTimeYear:=IntToStr(StrToInt(TimeYear)+1);TimeMonth:='01'endelseTimeMonth:=IntToStr(StrToInt(TimeMonth)+1);Result:=StrToDate(TimeYear+'-'+TimeMonth+'-01');end;end;2 系统登陆模块该系统登陆将连接数据库

19、的管理员用户表进行验证:procedure TF_login.b_loginClick(Sender: TObject);varsSql:string;beginif (Trim(i_admin.Text)='')or(i_passwd.Text='') thenbeginMessageDlg(' 请输入管理员帐号和密码!', mtWarning, mbOK, mbHelp, 6);i_admin.SetFocus;Exit;end;sSql:='select * from admin_user where name=''

20、%s'' and passwd=''%s''' with DM_main.Q_admin dobeginSQL.Text:=Format(sSql,Trim(i_admin.Text),i_passwd.Text);Open;if IsEmpty thenbeginMessageDlg('连接错误! 请确认管理员帐号和密码!', mtWarning, mbOK, mbHelp, 6);i_admin.SetFocus;Exit;endelsebeginClose;self.Close;end;end;end;登陆界面:3

21、主控程序后台管理主窗口如下:后台管理程序采用MDI 风格窗体。并采用事件管理机制ActionList 管理所有功能模块的点击事件:procedure TF_main.RoomAddExecute(Sender: TObject);beginApplication.CreateForm(TF_add, F_add);RoomAdd.Enabled:=False;end;procedure TF_main.RoomModifyExecute(Sender: TObject);beginApplication.CreateForm(TF_modify, F_modify);RoomModify.En

22、abled:=False;end;procedure TF_main.HelpAboutExecute(Sender: TObject);beginF_about.ShowModal;end;procedure TF_main.SystemExitExecute(Sender: TObject);beginClose;end;procedure TF_main.OtherOperatorExecute(Sender: TObject); beginApplication.CreateForm(TF_operator, F_operator);OtherOperator.Enabled:=Fal

23、se;end;procedure TF_main.OtherCodeExecute(Sender: TObject);beginApplication.CreateForm(TF_code, F_code);OtherCode.Enabled:=False;end;procedure TF_main.RoomStatExecute(Sender: TObject);beginApplication.CreateForm(TF_stat, F_stat);RoomStat.Enabled:=False;end;后台数据管理包括:客房管理、餐饮管理、操作员管理,基础数据维护等。4 客房统计表该统计表能统计某个时间段的所有客房的营业额和使用频率, 通过生成统计表以支持上层决策。如下图:(其实现代码以上有介绍)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1