酒店客房餐飲管理系統(tǒng)實現(xiàn)[001].doc_第1頁
酒店客房餐飲管理系統(tǒng)實現(xiàn)[001].doc_第2頁
酒店客房餐飲管理系統(tǒng)實現(xiàn)[001].doc_第3頁
酒店客房餐飲管理系統(tǒng)實現(xiàn)[001].doc_第4頁
酒店客房餐飲管理系統(tǒng)實現(xiàn)[001].doc_第5頁
已閱讀5頁,還剩9頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

酒店客房餐飲管理系統(tǒng)實現(xiàn)酒店客房餐飲管理系統(tǒng)功能完善,能管理普通酒店的客房住宿和餐飲等服務(wù)。本系統(tǒng)采用DELPHI和SQL SERVER工具開發(fā),分為前臺和后臺管理。前臺與后臺管理程序相對獨立,均共用一個數(shù)據(jù)庫。下面對該系統(tǒng)的部份功能和模塊以及代碼進行分析。一前臺管理1 數(shù)據(jù)模塊該模塊是整個程序數(shù)據(jù)的提供者,以及包括大部分的處理函數(shù)和實現(xiàn)功能。單元文件名:u_data.pas,數(shù)據(jù)模塊名:DM_main。部分代碼分析:返回指表中某字段的最大值,返回值為整型。因此該函數(shù)只能應(yīng)用字段為整型的表。function TDM_main.GetMaxId(aTable,aField:string):integer;var sSql:string;begin Result:=0; sSql:=select max(%s) from %s; with Q_getmax do begin SQL.Text:=Format(sSql,aField,aTable); Open; if not IsEmpty then Result:=Fields0.AsInteger+1; Close; end;end;接下來這個函數(shù)也是返回最大值,但是其為一個訂單的最大編號為字符型。function TDM_main.GetMaxOrderId:string;var id:String; count:Integer;begin with Q_count_order do begin Open; 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;系統(tǒng)登陸函數(shù):在進行系統(tǒng)的操作處理時,必須登陸。該函數(shù)對用戶輸入的用戶名和密碼數(shù)據(jù)庫驗證。其密碼是進行加密的(加密模塊稍后分析)function TDM_main.Login(user, passwd:String):String;var Flag:Boolean;begin if Database.Connected=false then Database.Connected:=True; passwd:=Copy(passwd+passwd, 1, 10);/加密處理 passwd:=Encrypt(passwd, 111); with Q_login do begin Close; Params.ParamValuesID:=user; Params.ParamValuesPASSWD:=passwd; Open;/在用戶請中查詢該用戶和密碼是否存在 Flag:=( not IsEmpty); if Flag then begin Login:=FieldValuesNAME; IsPass:=Flag; end else begin Login:=; Application.MessageBox(請重新輸入!, 登錄失敗, MB_OK); end; Close; end;end;系統(tǒng)登出:procedure TDM_main.Logout;begin Database.Connected:=False;/斷開數(shù)據(jù)庫的連接end;2 加密模塊:單元文件名:crypt.pas。簡單的加密算法。const C1 = 52845; C2 = 22719;function Encrypt( S: String; Key: Word): String;/S:加密的字符串;Key:密鑰var I: Integer; j: Integer;begin Result := S; for I := 1 to Length(S) do begin ResultI := char(byte(SI) xor (Key shr 8); Key := (byte(ResultI) + Key) * C1 + C2; end; s:=Result; Result:=; for i:=1 to length(s) do begin j:=Integer(si); Result:=Result + Char(65+(j div 26)+Char(65+(j mod 26); end;end;3 主模塊系統(tǒng)的主界面,包括系統(tǒng)登陸。在沒有進行登陸之前4個功能按鈕為灰色。第一個按鈕為客房管理,其次是餐飲管理,再次是客戶查詢,最后是收費管理。4 客房管理模塊客房管理包括客房預(yù)定,入住,調(diào)整。其界面如下:操作介紹:預(yù)定:首先在證件編號文體框中輸入相關(guān)的證件編號,按回車鍵,顯示如下窗口:輸入完整后單擊添加則返回上一個界面,相關(guān)的數(shù)據(jù)將自動填寫。然后在右邊選擇相應(yīng)的客房等級。在網(wǎng)格中將顯示該等級的所有空閑房號。選擇一個房間,再點擊“新建”按鈕,然后點擊“添加”??头款A(yù)定完畢。入?。涸谧C件編號文體框中輸入相關(guān)的證件編號,按回車鍵。如果該客戶已經(jīng)預(yù)定則自動顯示信息,否則將彈出上面的窗口要求輸入信息。5 餐飲管理包括選菜、點菜、打單:下面是其相代碼說明:procedure TF_foodorder.btnOkClick(Sender: TObject);var id:integer; total:single;begin if sid= then begin B_neworderClick(nil); end; /訂單明細 id:=DM_main.GetMaxId(order_detail,id); with Q_foodetail do begin Append; 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 do begin Edit; total:=DM_main.GetSumPrice(sid); Fields3.AsFloat:=total; Post; end;end;/撤銷選擇的一項菜目procedure TF_foodorder.btnCancelClick(Sender: TObject);var total:Single;begin with Q_foodetail do begin if IsEmpty then Exit; if not Active then begin ParamByName(sid).Value:=sid; Open; end; Delete; end; total:=DM_main.GetSumPrice(sid); with DM_main.T_foodorder do begin if 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 do begin Open; Append; Fields0.AsString:=sid; Fields1.AsString:=DateTimeToStr(Now); Fields2.AsString:=Trim(edtName.Text); Post; end; with Q_foodetail do begin Close; ParamByName(sid).Value:=sid; Prepare; Open; end;end;打單:票據(jù)示例如下。二后臺管理1 數(shù)據(jù)模塊該模塊是整個程序數(shù)據(jù)的提供者,以及包括大部分的處理函數(shù)和實現(xiàn)功能。單元文件名:u_data.pas,數(shù)據(jù)模塊名:DM_main。部分代碼分析:設(shè)置前臺操作員的密碼:procedure TDM_main.SetOperatorPassword(password:String);begin password:=Copy(password+password, 1, 10); password:=Encrypt(password, 111);/加密單元 with T_operator do begin Edit; FieldValuesPASSWD:=password; end;end;根據(jù)客房ID篩選客房:procedure TDM_main.SetModifyFilter(RoomID:String);begin with T_room_modify do begin Close; if length(RoomID)0 then begin Filter:=ID=+RoomID+; Filtered:=True; end else Filtered:=False; Open; end;end;獲得客房級別:procedure TDM_main.GetRoomLevel(RoomLevel:TStrings);begin RoomLevel.Clear; RoomLevel.Add(全部級別); with Q_room_level do begin Open; First; while not Eof do begin RoomLevel.Add(FieldValuesDESCRIPT); Next; end; Close; end;end;客房統(tǒng)計圖實現(xiàn)函數(shù):/StarDate:開始日期;EndDate:結(jié)束日期;procedure TDM_main.GetRoomStat(StartDate,EndDate:TDate; TimeStep, StatType:Boolean;RoomLevel:Integer; BarSeries:TBarSeries);var StatResult:integer; MidDate:TDate; StatLabel:String;begin BarSeries.Clear; while StartDateEndDate do begin MidDate:=GetNextDate(StartDate, TimeStep); if StatType then StatResult:=SumTurnover(StartDate, MidDate) else StatResult:=SumUsedRoom(StartDate, MidDate, RoomLevel); if TimeStep then StatLabel:=FormatDateTime(dd, StartDate)+日 else StatLabel:=FormatDateTime(mm, StartDate)+月; BarSeries.AddY(StatResult,StatLabel); StartDate:=MidDate; end;end;換算下個月(日)日期:function TDM_main.GetNextDate(StartDate:TDate;TimeStep:Boolean):TDate;var TimeYear,TimeMonth:String;begin if TimeStep then Result:=StartDate+1 else begin TimeYear:=FormatDateTime(yyyy, StartDate); TimeMonth:=FormatDateTime(mm, StartDate); if TimeMonth=12 then begin TimeYear:=IntToStr(StrToInt(TimeYear)+1); TimeMonth:=01; end else TimeMonth:=IntToStr(StrToInt(TimeMonth)+1); Result:=StrToDate(TimeYear+-+TimeMonth+-01); end;end;2 系統(tǒng)登陸模塊該系統(tǒng)登陸將連接數(shù)據(jù)庫的管理員用戶表進行驗證:procedure TF_login.b_loginClick(Sender: TObject);var sSql:string;begin if (Trim(i_admin.Text)=)or(i_passwd.Text=) then begin MessageDlg(請輸入管理員帳號和密碼!, mtWarning, mbOK, mbHelp, 6); i_admin.SetFocus; Exit; end; sSql:=select * from admin_user where name=%s and passwd=%s; with DM_main.Q_admin do begin SQL.Text:=Format(sSql,Trim(i_admin.Text),i_passwd.Text); Open; if IsEmpty then begin MessageDlg(連接錯誤!請確認管理員帳號和密碼!, mtWarning, mbOK, mbHelp, 6); i_admin.SetFocus; Exit; end else begin Close; self.Close; end; end;end;登陸界面:3 主控程序后臺管理主窗口如下:后臺管理程序采用MDI風(fēng)格窗體。并采用事件管理機制ActionList管理所有功能模塊的點擊事件:procedure TF_main.RoomAddExecute(Sender: TObject);begin Application.CreateForm(TF_add, F_add); RoomAdd.Enabled:=False;end;procedure TF_main.RoomModifyExecute(Sender: TObject);begin Application.CreateForm(TF_modify, F_modify); RoomModif

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論