客房管理系統(tǒng)VB+SQL_第1頁
客房管理系統(tǒng)VB+SQL_第2頁
客房管理系統(tǒng)VB+SQL_第3頁
客房管理系統(tǒng)VB+SQL_第4頁
客房管理系統(tǒng)VB+SQL_第5頁
已閱讀5頁,還剩26頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

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

本課程設(shè)計(jì)的主要目的是學(xué)習(xí)和練習(xí)SQLServer數(shù)據(jù)庫的實(shí)際應(yīng)用,所以選擇SQLServer2000作為數(shù)據(jù)庫效勞器。需求分析系統(tǒng)主要實(shí)現(xiàn)對(duì)客房的管理功能。主要有管理員登陸、客戶登記、房間管理、客戶查詢、房間查詢、收入統(tǒng)計(jì)、管理員信息管理。系統(tǒng)總體設(shè)計(jì)圖如下:概念結(jié)構(gòu)設(shè)計(jì)〔E-R圖〕邏輯結(jié)構(gòu)設(shè)計(jì)將E-R圖轉(zhuǎn)換成關(guān)系模式:管理員〔編號(hào),賬號(hào),密碼,權(quán)限〕房間〔編號(hào),類型,價(jià)格,狀態(tài),入住客戶編號(hào)〕客戶〔編號(hào),姓名,性別,年齡,身份證號(hào),住址,入住時(shí)間,預(yù)計(jì)天數(shù),房間編號(hào),退房時(shí)間,押金,住宿費(fèi),登記人〕關(guān)系標(biāo)準(zhǔn)化:均已到達(dá)第三范式數(shù)據(jù)實(shí)施與維護(hù)建立數(shù)據(jù)庫翻開SQLServer2000企業(yè)管理器,建立數(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='標(biāo)準(zhǔn)')標(biāo)準(zhǔn)房收入視圖CREATEVIEWdbo.ViewCostASSELECTdbo.ViewAllCost.AllCost,dbo.ViewPutongCost.pFROMdbo.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)立一個(gè)觸發(fā)器:CREATETRIGGERinsert_triONdbo.GuestInfoFORINSERTASupdateRoomInfosetRstates='滿',Cid=(selectCidfrominserted)whereRnum=(selectRnumfrominserted)功能:當(dāng)向表GuestInfo中插入一個(gè)客戶信息時(shí),觸發(fā)表RoomInfo的某房間的狀態(tài)變?yōu)椤皾M〞備份數(shù)據(jù)庫給所建立的數(shù)據(jù)庫進(jìn)行備份界面設(shè)計(jì)與代碼〔用VB作為界面設(shè)計(jì)語言〕登陸界面PublicSubCommand1_Click()‘確定IfTrim(DataCombo1.Text)<>""AndTrim(Text1.Text)<>""ThenAdodc1.RecordSource="select*fromAdminInfowhereAname='"+Trim(DataCombo1.Text)+"'andAmima='"+Trim(Text1.Text)+"'"Adodc1.RefreshIfAdodc1.Recordset.RecordCount=1ThenfrmMain.ShowMe.HideElseMsgBox"錯(cuò)誤的賬號(hào)或密碼!",vbInformation+vbOKOnly,"錯(cuò)誤信息"Text1.Text=""DataCombo1.SetFocusEndIfElseIfDataCombo1.Text=""ThenMsgBox"賬號(hào)不能為空!",vbInformation+vbOKOnly,"錯(cuò)誤信息"DataCombo1.SetFocusElseMsgBox"密碼不能為空!",vbInformation+vbOKOnly,"錯(cuò)誤信息"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)前時(shí)間txt6.Text=Trim(Now())EndSubPrivateSubCommand2_Click()‘確定Iftxt1.Text=""Ortxt2.Text=""Ortxt3.Text=""Ortxt4.Text=""Ortxt6.Text=""Ortxt8.Text=""OrDataCombo1.Text=""ThenMsgBox"請將藍(lán)色局部填寫完整!",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.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")=aidMsgBox"登記成功!",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+""+"編號(hào):"+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+""+"身份證號(hào):"+Trim(Adodc1.Recordset.Fields(4).Value)+vbCrLf+vbCrLf+""+"入住時(shí)間:"+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"房間編號(hào)不能為空!",vbOKOnly+vbInformation,"錯(cuò)誤信息"DataCombo1.SetFocusEndIfEndSubPrivateSubCommand2_Click()‘費(fèi)用結(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)=eAdodc4.RecordSource="select*fromRoomInfowhereRnum='"&rnum&"'"Adodc4.RefreshAdodc4.Recordset.Fields(3)="空"Adodc4.Recordset.Fields(4)=NullMsgBox"退房成功!",vbOKOnly+vbInformation,"提示信息"UnloadfrmCheckOutUnloadMeElseUnloadfrmCheckOutUnloadMeEndIfEndSubPrivateSubCommand2_Click()UnloadfrmCheckOutUnloadMeEndSubPrivateSubForm_Load()‘費(fèi)用結(jié)算窗體加載事件Adodc2.RecordSource="selectRpricefromViewRoomInfowhereRnum="&frmCheckOut.DataCombo1.Text&""'查詢房間的價(jià)格Adodc2.RefreshDimpriceAsInteger'房間價(jià)格price=CInt(Adodc2.Recordset.Fields(0))'獲取房間價(jià)格Label2.Caption="房間:"+frmCheckOut.DataCombo1.Text+""+"單價(jià):"+CStr(price)+"元/天"Adodc1.RecordSource="select*fromViewGuestInfowhereRnum='"&frmCheckOut.DataCombo1.Text&"'andCouttimeisnull"'查詢客戶信息Adodc1.Refreshframe1.Caption="編號(hào):"+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))'精確時(shí)間b=CInt(time-Adodc1.Recordset.Fields(6))'對(duì)時(shí)間取整c=a-b'計(jì)算出小于一天的時(shí)間Ifc>0Thend=b+1'缺乏一天算一天Elsed=bEndIfe=d*price'計(jì)算住宿費(fèi)RichTextBox1.Text=vbCrLf+""+"入住時(shí)間:"+Trim(Adodc1.Recordset.Fields(6).Value)+vbCrLf+vbCrLf+""+"當(dāng)前時(shí)間:"+Trim(time)+vbCrLf+vbCrLf+""+"共住"+CStr(a)+"天"+""+"計(jì)"+CStr(d)+"天"+vbCrLf+vbCrLf+""+"住宿費(fèi):"+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()‘確定Ifframe1.Caption="增加房間"ThenIfText1.Text<>""AndCombo3.Text<>""AndText3.Text<>""ThenIfMsgBox("確定增加房間“"&Text1.Text&"〞嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc5.RecordSource="select*fromViewRoomInfowhereRnum='"&Text1.Text&"'"Adodc5.RefreshIfAdodc5.Recordset.RecordCount=1ThenMsgBox"你輸入的房間編號(hào)“"&Text1.Text&"〞重復(fù)!請重新輸入。",vbInformation+vbOKOnly,"提示信息"Text1.Text=""Text2.Text=""Text3.Text=""Text1.SetFocusElseAdodc5.CommandType=adCmdTextAdodc5.RecordSource="select*fromRoomInfo"Adodc5.Recordset.Fields("Rnum")=Text1.TextAdodc5.Recordset.Fields("Rtype")=Combo3.TextAdodc5.Recordset.Fields("Rprice")=Text3.TextAdodc5.Recordset.Fields("Rstates")=Text4.TextAdodc2.RefreshSetDataGrid2.DataSource=Adodc2DataCombo2.RefreshAdodc6.RefreshMsgBox"增加房間“"&Text1.Text&"〞成功!",vbInformation+vbOKOnly,"提示信息"Command11_ClickEndIfElseCommand11_ClickEndIfElseMsgBox"房間信息填寫不完整,請繼續(xù)填寫!",vbOKOnly+vbInformation,"錯(cuò)誤提示"EndIfElseIfframe1.Caption="修改房間"ThenIfDataCombo2.Text<>""ThenIfMsgBox("確定要修改房間信息嗎?",vbOKCancel+vbInformation,"提示信息")=vbOKThenAdodc5.CommandType=adCmdTextAdodc5.RecordSource="updataRoomInfosetRtype='"&Text2.Text&"',Rprice='"&Text3.Text&"'whereRnum='"&DataCombo2.Text&"'"Adodc2.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&"'"Adodc2.RefreshSetDataGrid2.DataSource=Adodc2DataGrid2.RefreshAdodc6.RefreshMsgBox"刪除房間“"&DataCombo2.Text&"〞成功!",vbInformation+vbOKOnly,"提示信息"Command11_ClickElseCommand11_ClickEndIfElseMsgBox"請選擇要?jiǎng)h除的房間!",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()‘精確查詢-確定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"查詢條件至少有一個(gè)不為空!",vbOKOnly+vbInformation,"錯(cuò)誤信息"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="查詢結(jié)果-精確查詢"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"標(biāo)準(zhǔn)房客戶"Adodc11.RecordSource="select*fromViewGuestInfoa,ViewRoomInfobwhereb.Rtype='標(biāo)準(zhǔn)'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="查詢結(jié)果-"+Combo1.TextEndIfEndSub房間查詢界面PrivateSubCommand22_Click()‘按房間編號(hào)查詢IfText9.Text=""ThenMsgBox"你沒有輸入房間編號(hào)",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text9.SetFocusElseFrame7.Caption="查詢結(jié)果顯示-按房間編號(hào)"Adodc4.RecordSource="select*fromViewRoomInfowhereRnum='"+Trim(Text9.Text)+"'"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand23_Click()‘按房間類型查詢IfCombo2.Text=""ThenMsgBox"你沒有輸入房間類型",vbOKOnly+vbInformation,"錯(cuò)誤信息"Combo2.SetFocusElseFrame7.Caption="查詢結(jié)果顯示-按房間類型"Adodc4.RecordSource="select*fromViewRoomInfowhereRtype='"+Trim(Combo2.Text)+"'orderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand24_Click()‘按房間價(jià)格查詢IfText18.Text=""ThenMsgBox"你沒有輸入完整價(jià)格范圍",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text18.SetFocusElseIfText19.Text=""ThenMsgBox"你沒有輸入完整價(jià)格范圍",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text19.SetFocusElseDimaAsIntegerDimbAsIntegera=(Text18.Text)b=(Text19.Text)Frame7.Caption="查詢結(jié)果顯示-按房間價(jià)格"Adodc4.RecordSource="select*fromViewRoomInfowhereRprice>="&a&"andRprice<="&b&"orderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndIfEndSubPrivateSubCommand20_Click()‘顯示空房Frame7.Caption="查詢結(jié)果顯示-顯示空房"Adodc4.RecordSource="select*fromViewEmptyRoomInfoorderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndSubPrivateSubCommand21_Click()‘顯示滿房Frame7.Caption="查詢結(jié)果顯示-顯示滿房"Adodc4.RecordSource="select*fromViewFullRoomInfoorderbyRnumASC"Adodc4.RefreshSetDataGrid5.DataSource=Adodc4DataGrid5.RefreshEndSub收入統(tǒng)計(jì)界面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="標(biāo)準(zhǔn)房收入:"+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"賬號(hào)不能為空!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text11.SetFocusElseIfText12.Text=""ThenMsgBox"密碼不能為空!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text12.SetFocusElseIfText13.Text=""ThenMsgBox"確認(rèn)密碼不能為空!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text13.SetFocusElseIfCombo4.Text=""ThenMsgBox"權(quán)限不能為空!",vbOKOnly+vbInformation,"提示信息"Combo4.SetFocusElseIfText12.Text<>Text13.TextThenMsgBox"兩次輸入密碼不一致!請重新輸入。",vbOKOnly+vbInformation,"錯(cuò)誤信息"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"你輸入管理員賬號(hào)“"&Text11.Text&"〞已經(jīng)存在!請重新輸入。",vbInformation+vbOKOnly,"提示信息"Command17_ClickText11.SetFocusElseAdodc7.CommandType=adCmdTextAdodc7.RecordSource="select*fromAdminInfo"Adodc7.RefreshAdodc7.Recordset.Fields("Aname")=Text11.TextAdodc7.Recordset.Fields("Amima")=Text12.TextAdodc7.Recordset.Fields("Alimit")=Left$(Combo4.Text,1)Adodc3.RefreshSetDataGrid4.DataSource=Adodc3DataGrid4.RefreshMsgBox"添加管理員成功!",vbInformation+vbOKOnly,"提示信息"Command17_ClickEndIfElseMsgBox"當(dāng)前管理員“"&frmLogin.DataCombo1.Text&"〞的權(quán)限缺乏,不能進(jìn)行操作",vbOKOnly+vbInformation,"提示信息"Command17_ClickEndIfElseCommand17_ClickEndIfEndIfEndSubPrivateSubCommand17_Click()‘添加管理員-清空Text11.Text=""Text12.Text=""Text13.Text=""EndSubPrivateSubCommand18_Click()‘修改密碼-確定IfDataCombo1.Text=""ThenMsgBox"請選擇賬號(hào)!",vbOKOnly+vbInformation,"錯(cuò)誤信息"DataCombo1.SetFocusElseIfText15.Text=""ThenMsgBox"請輸入舊密碼!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text15.SetFocusElseIfText16.Text=""ThenMsgBox"請輸入新密碼!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text16.SetFocusElseIfText17.Text=""ThenMsgBox"請輸入確認(rèn)密碼密碼!",vbOKOnly+vbInformation,"錯(cuò)誤信息"Text17.SetFocusElseIfText16.Text<>Text17.TextThenMsgBox"新密碼與確認(rèn)密碼不一致!請重新輸入。",vbOKOnly+vbInformation,"錯(cuò)誤信息"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)MsgBox"密碼修改成功,下次登陸請使用新密碼!",vbOKOnly+vbInformation,"提示信息"Command19_ClickElseMsgBox"你輸入的舊密碼錯(cuò)誤!請重新輸入",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()‘修改密碼-選擇賬號(hào)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("確定刪除序號(hào)為“"&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.RefreshAdodc3.RefreshMsgBox"刪除成功!",vbInformation+vbOKOnly,"提示信息"txtXuhao.Text=""Command14.Caption="刪除管理員"

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論