客房管理系統(tǒng)VBSQL樣本_第1頁
客房管理系統(tǒng)VBSQL樣本_第2頁
客房管理系統(tǒng)VBSQL樣本_第3頁
客房管理系統(tǒng)VBSQL樣本_第4頁
客房管理系統(tǒng)VBSQL樣本_第5頁
已閱讀5頁,還剩46頁未讀 繼續(xù)免費閱讀

付費下載

下載本文檔

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

文檔簡介

數(shù)據(jù)庫課程設(shè)計報告題目:客房管理系統(tǒng)時間:-6-27客房管理系統(tǒng)課程設(shè)計目和意義在當(dāng)今經(jīng)濟和商務(wù)交往日益頻繁狀況下,賓館服務(wù)行業(yè)正面臨客流量驟增壓力。越來越多賓館飯店都結(jié)識到老式管理辦法已經(jīng)不能適合當(dāng)今社會需要,必要借助先進計算機信息技術(shù)對賓館服務(wù)進行管理?!翱头抗芾硐到y(tǒng)”可以說是整個賓館計算機信息系統(tǒng)中心子系統(tǒng),由于賓館最重要功能就是為旅客提供客房。設(shè)計客房管理這樣一種系統(tǒng),可以涉及到大多數(shù)SQLServer數(shù)據(jù)庫重要數(shù)據(jù)庫對象、重要功能和特性,例如:視圖、觸發(fā)器和存儲過程等。由此,通過這個課程設(shè)計可以加深對這些SQLServer數(shù)據(jù)庫知識學(xué)習(xí)、理解,積累在實際工程應(yīng)用中運用各種數(shù)據(jù)庫對象經(jīng)驗,使學(xué)生掌握使用應(yīng)用軟件開發(fā)工具開發(fā)數(shù)據(jù)庫管理系統(tǒng)基本辦法。在實用性方面,客房管理系統(tǒng)是很普遍一種應(yīng)用,選取該系統(tǒng)作為課程設(shè)計也可覺得學(xué)生后來也許遇到實際開發(fā)提供借鑒。

本課程設(shè)計重要目是學(xué)習(xí)和練習(xí)SQLServer數(shù)據(jù)庫實際應(yīng)用,因此選取SQLServer作為數(shù)據(jù)庫服務(wù)器。需求分析系統(tǒng)重要實現(xiàn)對客房管理功能。重要有管理員登陸、客戶登記、房間管理、客戶查詢、房間查詢、收入記錄、管理員信息管理。系統(tǒng)總體設(shè)計圖如下:概念構(gòu)造設(shè)計(E-R圖)邏輯構(gòu)造設(shè)計將E-R圖轉(zhuǎn)換成關(guān)系模式:管理員(編號,賬號,密碼,權(quán)限)房間(編號,類型,價格,狀態(tài),入住客戶編號)客戶(編號,姓名,性別,年齡,身份證號,住址,入住時間,預(yù)測天數(shù),房間編號,退房時間,押金,住宿費,登記人)關(guān)系規(guī)范化:均已達到第三范式數(shù)據(jù)實行與維護建立數(shù)據(jù)庫打開SQLServer公司管理器,建立數(shù)據(jù)庫HotelRoom。添加數(shù)據(jù)表在HotelRoom數(shù)據(jù)庫中,添加表管理員信息表AdminInfo、房間信息表RoomInfo、客戶信息表GuestInfo。建立關(guān)系圖創(chuàng)立視圖CREATEVIEWdbo.ViewAdminInfoASSELECTAid,Aname,AlimitFROMdbo.AdminInfo管理員信息視圖CREATEVIEWdbo.ViewAllCostASSELECTSUM(Ccost)ASAllCostFROMdbo.GuestInfo總收入視圖CREATEVIEWdbo.ViewBiaozhunCostASSELECTSUM(a.Ccost)ASBiaozhunCostFROMdbo.GuestInfoaINNERJOINdbo.RoomInfobONa.Rnum=b.RnumWHERE(b.Rtype='原則')原則房收入視圖CREATEVIEWdbo.ViewCostASSELECTdbo.ViewAllCost.AllCost,dbo.ViewPutongCost.putongCost,dbo.ViewBiaozhunCost.BiaozhunCost,dbo.ViewHaohuaCost.HaohuaCostFROMdbo.ViewAllCostCROSSJOINdbo.ViewPutongCostCROSSJOINdbo.ViewBiaozhunCostCROSSJOINdbo.ViewHaohuaCost收入視圖CREATEVIEWdbo.ViewEmptyRoomInfoASSELECTRnum,Rtype,Rprice,RstatesFROMdbo.RoomInfoWHERE(Rstates='空')空房信息視圖CREATEVIEWdbo.ViewFullRoomInfoASSELECTdbo.RoomInfo.*FROMdbo.RoomInfoWHERE(Rstates='滿')滿房信息視圖CREATEVIEWdbo.ViewGuestInfoASSELECTdbo.GuestInfo.*FROMdbo.GuestInfo客戶信息視圖CREATEVIEWdbo.ViewHaohuaCostASSELECTSUM(a.Ccost)ASHaohuaCostFROMdbo.GuestInfoaINNERJOINdbo.RoomInfobONa.Rnum=b.RnumWHERE(b.Rtype='豪華')豪華房收入視圖CREATEVIEWdbo.ViewPutongCostASSELECTSUM(a.Ccost)ASPutongCostFROMdbo.GuestInfoaINNERJOINdbo.RoomInfobONa.Rnum=b.RnumWHERE(b.Rtype='普通')普通房收入視圖CREATEVIEWdbo.ViewRoomInfoASSELECTdbo.RoomInfo.*FROMdbo.RoomInfo房間信息視圖創(chuàng)立觸發(fā)器在表GuestInfo中,創(chuàng)立一種觸發(fā)器:CREATETRIGGERinsert_triONdbo.GuestInfoFORINSERTASupdateRoomInfosetRstates='滿',Cid=(selectCidfrominserted)whereRnum=(selectRnumfrominserted)功能:當(dāng)向表GuestInfo中插入一種客戶信息時,觸刊登RoomInfo某房間狀態(tài)變?yōu)椤皾M”備份數(shù)據(jù)庫給所建立數(shù)據(jù)庫進行備份界面設(shè)計與代碼(用VB作為界面設(shè)計語言)登陸界面PublicSubCommand1_Click()‘?dāng)M定IfTrim(DataCombo1.Text)<>""AndTrim(Text1.Text)<>""ThenAdodc1.RecordSource="select*fromAdminInfowhereAname='"+Trim(DataCombo1.Text)+"'andAmima='"+Trim(Text1.Text)+"'"Adodc1.RefreshIfAdodc1.Recordset.RecordCount=1ThenAdodc1.Recordset.ClosefrmMain.ShowMe.HideElseMsgBox"錯誤賬號或密碼!",vbInformation+vbOKOnly,"錯誤信息"Text1.Text=""DataCombo1.SetFocusEndIfElseIfDataCombo1.Text=""ThenMsgBox"賬號不能為空!",vbInformation+vbOKOnly,"錯誤信息"DataCombo1.SetFocusElseMsgBox"密碼不能為空!",vbInformation+vbOKOnly,"錯誤信息"Text1.SetFocusEndIfEndSubPrivateSubCommand2_Click()‘取消EndEndSubPrivateSubText1_KeyPress(KeyAsciiAsInteger)‘在文本框按下輸入事件IfKeyAscii=13ThenCommand1_ClickEndIfEndSubPrivateSubdataCombo1_KeyPress(KeyAsciiAsInteger)‘在文本框按下輸入事件IfKeyAscii=13ThenCommand1_ClickEndIfEndSub客戶登記界面PrivateSubCommand3_Click()‘客戶登記PrivateSubCommand4_Click()‘退房結(jié)算frmGuestAdd.ShowfrmCheckOut.ShowEndSubEndSubPrivateSubCommand1_Click()‘當(dāng)前時間txt6.Text=Trim(Now())EndSubPrivateSubCommand2_Click()‘?dāng)M定Iftxt1.Text=""Ortxt2.Text=""Ortxt3.Text=""Ortxt4.Text=""Ortxt6.Text=""Ortxt8.Text=""OrDataCombo1.Text=""ThenMsgBox"請將藍色某些填寫完整!",vbInformation+vbOKOnly,"提示信息"Iftxt1.Text=""Thentxt1.SetFocusElseIftxt2.Text=""Thentxt2.SetFocusElseIftxt3.Text=""Thentxt3.SetFocusElseIftxt4.Text=""Thentxt4.SetFocusElseIftxt6.Text=""Thentxt6.SetFocusElseIftxt8.Text=""Thentxt8.SetFocusElseIfDataCombo1.Text=""ThenDataCombo1.SetFocusEndIfElseAdodc3.RecordSource="selectAidfromViewAdminInfowhereAname='"&frmLogin.DataCombo1.Text&"'"Adodc3.RefreshDimaidAsIntegeraid=Adodc3.Recordset.Fields(0)Adodc4.RecordSource="select*fromGuestInfo"Adodc4.RefreshAdodc4.Recordset.AddNewAdodc4.Recordset.Fields("Cname")=txt1.TextAdodc4.Recordset.Fields("Csex")=txt2.TextAdodc4.Recordset.Fields("Cage")=txt3.TextAdodc4.Recordset.Fields("Cpnum")=txt4.TextIftxt6.Text<>""ThenAdodc4.Recordset.Fields("Cadd")=txt5.TextEndIfAdodc4.Recordset.Fields("Cintime")=txt6.TextIftxt7.Text<>""ThenAdodc4.Recordset.Fields("Cday")=txt7.TextEndIfAdodc4.Recordset.Fields("Cdeposit")=txt8.TextAdodc4.Recordset.Fields("Rnum")=DataCombo1.TextAdodc4.Recordset.Fields("Aid")=aidAdodc4.Recordset.UpdatefrmMain.Adodc1.RefreshfrmMain.DataGrid1.RefreshMsgBox"登記成功!",vbOKOnly+vbInformation,"提示信息"UnloadMeEndIfEndSubPrivateSubCommand3_Click()‘取消UnloadMeEndSubPrivateSubDataCombo1_Change()‘選取房間Adodc2.RecordSource="select*fromViewEmptyRoomInfowhereRnum='"+Trim(DataCombo1.Text)+"'"Adodc2.RefreshSetDataGrid1.DataSource=Adodc2DataGrid1.RefreshEndSubPrivateSubCommand1_Click()‘查看信息IfDataCombo1.Text<>""ThenIfCommand1.Caption="查看信息"ThenAdodc1.RecordSource="select*fromViewGuestInfowhereRnum='"&DataCombo1.Text&"'andCouttimeisnull"Adodc1.RefreshRichTextBox1.Text=vbCrLf+""+"編號:"+Trim(Adodc1.Recordset.Fields(0).Value)+""+"姓名:"+Trim(Adodc1.Recordset.Fields(1).Value)+""+"性別:"+Trim(Adodc1.Recordset.Fields(2).Value)+""+"年齡:"+Trim(Adodc1.Recordset.Fields(3).Value)+vbCrLf+vbCrLf+""+"身份證號:"+Trim(Adodc1.Recordset.Fields(4).Value)+vbCrLf+vbCrLf+""+"入住時間:"+Trim(Adodc1.Recordset.Fields(6).Value)+vbCrLf+vbCrLf+""+"押金:"+Trim(Adodc1.Recordset.Fields(10).Value)+"元"frame1.Caption="顯示信息-"+DataCombo1.TextDataCombo1.Enabled=FalseCommand1.Caption="取消"Command2.Enabled=TrueElseIfCommand1.Caption="取消"Thenframe1.Caption="顯示信息"RichTextBox1.Text=""DataCombo1.Enabled=TrueDataCombo1.Text=""Command1.Caption="查看信息"Command2.Enabled=FalseEndIfElseMsgBox"房間編號不能為空!",vbOKOnly+vbInformation,"錯誤信息"DataCombo1.SetFocusEndIfEndSubPrivateSubCommand2_Click()‘費用結(jié)算Me.HidefrmPrice.ShowEndSubPrivateSubCommand3_Click()‘退出UnloadMeEndSubDimtimeAsDateDimeAsIntegerPrivateSubCommand1_Click()‘退房IfMsgBox("擬定退房結(jié)帳嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc3.RecordSource="selectCouttime,Ccost,RnumfromGuestInfowhereRnum='"&frmCheckOut.DataCombo1.Text&"'andCouttimeisnull"'"updataGuestInfosetCouttime="&time&",Ccost="&e&""Adodc3.RefreshDimrnumAsStringrnum=Adodc3.Recordset.Fields(2)Adodc3.Recordset.Fields(0)=timeAdodc3.Recordset.Fields(1)=eAdodc3.Recordset.UpdateAdodc4.RecordSource="select*fromRoomInfowhereRnum='"&rnum&"'"Adodc4.RefreshAdodc4.Recordset.Fields(3)="空"Adodc4.Recordset.Fields(4)=NullAdodc4.Recordset.UpdatefrmMain.Adodc1.RefreshfrmMain.Adodc6.RefreshfrmMain.DataGrid1.RefreshMsgBox"退房成功!",vbOKOnly+vbInformation,"提示信息"UnloadfrmCheckOutUnloadMeElseUnloadfrmCheckOutUnloadMeEndIfEndSubPrivateSubCommand2_Click()UnloadfrmCheckOutUnloadMeEndSubPrivateSubForm_Load()‘費用結(jié)算窗體加載事件Adodc2.RecordSource="selectRpricefromViewRoomInfowhereRnum="&frmCheckOut.DataCombo1.Text&""'查詢房間價格Adodc2.RefreshDimpriceAsInteger'房間價格price=CInt(Adodc2.Recordset.Fields(0))'獲取房間價格Label2.Caption="房間:"+frmCheckOut.DataCombo1.Text+""+"單價:"+CStr(price)+"元/天"Adodc1.RecordSource="select*fromViewGuestInfowhereRnum='"&frmCheckOut.DataCombo1.Text&"'andCouttimeisnull"'查詢客戶信息Adodc1.Refreshframe1.Caption="編號:"+Trim(Adodc1.Recordset.Fields(0).Value)+"姓名:"+Trim(Adodc1.Recordset.Fields(1).Value)+"性別:"+Trim(Adodc1.Recordset.Fields(2).Value)+"年齡:"+Trim(Adodc1.Recordset.Fields(3).Value)DimaAsDoubleDimbAsIntegerDimcAsDoubleDimdAsIntegertime=Now()a=CDbl(time-Adodc1.Recordset.Fields(6))'精準(zhǔn)時間b=CInt(time-Adodc1.Recordset.Fields(6))'對時間取整c=a-b'計算出不大于一天時間Ifc>0Thend=b+1'局限性一天算一天Elsed=bEndIfe=d*price'計算住宿費RichTextBox1.Text=vbCrLf+""+"入住時間:"+Trim(Adodc1.Recordset.Fields(6).Value)+vbCrLf+vbCrLf+""+"當(dāng)前時間:"+Trim(time)+vbCrLf+vbCrLf+""+"共住"+CStr(a)+"天"+""+"計"+CStr(d)+"天"+vbCrLf+vbCrLf+""+"住宿費:"+CStr(e)+"元"+"押金:"+Trim(Adodc1.Recordset.Fields(10).Value)+"元"+"應(yīng)收:"+Trim(e-CInt(Adodc1.Recordset.Fields(10)))+"元"EndSub房間管理界面PrivateSubCommand7_Click()‘增長房間Command7.Enabled=FalseCommand8.Enabled=FalseCommand9.Enabled=FalseCommand10.Enabled=TrueCommand11.Enabled=Trueframe1.Enabled=Trueframe1.Caption="增長房間"Text1.BackColor=&H80000005Text2.BackColor=&H80000005Text3.BackColor=&H80000005Text4.BackColor=&H80000005Text2.Visible=FalseCombo3.Visible=TrueText4.Enabled=FalseText4.Text="空"Text1.Enabled=TrueText2.Enabled=TrueText3.Enabled=TrueText1.SetFocusEndSubPrivateSubCommand8_Click()‘修改房間Command7.Enabled=FalseCommand8.Enabled=FalseCommand9.Enabled=FalseCommand10.Enabled=TrueCommand11.Enabled=Trueframe1.Enabled=Trueframe1.Caption="修改房間"Text1.Visible=FalseDataCombo2.Visible=TrueText2.BackColor=&H80000005Text3.BackColor=&H80000005Text4.BackColor=&H80000005Text4.Enabled=FalseText2.Enabled=FalseText3.Enabled=FalseDataCombo2.SetFocusEndSubPrivateSubCommand9_Click()‘刪除房間Command7.Enabled=FalseCommand8.Enabled=FalseCommand9.Enabled=FalseCommand10.Enabled=TrueCommand11.Enabled=Trueframe1.Enabled=Trueframe1.Caption="刪除房間"Text1.Visible=FalseDataCombo2.Visible=TrueText2.BackColor=&H80000005Text3.BackColor=&H80000005Text4.BackColor=&H80000005Text2.Enabled=FalseText3.Enabled=FalseText4.Enabled=FalseDataCombo2.SetFocusEndSubPrivateSubDataCombo2_Change()‘Adodc5.RecordSource="select*fromViewEmptyRoomInfowhereRnum='"+Trim(DataCombo2.Text)+"'"Adodc5.RefreshSetText2.DataSource=Adodc5SetText3.DataSource=Adodc5SetText4.DataSource=Adodc5Text2.RefreshText3.RefreshText4.RefreshIfframe1.Caption="修改房間"ThenSetCombo3.DataSource=Adodc5Combo3.RefreshCombo3.Enabled=TrueCombo3.Visible=TrueText2.Visible=FalseText3.Enabled=TrueEndIfEndSubPrivateSubCommand10_Click()‘?dāng)M定Ifframe1.Caption="增長房間"ThenIfText1.Text<>""AndCombo3.Text<>""AndText3.Text<>""ThenIfMsgBox("擬定增長房間“"&Text1.Text&"”嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc5.RecordSource="select*fromViewRoomInfowhereRnum='"&Text1.Text&"'"Adodc5.RefreshIfAdodc5.Recordset.RecordCount=1ThenMsgBox"你輸入房間編號“"&Text1.Text&"”重復(fù)!請重新輸入。",vbInformation+vbOKOnly,"提示信息"Text1.Text=""Text2.Text=""Text3.Text=""Text1.SetFocusElseAdodc5.CommandType=adCmdTextAdodc5.RecordSource="select*fromRoomInfo"Adodc5.Recordset.AddNewAdodc5.Recordset.Fields("Rnum")=Text1.TextAdodc5.Recordset.Fields("Rtype")=Combo3.TextAdodc5.Recordset.Fields("Rprice")=Text3.TextAdodc5.Recordset.Fields("Rstates")=Text4.TextAdodc5.Recordset.UpdateAdodc2.RefreshSetDataGrid2.DataSource=Adodc2DataCombo2.RefreshAdodc6.RefreshMsgBox"增長房間“"&Text1.Text&"”成功!",vbInformation+vbOKOnly,"提示信息"Command11_ClickEndIfElseCommand11_ClickEndIfElseMsgBox"房間信息填寫不完整,請繼續(xù)填寫!",vbOKOnly+vbInformation,"錯誤提示"EndIfElseIfframe1.Caption="修改房間"ThenIfDataCombo2.Text<>""ThenIfMsgBox("擬定要修改房間信息嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc5.CommandType=adCmdTextAdodc5.RecordSource="updataRoomInfosetRtype='"&Text2.Text&"',Rprice='"&Text3.Text&"'whereRnum='"&DataCombo2.Text&"'"Adodc5.Recordset.UpdateAdodc2.RefreshSetDataGrid2.DataSource=Adodc2DataCombo2.RefreshAdodc6.RefreshMsgBox"房間信息修改成功!",vbOKOnly+vbInformation,"提示信息"Command11_ClickElseCommand11_ClickEndIfElseMsgBox"請選取要修改房間!",vbInformation+vbOKOnly,"提示信息"DataCombo2.SetFocusEndIfElseIfframe1.Caption="刪除房間"ThenIfDataCombo2.Text<>""ThenIfMsgBox("擬定刪除房間“"&DataCombo2.Text&"”嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc5.CommandType=adCmdTextAdodc5.RecordSource="deletefromRoomInfowhereRnum='"&DataCombo2.Text&"'"Adodc5.Recordset.DeleteAdodc5.Recordset.UpdateAdodc2.RefreshSetDataGrid2.DataSource=Adodc2DataGrid2.RefreshAdodc6.RefreshMsgBox"刪除房間“"&DataCombo2.Text&"”成功!",vbInformation+vbOKOnly,"提示信息"Command11_ClickElseCommand11_ClickEndIfElseMsgBox"請選取要刪除房間!",vbOKOnly+vbInformation,"提示信息"DataCombo2.SetFocusEndIfEndIfEndSubPrivateSubCommand11_Click()‘取消Text1.Text=""Text2.Text=""Text3.Text=""Text4.Text=""Combo3.Text=""DataCombo2.Text=""frame1.Enabled=FalseCommand7.Enabled=TrueCommand8.Enabled=TrueCommand9.Enabled=TrueCommand10.Enabled=FalseCommand11.Enabled=Falseframe1.Caption=""DataCombo2.Visible=FalseText1.Visible=TrueCombo3.Visible=FalseText2.Visible=TrueText1.BackColor=&H8000000FText2.BackColor=&H8000000FText3.BackColor=&H8000000FText4.BackColor=&H8000000FText4.Enabled=TrueSetCombo3.DataSource=NothingSetText2.DataSource=NothingSetText3.DataSource=NothingSetText4.DataSource=NothingCombo3.RefreshText2.RefreshText3.RefreshText4.RefreshEndSub客戶查詢界面PrivateSubCommand12_Click()‘精準(zhǔn)查詢-擬定Iftxt1.Text=""Thenck1.Value=0EndIfIftxt2.Text=""Thenck2.Value=0EndIfIftxt3.Text=""Thenck3.Value=0EndIfIftxt4.Text=""Thenck4.Value=0EndIfIftxt5.Text=""Thenck5.Value=0EndIfIftxt6.Text=""Thenck6.Value=0EndIfIftxt1.Text=""Andtxt2.Text=""Andtxt3.Text=""Andtxt4.Text=""Andtxt5.Text=""Andtxt6.Text=""ThenMsgBox"查詢條件至少有一種不為空!",vbOKOnly+vbInformation,"錯誤信息"ElseDimsqlAsStringsql=EmptyIftxt1.Text<>EmptyThensql="(Cname='"&txt1.Text&"')"EndIfIftxt2.Text<>EmptyThenIfsql<>EmptyThensql=sql&"and(Csex='"&txt2.Text&"')"Elsesql="(Csex='"&txt2.Text&"')"EndIfEndIfIftxt3.Text<>EmptyThenIfsql<>EmptyThensql=sql&"and(Cage="&Trim(txt3.Text)&")"Elsesql="(Cage="&Trim(txt3.Text)&")"EndIfEndIfIftxt4.Text<>EmptyThenIfsql<>EmptyThensql=sql&"and(Cid="&Trim(txt4.Text)&")"Elsesql="(Cid="&Trim(txt4.Text)&")"EndIfEndIfIftxt5.Text<>EmptyThenIfsql<>EmptyThensql=sql&"and(Rnum="&Trim(txt5.Text)&")"Elsesql="(Rnum="&Trim(txt5.Text)&")"EndIfEndIfIftxt6.Text<>EmptyThenIfsql<>EmptyThensql=sql&"and(Cpnum='"&txt6.Text&"')"Elsesql="(Cpnum='"&txt6.Text&"')"EndIfEndIfIfsql<>EmptyThensql="select*fromViewGuestInfowhere"&sqlEndIfAdodc10.RecordSource=sqlAdodc10.RefreshSetDataGrid3.DataSource=Adodc10DataGrid3.RefreshFrame2.Caption="查詢成果-精準(zhǔn)查詢"EndIfEndSubPrivateSubCommand13_Click()‘清空ck1.Value=0ck2.Value=0ck3.Value=0ck4.Value=0ck5.Value=0ck6.Value=0txt1.Text=""txt2.Text=""txt3.Text=""txt4.Text=""txt5.Text=""txt6.Text=""EndSubPrivateSubCommand15_Click()‘概況查詢-擬定IfCombo1.Text=""ThenMsgBox"條件不能為空!請選取查詢條件。",vbOKOnly+vbInformation,"提示信息"Combo1.SetFocusElseSelectCaseCombo1.TextCase"已入住客戶"Adodc11.RecordSource="select*fromViewGuestInfowhereCouttimeisnull"Adodc11.RefreshSetDataGrid3.DataSource=Adodc11DataGrid3.RefreshCase"已退房客戶"Adodc11.RecordSource="select*fromViewGuestInfowhereCouttimeisnotnull"Adodc11.RefreshSetDataGrid3.DataSource=Adodc11DataGrid3.RefreshCase"普通房客戶"Adodc11.RecordSource="select*fromViewGuestInfoa,ViewRoomInfobwhereb.Rtype='普通'anda.Rnum=b.Rnumorderbyb.RnumASC"Adodc11.RefreshSetDataGrid3.DataSource=Adodc11DataGrid3.RefreshCase"原則房客戶"Adodc11.RecordSource="select*fromViewGuestInfoa,ViewRoomInfobwhereb.Rtype='原則'anda.Rnum=b.Rnumorderbyb.RnumASC"Adodc11.RefreshSetDataGrid3.DataSource=Adodc11DataGrid3.RefreshCase"豪華房客戶"Adodc11.RecordSource="select*fromViewGuestInfoa,ViewRoomInfobwhereb.Rtype='豪華'anda.Rnum=b.Rnumorderbyb.RnumASC"Adodc11.RefreshSetDataGrid3.DataSource=Adodc11DataGrid3.RefreshEndSelectFrame2.Caption="查詢成果-"+Combo1.TextEndIfEndSub房間查詢界面PrivateSubCommand22_Click()‘按房間編號查詢IfText9.Text=""ThenMsgBox"你沒有輸入房間編號",vbOKOnly+vbInformation,"錯誤信息"Text9.SetFocusElseFrame7.Caption="查詢成果顯示-按房間編號"Adodc4.RecordSource="select*fromViewRoomInfowhereRnum='"+Trim(Text9.Text)+"'"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand23_Click()‘按房間類型查詢IfCombo2.Text=""ThenMsgBox"你沒有輸入房間類型",vbOKOnly+vbInformation,"錯誤信息"Combo2.SetFocusElseFrame7.Caption="查詢成果顯示-按房間類型"Adodc4.RecordSource="select*fromViewRoomInfowhereRtype='"+Trim(Combo2.Text)+"'orderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand24_Click()‘按房間價格查詢IfText18.Text=""ThenMsgBox"你沒有輸入完整價格范疇",vbOKOnly+vbInformation,"錯誤信息"Text18.SetFocusElseIfText19.Text=""ThenMsgBox"你沒有輸入完整價格范疇",vbOKOnly+vbInformation,"錯誤信息"Text19.SetFocusElseDimaAsIntegerDimbAsIntegera=(Text18.Text)b=(Text19.Text)Frame7.Caption="查詢成果顯示-按房間價格"Adodc4.RecordSource="select*fromViewRoomInfowhereRprice>="&a&"andRprice<="&b&"orderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand20_Click()‘顯示空房Frame7.Caption="查詢成果顯示-顯示空房"Adodc4.RecordSource="select*fromViewEmptyRoomInfoorderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndSubPrivateSubCommand21_Click()‘顯示滿房Frame7.Caption="查詢成果顯示-顯示滿房"Adodc4.RecordSource="select*fromViewFullRoomInfoorderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndSub收入記錄界面PrivateSubCommand6_Click()Label22.Caption=""Label23.Caption=""Label24.Caption=""Label25.Caption=""Label26.Caption=""Label27.Caption=""Label28.Caption=""ProgressBar1.Value=0ProgressBar2.Value=0ProgressBar3.Value=0ProgressBar4.Value=0ProgressBar1.Max=100ProgressBar2.Max=100ProgressBar3.Max=100ProgressBar4.Max=100Adodc13.RecordSource="select*fromViewCost"Adodc13.RefreshDimaAsIntegerDimbAsIntegerDimcAsIntegerDimdAsIntegerIfIsNull(Adodc13.Recordset.Fields(0))Thena=0Elsea=Adodc13.Recordset.Fields(0)EndIfIfIsNull(Adodc13.Recordset.Fields(1))Thenb=0Elseb=Adodc13.Recordset.Fields(1)EndIfIfIsNull(Adodc13.Recordset.Fields(2))Thenc=0Elsec=Adodc13.Recordset.Fields(2)EndIfIfIsNull(Adodc13.Recordset.Fields(3))Thend=0Elsed=Adodc13.Recordset.Fields(3)EndIfProgressBar1.Max=aProgressBar2.Max=aProgressBar3.Max=aProgressBar4.Max=aProgressBar1.Value=aProgressBar2.Value=bProgressBar3.Value=cProgressBar4.Value=dLabel22.Caption="總收入:"+Trim(a)+"元"Label23.Caption="普通房收入:"+Trim(b)+"元"Label24.Caption="原則房收入:"+Trim(c)+"元"Label25.Caption="豪華房收入:"+Trim(d)+"元"Label26.Caption=Trim(Left$(b/a*100,5))+"%"Label27.Caption=Trim(Left$(c/a*100,5))+"%"Label28.Caption=Trim(Left$(d/a*100,5))+"%"EndSub管理員界面PrivateSubCommand16_Click()‘添加管理員-擬定IfText11.Text=""ThenMsgBox"賬號不能為空!",vbOKOnly+vbInformation,"錯誤信息"Text11.SetFocusElseIfText12.Text=""ThenMsgBox"密碼不能為空!",vbOKOnly+vbInformation,"錯誤信息"Text12.SetFocusElseIfText13.Text=""ThenMsgBox"確認(rèn)密碼不能為空!",vbOKOnly+vbInformation,"錯誤信息"Text13.SetFocusElseIfCombo4.Text=""ThenMsgBox"權(quán)限不能為空!",vbOKOnly+vbInformation,"提示信息"Combo4.SetFocusElseIfText12.Text<>Text13.TextThenMsgBox"兩次輸入密碼不一致!請重新輸入。",vbOKOnly+vbInformation,"錯誤信息"Text12.Text=""Text13.Text=""Text12.SetFocusElseIfMsgBox("擬定添加管理員“"&Text11.Text&"”嗎?",vbInformation+vbOKCancel,"提示信息")=vbOKThenAdodc12.RecordSource="select*fromAdminInfowhereAname='"&frmLogin.DataCombo1.Text&"'andAlimit='1'"Adodc12.RefreshIfAdodc12.Recordset.RecordCount=1ThenAdodc7.RecordSource="select*fromViewAdminInfowhereAname='"&Text11.Text&"'"Adodc7.RefreshIfAdodc7.Recordset.RecordCount=1ThenMsgBox"你輸入管理員賬號“"&Text11.Text&"”已經(jīng)存在!請重新輸入。",vbInformation+vbOKOnly,"提示信息"Command17_ClickText11.SetFocusElseAdodc7.CommandType=adCmdTextAdodc7.RecordSource="select*fromAdminInfo"Adodc7.RefreshAdodc7.Recordset.AddNewAdodc7.Recordset.Fields("Aname")=Text11.TextAdodc7.Recordset.Fields("Amima")=Text12.TextAdodc7.Recordset.Fields("Alimit")=Left$(Combo4.Text,1)Adodc7.Recordset.UpdateAdodc3.RefreshSetDataGrid4.DataSource=Adodc3DataGrid4.RefreshMsgBox"添加管理員成功!",vbInformation+vbOKOnly,"提示信息"Command17_ClickEndIfElseMsgBox"當(dāng)前管理員“"&frmLogin.DataCombo1.Text&"”權(quán)限局限性,不能進行操作",vbOKOnly+vbInformation,"提示信息"Command17_ClickEndIfElseCommand17_ClickEndIfEndIfEndSubPrivateSubCommand17_Click()‘添加管理員-清空Text11.Text=""Text12.Text=""Text13.Text=""EndSubPrivateSubCommand18_Click()‘修改密碼-擬定IfDataCombo1.Text=""ThenMsgBox"請選取賬號!",vbOKOnly+vbInformation,"錯誤信息"DataCombo1.SetFocusElseIfText15.Text=""ThenMsgBox"請輸入舊密碼!",vbOKOnly+vbInformation,"錯誤信息"Text15.SetFocusElseIfText16.Text=""ThenMsgBox"請輸入新密碼!",vbOKOnly+vbInformation,"錯誤信息"Text16.SetFocusElseIfText17.Text=""ThenMsgBox"請輸入確認(rèn)密碼密碼!",vbOKOnly+vbInformation,"錯誤信息"Text17.SetFocusElseIfText16.Text<>Text17.TextThenMsgBox"新密碼與確認(rèn)密碼不一致!請重新輸入。",vbOKOnly+vbInformation,"錯誤信息"Text16.Text=""Text17.Text=""Text16.SetFocusElseIfMsgBox("擬定修改密碼嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc8.RecordSource="select*fromAdminInfowhereAmima='"&Text15.Text&"'andAname='"&DataCombo1.Text&"'"Adodc8.RefreshIfAdodc8.Recordset.RecordCount=1ThenAdodc8.Recordset.Fields(2).Value=Trim(Text16.Text)Adodc8.Recordset.UpdateMsgBox"密碼修改成功,下次登陸請使用新密碼!",vbOKOnly+vbInformation,"提示信息"Command19_ClickElseMsgBox"你輸入舊密碼錯誤!請重新輸入",vbInformation+vbOKOnly,"提示信息"Text15.Text=""Text16.Text=""Text17.Text=""Text15.SetFocusEndIfElseEndIfEndIfEndSubPrivateSubCommand19_Click()‘修改密碼-清空DataCombo1.Text=""Text15.Text=""Text16.Text=""Text17.Text=""EndSubPrivateSubDataCombo2_Change()Adodc5.RecordSource="select*fromViewEmptyRoomInfowhereRnum='"+Trim(DataCombo2.Text)+"'"Adodc5.RefreshSetText2.DataSource=Adodc5SetText3.DataSource=Adodc5SetText4.DataSource=Adodc5Text2.RefreshText3.RefreshText4.RefreshIfFrame1.Caption="修改房間"ThenSetCombo3.DataSource=Adodc5Combo3.RefreshCombo3.Enabled=TrueCombo3.Visible=TrueText2.Visible=FalseText3.Enabled=TrueEndIfEndSubPrivateSubDataCombo2_Change()‘修改密碼-選取賬號Adodc5.RecordSource="select*fromViewEmptyRoomInfowhereRnum='"+Trim(DataCombo2.Text)+"'"Adodc5.RefreshSetText2.DataSource=Adodc5SetText3.DataSource=Adodc5SetText4.DataSource=Adodc5Text2.RefreshText3.RefreshText4.RefreshIfFrame1.Caption="修改房間"ThenSetCombo3.DataSource=Adodc5Combo3.RefreshCombo3.Enabled=TrueCombo3.Visible=TrueText2.Visible=FalseText3.Enabled=TrueEndIfEndSubPrivateSubCommand14_Click()‘刪除管理員SelectCaseCommand14.CaptionCase"刪除管理員"labXuhao.Visible=TruetxtXuhao.Visible=TruetxtXuhao.SetFocusCommand14.Caption="擬定刪除管理員"Case"擬定刪除管理員"Command14.Enabled=FalseIftxtXuhao.Text<>""ThenIfMsgBox("擬定刪除序號為“"&txtXuhao.Text&"”管理員嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc9.RecordSource="select*fromViewAdminInfowhereAid="&txtXuhao.Text&""Adodc9.RefreshIfAdodc9.Recordset.RecordCount=1ThenAdodc12.RecordSource="select*fromAdminInfowhereAname='"&frmLogin.DataCombo1.Text&"'andAlimit='1'"Adodc12.RefreshIfAdodc12.Recordset.RecordCount=1ThenAdodc9.RecordSource="select*fromAdminInfowhereAid="&txtXuhao.Text&""Adodc9.RefreshAdodc9.Recordset.DeleteAdodc9.Recordset.UpdateAdodc3.RefreshMsgBox"刪除成功!",vbInformation+vbOKOnly,"提示信息"txtXuhao.Text=""

溫馨提示

  • 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. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論