VB酒店管理系统源代码
酒店管理系统软件(VB)大作业

声明:本作品完全由个人创作,对于应付老师留得软件大作业很有帮助(西工大),本作品仅供个人交流学习,不建议作为商业用途,否则后果自负。
由于vb软件还有很多参数的设定,在此不变于抓图。
因此如果读者完全按照本文档所示结果可能出错,请设置data控件的数据库连接(本作品用access数据库,需要时读者自行建立)以上两个图是程序运行后的部分截图数据库截图(图上的各个名字必须与之对应)Form1截图Form1的代码:Public yonghu As String, mima As StringPublic jibie As Integer '用户的身份级别Dim r0 As Single 'x0,y0为圆心坐标Dim r1 As Single, r2 As Single, r3 As Single 'r0圆半径,r1时钟刻度外圈半径Dim r4 As Single 'r2时钟长刻度内圈半径,r3时钟短刻度内半径Dim r5 As Single, r6 As Single, r7 As Single 'r4时钟标注文字半径,r5时钟时针半径,r6时钟分针半径Dim x0 As Single, y0 As Single 'r7时钟秒针半径Private Sub bangzhu_Click()Form9.ShowEnd SubPrivate Sub bumen_Click()Form6.ShowEnd SubPrivate Sub fangcha_Click()Form2.ShowEnd SubPrivate Sub Form_Load()Label1.Top = 1000 '初始化两个标签的位置Label2.Top = 1000dingwei '将时针,秒针和分针定位到圆心位置jibie = -1yonghu = ""mima = ""End SubPrivate Sub guanli_Click()Form14.ShowEnd SubPrivate Sub Timer1_Timer() '利用定时时钟采用文字的移动Label1.Top = Label1.Top + 10Label2.Top = Label2.Top + 10If Label1.Top = 4700 Then '当文字移到底部时采用重新符值将文字移到顶部Label1.Top = 1000Label2.Top = 1000End IfkeduEnd SubPrivate Sub dingwei() '将时针,秒针和分针定位到圆心位置x0 = Shape1.Left + Shape1.Width / 2y0 = Shape1.Top + Shape1.Height / 2r0 = Shape1.Width / 2r1 = r0r2 = r0 * 0.85r3 = r0 * 0.9r4 = r0 * 0.75r5 = r0 * 0.48r6 = r0 * 0.56r7 = r0 * 0.65Line1.X1 = x0Line2.X1 = x0Line3.X1 = x0Line1.Y1 = y0Line2.Y1 = y0Line3.Y1 = y0End SubPrivate Sub kedu() '绘制时钟刻度Dim i As Single, du As SingleDim X1 As Single, Y1 As Single, X2 As Single, Y2 As SingleFor i = 0 To 354 Step 6du = i * 3.14159 / 180X1 = x0 + r1 * Sin(du)Y1 = y0 - r1 * Cos(du)X2 = x0 + r3 * Sin(du)Y2 = y0 - r3 * Cos(du)Form1.Line (X1, Y1)-(X2, Y2), RGB(0, 0, 200)Next iFor i = 30 To 360 Step 30du = i * 3.14159 / 180Form1.DrawWidth = IIf(i Mod 90 = 0, 3, 2)X1 = x0 + r1 * Sin(du)Y1 = y0 - r1 * Cos(du)X2 = x0 + r2 * Sin(du)Y2 = y0 - r2 * Cos(du)Form1.Line (X1, Y1)-(X2, Y2), RGB(0, 0, 200)X1 = x0 + r4 * Sin(du)Y1 = y0 - r4 * Cos(du)Form1.CurrentX = X1 - 150Form1.CurrentY = Y1 - 100Form1.Print i \ 30Next iEnd SubPrivate Sub Timer2_Timer() '达到指针的动态效果Dim s1 As Single, m1 As Single, h1 As Single, an1 As Single, an2 As Single s1 = Second(Now)m1 = Minute(Now)h1 = Hour(Now)h1 = h1 Mod 12m1 = m1 + s1 / 60h1 = h1 + m1 / 60an2 = h1 * 3.141592653 / 6Line1.X2 = x0 + r5 * Sin(an2)Line1.Y2 = y0 - r5 * Cos(an2)an1 = m1 * 3.14159 / 30Line2.X2 = x0 + r6 * Sin(an1)Line2.Y2 = y0 - r6 * Cos(an1)an1 = s1 * 3.14159 / 30Line3.X2 = x0 + r7 * Sin(an1)Line3.Y2 = y0 - r7 * Cos(an1)End SubPrivate Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.IndexCase 2:Form10.ShowCase 4:Form11.ShowCase 6:Form12.ShowCase 8:Form13.ShowEnd SelectEnd SubPrivate Sub yuangongxx_Click()Form5.ShowEnd SubPrivate Sub yuding_Click()Form3.ShowEnd SubForm2截图Form2代码Private Sub Command1_Click() '上一个Data1.Recordset.MovePreviousIf Data1.Recordset.BOF ThenData1.Recordset.MoveLastEnd IfEnd SubPrivate Sub Command2_Click() '下一个Data1.Recordset.MoveNextIf Data1.Recordset.EOF ThenData1.Recordset.MoveFirstEnd IfEnd SubPrivate Sub Command3_Click() '查询If Option1.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '天'" Data1.RefreshEnd IfIf Option2.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '地'" Data1.RefreshEnd IfIf Option3.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '人'" Data1.RefreshEnd IfIf Option4.Value = True ThenData1.RecordSource = "房间信息"Data1.RefreshEnd IfCommand1.Enabled = TrueCommand2.Enabled = TrueEnd SubPrivate Sub Command4_Click() '结束Unload MeEnd SubPrivate Sub Form_Load()Text1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseData1.DatabaseName = App.Path & "\酒店管理系统.mdb"End SubPrivate Sub Option1_Click() '天Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option2_Click() '地Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option3_Click() '人Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option4_Click() '全部Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubForm3代码Private Sub Command1_Click() 'querenDim a As StringDim b As IntegerIf Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" ThenMsgBox "信息不完善", , "提示"ElseIf Option6.Value = True Or Option5.Value = True ThenIf Form16.jieguo = 0 ThenMsgBox "如果您是会员或内部人员请先登录!", , "提示"Form16.ShowEnd IfIf Form16.jieguo = 1 Thenb = 1End IfElseb = 1End IfIf b ThenData1.Recordset.AddNewData1.Recordset.Fields("姓名") = Text5.TextData1.Recordset.Fields("房间号") = Text1.TextData1.Recordset.Fields("预定入住时间") = Text2.TextData1.Recordset.Fields("居住时间") = Text3.TextData1.Recordset.Fields("缴纳定金") = Text4.TextData1.Recordset.Fields("性别") = Text6.TextIf Option1.Value = True Thena = "天"End IfIf Option2.Value = True Thena = "地"End IfIf Option3.Value = True Thena = "人"End IfData2.RecordSource = "select * from 房间信息where 房间信息.房间类型='" & a & "' and 房间信息.房间号='" & Text1.Text & "' and 房间信息.状态='可用'"Data2.RefreshIf Data2.Recordset.EOF ThenMsgBox "无此房间或此房间不可用", , "提示"Data1.UpdateControlsElseIf Option1.Value = True ThenData1.Recordset.Fields("房间类型") = "天"End IfIf Option2.Value = True ThenData1.Recordset.Fields("房间类型") = "地"a = "地"End IfIf Option3.Value = True ThenData1.Recordset.Fields("房间类型") = "人"a = "人"End IfIf Option4.Value = True ThenData1.Recordset.Fields("身份") = "普通"End IfIf Option5.Value = True ThenData1.Recordset.Fields("身份") = "会员"End IfIf Option6.Value = True ThenData1.Recordset.Fields("身份") = "内部人员"End IfData2.RecordSource = "select 房间信息.状态from 房间信息where 房间信息.房间类型='" & a & "'and 房间信息.房间号='" & Text1.Text & "'"Data2.Recordset.EditData2.Recordset.Fields("状态") = "预定"Data2.Recordset.UpdateData1.UpdateRecordData1.RefreshMsgBox "预订成功!", , "提示"Form16.jieguo = 0End IfEnd IfEnd IfEnd SubPrivate Sub Command2_Click() 'quxiaoData1.UpdateControlsData2.UpdateControlsEnd SubPrivate Sub Command3_Click() '尚不是会员马上注册Form4.ShowEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb"Data2.DatabaseName = App.Path & "\酒店管理系统.mdb"b = 0Form16.jieguo = 0End SubForm4代码Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)End SubPrivate Sub Command1_Click() 'tijiaoDim a As Stringa = Text1.TextIf Text1.Text <> "" ThenIf Text3.Text = Text2.Text ThenData1.RecordSource = "select * from 会员信息where 会员信息.账号='" & a & "'"Data1.RefreshIf Data1.Recordset.EOF ThenData1.Recordset.AddNewData1.Recordset.Fields("账号") = Text1.TextData1.Recordset.Fields("密码") = Text2.TextData1.Recordset.Fields("邮箱") = Text4.TextData1.UpdateRecordElseMsgBox "此账号已被别人占用", , "提示" '此处用于将会员信息输入数据库GoTo baEnd IfMsgBox "恭喜您顺利成为本酒店会员", , ""Unload MeElseMsgBox "两次输入密码不相符", , "提示"End IfElseMsgBox "帐号不能为空", , "提示"End Ifba:End SubPrivate Sub Command2_Click() 'quexiaoData1.UpdateControlsUnload MeEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb"End SubForm5代码Private Sub Command1_Click()Unload MeEnd SubPrivate Sub Form_Load()'Data1.RecordSource = "select 员工信息.姓名,员工信息.部门,员工信息.职位from 员工信息" End SubPrivate Sub Command1_Click() 'liao jie l Unload MeEnd SubPrivate Sub Command2_Click() 'shang yi geAdodc1.Recordset.MovePreviousIf Adodc1.Recordset.BOF ThenAdodc1.Recordset.MoveLastEnd IfEnd SubPrivate Sub Command3_Click() 'xia yi geAdodc1.Recordset.MoveNextIf Adodc1.Recordset.EOF ThenAdodc1.Recordset.MoveFirstEnd IfEnd SubForm7代码Private Sub Command1_Click() 'zeng tianData1.Recordset.AddNewText1.Enabled = TrueText2.Enabled = TrueText3.Enabled = TrueText4.Enabled = TrueText5.Enabled = TrueCommand4.Enabled = TrueCommand5.Enabled = TrueEnd SubPrivate Sub Command2_Click() 'xiu gaiData1.Recordset.EditText1.Enabled = TrueText2.Enabled = TrueText3.Enabled = TrueText4.Enabled = TrueText5.Enabled = TrueCommand4.Enabled = TrueCommand5.Enabled = TrueEnd SubPrivate Sub Command3_Click() 'shan chu Dim a As Integera = MsgBox("确认删除吗", vbYesNo, "提示") If a = vbYes ThenData1.Recordset.DeleteData1.Recordset.MoveFirstEnd IfEnd SubPrivate Sub Command4_Click() 'fang qiData1.UpdateControlsText1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseText5.Enabled = FalseCommand4.Enabled = FalseCommand5.Enabled = FalseData1.Recordset.MoveFirstEnd SubPrivate Sub Command5_Click() 'que ren Data1.Recordset.UpdateText1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseText5.Enabled = FalseCommand4.Enabled = FalseCommand5.Enabled = FalseData1.Recordset.MoveFirstEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb" End SubForm8代码Public jies As StringPrivate Sub dxx_Click()Form19.ShowEnd SubPrivate Sub fangzong_Click()Form20.ShowEnd SubPrivate Sub Form_Load()Label1.Caption = Form1.yonghu + "欢迎您" End SubPrivate Sub jiesuan_Click()Form22.ShowEnd SubPrivate Sub Label1_Click()End SubPrivate Sub Label2_Click() 'zhu xiao Unload MeForm17.HideForm19.HideForm18.HideForm23.HideForm20.HideForm21.HideForm15.HideForm22.HideForm24.HideForm7.HideEnd SubPrivate Sub lishi_Click()Form23.ShowEnd SubPrivate Sub mimaxiugai_Click()Form24.ShowEnd SubPrivate Sub ruzhu_Click()Form21.ShowEnd SubPrivate Sub yd_Click()Form18.ShowEnd SubPrivate Sub ygwanzheng_Click() Form17.ShowEnd SubPrivate Sub zh_Click()Form15.ShowEnd SubPrivate Sub zhineng_Click() Form7.ShowEnd SubForm9代码Private Sub Command1_Click() Unload MeEnd SubPrivate Sub Form_Load()Text1.Text = " 本系统为本人独立编写,所有密码均为000,在使用过程中可自行更改。
酒店管理系统数据库代码

酒店管理系统数据库代码use Hotel_Management1select*from Customerselect*from Employeeselect*from RoomTypeselect*from Roomselect*from OrderInfoselect*from Checkoutdrop database Hotel_Management1------------------------创建数据库Hotel_Management---------------------------------------------------------------------- create database Hotel_MDBonprimary(name=Hotel_Management1,filename='F:\Hotel_Management\Hotel_Management.MDF',size=10MB,filegrowth=20%)log on(name=Hotel_Management1,filename='F:\Hotel_Management\Hotel_Management1.LDF',size=10MB,filegrowth=2MB)--使用数据库USE Hotel_Management1--------------------------------------------创建表-----------------------------------------------------------------1顾客表create table Customer(CustomerID int primary key,CustomerName nvarchar(40)not null,CustomerInfo nvarchar(18)not null,Csex nvarchar(1),CPhone nvarchar(11)not null,Notes ntext)--drop table Customer--2员工表create table Employee(EmployeeID int primary key,UserName nvarchar(40)not null,Password nvarchar(40)not null,EmployeeName nvarchar(40)not null,Esex nvarchar(1),EPhone nvarchar(11)not null,Notes ntext)--3客房表(有外键)create table Room(RoomID int primary key,RoomTypeID int not null,RoomState nvarchar(1)not null,Notes ntext,FOREIGN KEY(RoomTypeID)REFERENCES RoomType(RoomTypeID), )--drop table Room--4客房类型表(有外键)create table RoomType(RoomTypeID int primary key,RoomTypeName nchar(20)not null,Cost float,Total int,Surplus int,Notes ntext,)--drop table RoomType--5订房表select*from OrderInfocreate table OrderInfo(OrderID int not null primary key,RoomID int not null,CustomerID int,EmployeeID int,Entertime datetime not null,Deposit float,ORstatic nvarchar(10)not null,Notes ntext,FOREIGN KEY(CustomerID)REFERENCES Customer(CustomerID), FOREIGN KEY(RoomID)REFERENCES Room(RoomID),FOREIGN KEY(EmployeeID)REFERENCES Employee(EmployeeID),)--alter table add constraint OI_D ORstatic default 'use'--drop table OrderInfo--6退房表check-outcreate table Checkout(CheckoutID int primary key,RoomID int not null,CustomerID int,EmployeeID int,Entertime datetime not null,Endtime datetime not null,Total_consumption float,Notes ntext,FOREIGN KEY(EmployeeID)REFERENCES Employee(EmployeeID),FOREIGN KEY(CustomerID)REFERENCES Customer(CustomerID),)--drop table Checkoutsp_help Checkout----------------------------------------表插入信息---------------------------------------------------------------------- --Employee表insert into Employee values('zhoutonglu',123456,'董洁','f',,null)insert into Employee values('liminghao',123456,'李明浩','m',,null)insert into Employee values('yuxian',123456,'余香','f',,null)select*from Employee---RoomType表select*from RoomTypeinsert into RoomType values(1,'单间',200,20,19,null)insert into RoomType values(2,'标准间',260,20,19,null)insert into RoomType values(3,'豪华单间',580,20,19,null)insert into RoomType values(4,'行政套房',880,20,19,null)----Room表select*from Roominsert into Room values('1011',1,'Y',null)insert into Room values('1012',1,'N',null)insert into Room values('1021',2,'Y',null)insert into Room values('1022',2,'N',null)insert into Room values('1031',3,'Y',null)insert into Room values('1032',3,'N',null)insert into Room values('1041',4,'Y',null)insert into Room values('1042',4,'N',null)insert into Room values('1013',1,'Y',null)insert into Room values('1014',1,'N',null)insert into Room values('1023',2,'Y',null)insert into Room values('1024',2,'N',null)insert into Room values('1033',3,'Y',null)insert into Room values('1034',3,'N',null)insert into Room values('1051',4,'Y',null)insert into Room values('1052',4,'N',null)---Customer 表select*from Customerselect*from Roominsert into Customer values('刘德华',,'m',,null)insert into Customer values('张更硕',,'m',,null)insert into Customer values('周辉',,'m',,null)insert into Customer values('刘美美',,'f',,null)insert into Customer values('范冰冰',,'f',,null)insert into Customer values('佟大为',,'m',,null)insert into Customer values('范玮琪',,'f',,null)insert into Customer values('陈小春',,'m',,null)insert into Customer values('kenim',,'m',,null)--OrderInfo 表select*from OrderInfoinsert into OrderInfo values(9001,'1011',1,1,'2013-09-03 9:00PM',250.00,'use',null)insert into OrderInfo values(9002,'1021',2,2,'2013-09-05 7:00PM',300.00,'use',null)insert into OrderInfo values(9003,'1031',3,2,'2013-09-04 8:00PM',600.00,'use',null)insert into OrderInfo values(9004,'1041',4,2,'2013-09-12 2:00PM',1000.00,'use',null)insert into OrderInfo values(9005,'1021',9,2,'2013-09-04 7:00PM',300.00,'use',null)insert into OrderInfo values(9006,'1031',10,2,'2013-09-04 8:00PM',600.00,'use',null)--insert into OrderInfo values(9007,'1041',11,2,'2013-09-4 2:00PM',1000.00,'use',null)exec proc_find_stu 1041---库存-1--insert into OrderInfo values(9005,'1012',1,1,'2013-09-03 9:00PM',250.00,'use' ,null)--delete OrderInfo where OrderID in(9005)--drop table OrderInfo---Checkout表insert into Checkout values(13001,'1011',1,2,'2013-09-03 9:00PM','2013-09-04',200,NULL)insert into Checkout values(13002,'1021',2,2,'2013-09-03 3:00PM','2013-09-04',200,NULL)insert into Checkout values(13003,'1031',3,2,'2013-09-03 10:00PM','2013-09-04',200,NULL)--insert into Checkout values(13004,'1041',4,2,'2013-09-03 8:00PM','2013-09-04',200,NULL )insert into Checkout values(13003,'1021',9,2,'2013-09-03 10:00PM','2013-09-04',880,NULL)delete Checkout where CheckoutID in(13001,13002)--drop table Checkoutselect*from Checkoutselect*from OrderInfoselect*from RoomTypeselect*from Roomexec proc_find_stu 1041---库存-1exec proc_find_stu2 1011---库存+1--insert into Checkout values('O2001','R003',1002,2,'2013-09-06',570,NULL )--insert into Checkout values('O2002','R001',1003,2,'2013-09-04',570,NULL )----------------------------------------创建触发器---------------------------------------------------------------------- --1\创建客房使用状态触发器(插入)create trigger RoomState_1on OrderInfofor insertasupdate Roomset RoomState='Y'where RoomID=any(select RoomID from INSERTED )--drop trigger RoomState_1--2-创建客房使用状态触发器(删除)create trigger RoomState_2on Checkoutfor insertasupdate Roomset RoomState='N'where RoomID in(select RoomID from INSERTED )--drop trigger RoomState_2---3--创建修改订单状态触发器create trigger ORstatic_1on Checkoutfor insertasupdate OrderInfoset ORstatic='NO'where RoomID=any(select RoomID from INSERTED )--drop trigger ORstatic_1---------------------------------------存储过程------------------------------------------------------------------------------------------------------------------------------------1--创建修改客房库存触发器(减少)create proc proc_find_stu(@startId int)asupdate RoomType set Surplus=(Surplus-1)where RoomTypeID in(select RoomTypeID from Room where RoomID=@startId) goexec proc_find_stu 1011--2--创建修改客房库存触发器(增长)create proc proc_find_stu2(@startId int)asupdate RoomType set Surplus=(Surplus+1)where RoomTypeID in(select RoomTypeID from Room where RoomID=@startId) goexec proc_find_stu2 1011---系统功能流程use Hotel_Management1select*from Customerselect*from Employeeselect*from RoomTypeselect*from Roomselect*from OrderInfoselect*from Checkout--()顾客入住员工查询闲置房间select*from Room where RoomState='N'select RoomID,RoomTypeName,RoomState,Cost,Total,Surplus from Room,RoomType where Room.RoomTypeID=RoomType.RoomTypeID and RoomState='N'---A。
酒店客房管理系统设计VB程序源代码

酒店客房管理系统设计系统源代码酒店客房管理系统代码清单:frmAddlb窗体代码:Private Sub Command1_Click()Dim sql As StringDim conn As New adodb.ConnectionDim rs_fjstyle As New adodb.RecordsetIf Trim(Text1.Text) = "" ThenMsgBox "请输入房间类型", vbOKOnly + vbExclamation, ""Text1.SetFocusExit SubEnd IfIf Trim(Text2.Text) = "" ThenMsgBox "请输入类型代号", vbOKOnly + vbExclamation, ""Text2.SetFocusExit SubEnd IfIf Trim(Text3.Text) = "" ThenMsgBox "请输入房间数量", vbOKOnly + vbExclamation, ""Text3.SetFocusExit SubEnd Ifconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select * from 客房类别where 房间类型='" & Text1.Text & "'"rs_fjstyle.Open sql, conn, adOpenKeyset, adLockPessimisticIf rs_fjstyle.EOF Thenrs_fjstyle.AddNewrs_fjstyle.Fields(1) = Trim(Text1.Text)rs_fjstyle.Fields(2) = Trim(Text2.Text)rs_fjstyle.Fields(3) = Trim(Text3.Text)rs_fjstyle.UpdateMsgBox "添加成功", vbOKOnly + vbExclamation, ""Text1.Text = ""Text2.Text = ""Text3.Text = ""Text1.SetFocusrs_fjstyle.CloseElseMsgBox "你添加的类别已存在,请输入新类别", vbOKOnly + vbExclamation, ""Text1.SetFocusText1.Text = ""Text2.Text = ""rs_fjstyle.CloseExit SubEnd IfEnd SubPrivate Sub Command2_Click()Unload Mefrmlbinfo.ShowEnd SubfrmAdduser窗体代码:Private Sub Command1_Click()Dim sql As StringDim rs_add As New adodb.RecordsetDim conn As New adodb.Connectionconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"If Trim(Text1.Text) = "" ThenMsgBox "用户名不能为空,请输入!", vbOKOnly + vbExclamation, ""Text1.SetFocusElsesql = "select * from 用户信息"rs_add.Open sql, conn, adOpenKeyset, adLockPessimisticWhile (rs_add.EOF = False)If Trim(rs_add.Fields(1)) = Trim(Text1.Text) ThenMsgBox "已有这个用户", vbOKOnly + vbExclamation, ""Text1.SetFocusText1.Text = ""Text2.Text = ""Text3.Text = ""Exit SubElsers_add.MoveNextEnd IfWendIf Trim(Text2.Text) <> Trim(Text3.Text) ThenMsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""Text2.SetFocusText2.Text = ""Text3.Text = ""Exit SubElsers_add.AddNewrs_add.Fields(1) = Text1.Textrs_add.Fields(2) = Text2.Textrs_add.UpdateMsgBox "添加用户成功!", vbOKOnly + vbExclamation, ""'Me.HideEnd IfEnd IfEnd SubPrivate Sub Command2_Click()Unload MeEnd SubfrmdfAdd窗体代码:Private Sub Command1_Click()Dim sql As StringDim conn As New adodb.ConnectionDim rs_fjstyle As New adodb.RecordsetIf Trim(Text1.Text) = "" ThenMsgBox "请输入姓名!", vbOKOnly + vbExclamation, ""Text1.SetFocusExit SubEnd If'If Trim(Text2.Text) = "" Then'MsgBox "日期不能为空!", vbOKOnly + vbExclamation, ""'Text2.SetFocus'Exit Sub'Else'If Not IsDate(Text2.Text) Then' MsgBox "请按照2006-12-30格式输入登记日期!", vbOKOnly + vbExclamation, "" ' Text2.Text = ""' Text2.SetFocus'Exit Sub'End If'End IfIf Trim(Text3.Text) = "" ThenMsgBox "请输入房间编号!", vbOKOnly + vbExclamation, ""Text2.SetFocusExit SubEnd IfIf Trim(Text4.Text) = "" ThenMsgBox "请选择房间类型!", vbOKOnly + vbExclamation, ""Text4.SetFocusExit SubEnd IfIf Trim(Text5.Text) = "" ThenMsgBox "请交定金!", vbOKOnly + vbExclamation, ""Text5.SetFocusExit SubEnd Ifconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select * from 预订客房"rs_fjstyle.Open sql, conn, adOpenKeyset, adLockPessimistic'rs_fjstyle.EOFrs_fjstyle.AddNewrs_fjstyle.Fields(1) = Trim(Text1.Text)rs_fjstyle.Fields(4) = Trim(DTPicker1.Value)rs_fjstyle.Fields(5) = Trim(DTPicker2.Value)rs_fjstyle.Fields(2) = Trim(Text3.Text)rs_fjstyle.Fields(3) = Trim(Text4.Text)rs_fjstyle.Fields(6) = Val(Text5.Text)rs_fjstyle.UpdateMsgBox "添加成功", vbOKOnly + vbExclamation, ""rs_fjstyle.CloseCommand3.Enabled = TrueExit SubEnd SubPrivate Sub Command2_Click()Text1.Text = ""'Text2.Text = ""'Text3.Text = ""Text4.Text = ""Text5.Text = ""Text1.SetFocusEnd SubPrivate Sub Command3_Click()Dim conn As New adodb.ConnectionDim rs_fjstyle As New adodb.Recordsetconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select 客人姓名,房间编号,房间类型,订房日期,订房时间,预交订金from 预订客房" rs_fjstyle.CursorLocation = adUseClientrs_fjstyle.Open sql, conn, adOpenKeyset, adLockPessimisticDataGrid1.AllowAddNew = FalseDataGrid1.AllowDelete = FalseDataGrid1.AllowUpdate = FalseSet DataGrid1.DataSource = rs_fjstyleMsgBox "数据已更新!", vbOKOnly + vbExclamation, ""Exit SubEnd SubPrivate Sub Command4_Click()Unload MeEnd SubPrivate Sub Form_Load()Dim sql As StringDim conn As New adodb.ConnectionDim rs_fjstyle As New adodb.Recordsetconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select 客人姓名,房间编号,房间类型,订房日期,订房时间,预交订金from 预订客房" rs_fjstyle.CursorLocation = adUseClientrs_fjstyle.Open sql, conn, adOpenKeyset, adLockPessimisticDataGrid1.AllowAddNew = FalseDataGrid1.AllowDelete = FalseDataGrid1.AllowUpdate = FalseSet DataGrid1.DataSource = rs_fjstyleExit SubSet DTPicker2.Value = TimeEnd SubfrmDfdy窗体代码:Private Sub Command1_Click()Dim conn As New adodb.ConnectionDim rs_dfdybb As New adodb.Recordsetconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select 房间编号,房间类别,日住宿费,周住宿费,月住宿费,预订,空房from 客房信息"rs_dfdybb.Open sql, conn, adOpenKeyset, adLockPessimisticSet DataReport1.DataSource = rs_dfdybb.DataSourceDataReport1.DataMember = rs_dfdybb.DataMemberDataReport1.Show' Unload MeEnd SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Dim sql As StringDim rs_dfdy As New RecordsetDim conn As New adodb.ConnectionOn Error GoTo loaderrorconn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\data\database.mdb"sql = "select 房间编号,房间类别,日住宿费,周住宿费,月住宿费,预订,空房from 客房信息" rs_dfdy.CursorLocation = adUseClientrs_dfdy.Open sql, conn, adOpenKeyset, adLockPessimisticDataGrid1.AllowAddNew = FalseDataGrid1.AllowDelete = FalseDataGrid1.AllowUpdate = FalseSet DataGrid1.DataSource = rs_dfdyExit Subloaderror:MsgBox Err.DescriptionEnd SubfrmdfEdit窗体代码:Option ExplicitDim rs_xgkfinfo As New adodb.RecordsetPrivate Sub cmddel_Click()Dim answer As Stringanswer = MsgBox("确定要删除吗?", vbYesNo, "")If answer = vbYes ThenDataGrid1.AllowDelete = TrueDataGrid1.AllowAddNew = FalseDataGrid1.AllowDelete = Falsers_xgkfinfo.Deleters_xgkfinfo.UpdateDataGrid1.RefreshElseExit SubEnd IfEnd SubPrivate Sub cmdEdit_Click()Dim answer As StringOn Error GoTo cmdEditcmddel.Enabled = FalsecmdEdit.Enabled = Falsecmdupdate.Enabled = TrueCommand4.Enabled = FalseDataGrid1.AllowUpdate = TrueExit SubcmdEdit:If Err.Number <> 0 ThenMsgBox Err.DescriptionEnd IfEnd Sub'-------------------------------------------------------Private Sub DataGrid1_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)If ColIndex = 3 ThenIf Not IsDate(DataGrid1.Columns(3).Value) ThenCancel = TrueMsgBox "请输入一个日期型数据。
VB酒店客房管理系统数据流图+ER图+功能模块图

VB酒店客房管理系统数据流图+ER图+功能模块图第一章、系统概述1.1项目研究的意义第二章、系统需求分析2.1编写目的 (1)2.2开发背景 (2)2.3参考资料 (2)2.4任务概述2.4.1实现目标 (2)2.4.2运行环境 (3)2.3条件限制 (3)2.5数据描述2.5.1信息需求 (3)2.5.2处理需求 (3)2.6数据流图 (4)2.7数据字典 (6)2.8功能需求2.8.1功能模块 (6)2.8.2系统主要功能描述 (7)2.9性能需求2.9.1数据精度 (7)2.9.2时间特性 (7)2.10 运行需求 (7)2.11 其他要求 (7)第三章、数据库概念结构设计3.1E-R图 (8)3.1.1 局部E-R图 (8)3.1.2总E-R图 (9)第四章、数据库的逻辑结构设计(详细设计)4.1关系模式 (10)4.2基本表 (10)4.3接口设计 (12)第五章、系统的实现与调试5.1系统流程设计 (13)第六章系统的界面设计及源代码6.1登陆窗口界面及代码 (14)6.2系统主窗口界面 (15)6.3.住宿管理设计 (19)6.3.1住宿登记 (19)6.3.2追加押金 (25)6.3.3调房登记 (28)6.3.4退房结帐 (31)6.4客房管理 (36)6.4.1客房设置 (36)6.4.2.客房查询 (38)6.4.3.房态查看 (39)6.5挂帐管理 (41)6.6查询统计 (42)6.6.1.住宿查询 (42)6.6.2退宿查询 (42)6.6.3宿费提醒 (43)6.7日结设计 (44)6.7.1客房销售报表 (44)6.8系统设置 (46)6.8.1操作员设置 (46)6.8.2密码设置 (47)6.8.3权限设置 (321)[10] ... >>酒店客房管理系统系统的界面设计及源代码6.1系统登陆窗口界面Dim TIM As Integer ''定义一个整型变量Dim myval As String ''定义一个字符串变量Private Sub Form_Load()''自动识别数据库路径Data1.DatabaseName = App.Path & "\KFGL.mdb"Data2.DatabaseName = App.Path & "\KFGL.mdb"End SubPrivate Sub Form_Activate()''当记录为零时,进入系统具有所有权限If Data1.Recordset.RecordCount = 0 ThenMsgBox ("请先设置操作员密码和权限!")Load mainmain.ShowUnload MeElseText1.SetFocusEnd IfEnd SubPrivate Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then Text2.SetFocus ''按回车键,text2获得焦点End SubPrivate Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then Cmd1.SetFocus ''按回车键cmd1获得焦点If KeyCode = vbKeyUp Then Text1.SetFocusIf KeyCode = vbKeyDown Then Cmd1.SetFocusEnd SubPrivate Sub cmd1_Click()main.StatusBar1.Panels(4).Text = Text1.Text ''赋值给main.StatusBar1.Panels(4).Text''验证操作员及密码If Data2.Recordset.BOF = False Then Data2.Recordset.MoveFirstData2.Recordset.FindFirst "操作员 like " + Chr(34) + Text1.BoundText + Chr(34) + ""If Data2.Recordset.NoMatch ThenMsgBox ("操作员输入错误!")ElseData1.RecordSource = "select * from qxsz where 操作员=''" & Text1.BoundText & "''"Data1.RefreshIf Text1.BoundText <> "" And Text2.Text <> "" And Text2.Text = Data1.Recordset.Fields("密码") Then Load mainmain.ShowUnload MeElseIf TIM = 3 Then ''密码输错3次,退出系统myval = MsgBox("密码输入错误,请向系统管理员查询!", 0, "")If myval = vbOK Then EndEnd IfIf Text1.BoundText = "" ThenMsgBox ("请输入操作员!")Text1.SetFocusElseIf Text1.BoundText <> Data1.Recordset.Fields("操作员") ThenMsgBox ("查无此操作员,请重新输入操作员!")Text1.SetFocusElseIf Text2.Text = "" ThenMsgBox ("请输入操作员密码!")Text2.SetFocusElseIf Text2.Text <> Data1.Recordset.Fields("密码") ThenMsgBox ("密码错误,请重新输入密码!")TIM = TIM + 1Text2.SetFocusEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd SubPrivate Sub cmd2_Click()End6.2系统主程序窗口界面Private Sub Form_Load()Data1.DatabaseName = App.Path & "\Kfgl.MDB" ''自动识别数据库路径End SubPrivate Sub Form_Activate() ''设置操作员权限With Data1.RecordsetIf .BOF = False Then .MoveFirst.FindFirst "操作员 like " + Chr(34) + StatusBar1.Panels(4).Text + Chr(34) + ""If .NoMatch ThenElsemain.zjyj.Enabled = .Fields("追加押金")main.zsdj.Enabled = .Fields("住宿登记")bel1.Enabled = .Fields("住宿登记")main.tf.Enabled = .Fields("退宿登记")bel2.Enabled = .Fields("退宿登记")main.tfdj.Enabled = .Fields("调房登记")main.kfsz.Enabled = .Fields("客房管理")main.kfcx.Enabled = .Fields("客房查询")main.ftck.Enabled = .Fields("房态查看")main.khjk.Enabled = .Fields("客户结款")main.zscx.Enabled = .Fields("住宿查询")bel3.Enabled = .Fields("住宿查询")main.tfcx.Enabled = .Fields("退宿查询")main.sftx.Enabled = .Fields("宿费提醒")bel5.Enabled = .Fields("宿费提醒")bel4.Enabled = .Fields("客房销售报表")main.xstj.Enabled = .Fields("客房销售统计报表")main.czysz.Enabled = .Fields("操作员设置")main.ma.Enabled = .Fields("密码设置")main.csh.Enabled = .Fields("初始化")main.qxsz.Enabled = .Fields("权限设置")End IfEnd WithEnd SubPrivate Sub label1_Click() ''调入住宿登记zsdj_ClickEnd SubPrivate Sub label2_Click() ''调入退宿结帐tf_ClickEnd SubPrivate Sub Label3_Click() ''调入住宿查询zscx_ClickEnd SubPrivate Sub Label4_Click() ''调入客房销售报表xsbb_ClickEnd SubPrivate Sub Label5_Click() ''调入宿费提醒sftx_ClickEnd SubPrivate Sub label6_Click()EndEnd SubPrivate Sub zjyj_Click() ''调入追加押金Load main_zjyjmain_zjyj.Showmain.Enabled = FalseEnd SubPrivate Sub tfdj_Click() ''调入调房登记main_tfdj.Showmain.Enabled = FalseEnd SubPrivate Sub tf_Click() ''调入退宿结帐main_tf.Showmain.Enabled = FalseEnd SubPrivate Sub kfsz_Click() ''调入客房管理[10] ... >>VB酒店客房管理系统数据流图+ER图+功能模块图main_kfgl.Showmain.Enabled = FalseEnd SubPrivate Sub kfcx_Click() ''调入客房查询main_kfcx.Showmain.Enabled = FalseEnd SubPrivate Sub ftck_Click() ''调入房态查看main_ftcx.Showmain.Enabled = FalseEnd SubPrivate Sub gzcx_Click() ''调入挂帐查询Load main_gzcxmain_gzcx.Showmain.Enabled = FalseEnd SubPrivate Sub khjk_Click() ''调入客户结款Load main_khjkmain_khjk.Showmain.Enabled = FalseEnd SubPrivate Sub zscx_Click() ''调入住宿查询Load main_zscxmain_zscx.Showmain.Enabled = FalseEnd SubPrivate Sub tfcx_Click() ''调入退宿查询Load main_tfcxmain_tfcx.Showmain.Enabled = FalseEnd SubPrivate Sub sftx_Click() ''调入宿费提醒Load main_xftxmain_xftx.Showmain.Enabled = FalseEnd SubPrivate Sub xsbb_Click() ''调入客房销售报表main_xsbb.Showmain.Enabled = FalseEnd SubPrivate Sub xstj_Click() ''调入客房销售统计main_xstj.Showmain.Enabled = FalseEnd SubPrivate Sub czysz_Click() ''调入操作员设置Load main_czyszmain_czysz.Showmain.Enabled = FalseEnd SubPrivate Sub ma_Click() ''调入密码设置main_mmsz.Showmain.Enabled = FalseEnd SubPrivate Sub csh_Click() ''调入初始化main_csh.Showmain.Enabled = FalseEnd SubPrivate Sub qxsz_Click() ''调入权限设置main_qxsz.Showmain.Enabled = FalseEnd SubPrivate Sub tc_Click()EndEnd Sub6.3住宿管理设计6.3.1住宿登记`Private Sub ZSDJ_Change(Index As Integer)Select Case IndexCase 6ZSDJ(7).Text = Format(Val(ZSDJ(6).Text) * Val(ZSDJ(5).Text), "0.00") ''计算折前宿费ZSDJ(9).Text = ZSDJ(7).Text ''赋值给ZSDJ(9)ZSDJ(8).Text = 100DTP3.Value = DTP1.Value + Val(ZSDJ(6).Text) ''计算退宿日期Case 8ZSDJ(9).Text = Format(Val(ZSDJ(7).Text) * Val(ZSDJ(8).Text) / 100, "0.00") ''计算实际宿费 Case 10If ZSDJ(10).Text <> "" ThenZSDJ(10).Text = Val(ZSDJ(10).Text) ''用val函数将字符串转换为数字DTP2.Value = DTP1.Value + Int(Val(ZSDJ(10).Text) / Val(ZSDJ(5).Text)) ''计算提醒日期If (Val(ZSDJ(10).Text) - Int(Val(ZSDJ(10).Text) / Val(ZSDJ(5).Text))) > 0.5 * Val(ZSDJ(5).Text) Then tim2.Value = #6:00:00 PM#Elsetim2.Value = #12:00:00 AM#End IfEnd IfEnd SelectEnd SubPrivate Sub ZSDJ_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)Select Case IndexCase 0If KeyCode = vbKeyReturn Then Combo1.SetFocus ''按回车键Combo1获得焦点 Case 1If KeyCode = vbKeyReturn Then ZSDJ(2).SetFocus ''按回车键ZSDJ(2)获得焦点 Case 2If KeyCode = vbKeyReturn Then ZSDJ(3).SetFocus ''按回车键ZSDJ(3)获得焦点 Case 3If KeyCode = vbKeyReturn Then DBCombo1.SetFocus ''按回车键ZSDJ(2)获得焦点Case 4If KeyCode = vbKeyReturn Then ZSDJ(5).SetFocus ''按回车键ZSDJ(5)获得焦点Case 5SetFocus ''按回车键ZSDJ(10)获得焦点Case 10If KeyCode = vbKeyReturn Then ZSDJ(11).SetFocus ''ZSDJ(11)获得焦点 Case 11If KeyCode = vbKeyReturn Then Comok.SetFocus ''按回车键Comok获得焦点End SelectEnd SubPrivate Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then ZSDJ(1).SetFocus ''按回车键ZSDJ(1)获得焦点End SubPrivate Sub DTP2_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then tim3.SetFocus ''按回车键tim3获得焦点End SubPrivate Sub DTP3_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then tim4.SetFocus ''按回车键tim4获得焦点End SubPrivate Sub tim3_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then DTP3.SetFocus ''按回车键DTP3获得焦点End SubPrivate Sub tim4_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then Text10.SetFocus ''按回车键Text10获得焦点End SubPrivate Sub DBCombo1_Change()''查询空闲房间信息Data2.RecordSource = "select * from kf where 房间号=''" & DBCombo1.Text & "''and 房态=''空房''"Data2.Refresh''查询住宿登记信息Data1.RecordSource = "select * from djb where 房间号=''" & DBCombo1.Text & "''and 标志=''1''"Data1.RefreshIf Data2.Recordset.RecordCount > 0 ThenIf Data1.Recordset.RecordCount = 0 ThenZSDJ(4).Text = Data2.Recordset.Fields("房间类型") ''赋值给ZSDJ(4)ZSDJ(5).Text = Data2.Recordset.Fields("价格") ''赋值给ZSDJ(5) ElseMsgBox ("此房间已占用或停止使用!!")End IfEnd IfEnd SubPrivate Sub DBCombo1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = vbKeyReturn Then ZSDJ(5).SetFocus ''ZSDJ(5)获得焦点End SubPrivate Sub comdj_Click()''查询空闲房间信息Data2.RecordSource = "select * from kf where 房态=''空房''"Data2.RefreshData3.RecordSource = "select * from kf where 房态=''空房''"Data3.Refresh''生成凭证号码Data1.RecordSource = "select * from djb order by 凭证号码"Data1.RefreshIf Not Data1.Recordset.EOF Then Data1.Recordset.MoveLastIf lsph.Text = "" Then bh.Text = Date & "d" & Format(1, "###000")If lsph.Text <> "" Theny1.Text = Month(Date)y2.Text = Month(Left(lsph.Text, 10))If y1.Text = y2.Text Thenbh.Text = Date & "d" & Format(Val(Right(lsph.Text, 3)) + 1, "###000")End If[10] ... >>酒店客房管理系统VB源代码If y1.Text <> y2.Text Thenbh.Text = Date & "d" & Format(1, "###000")End IfEnd If''清空数据For i = 0 To 6ZSDJ(i).Text = ""ZSDJ(i).Enabled = TrueNext iZSDJ(8).Text = "": ZSDJ(10).Text = "": ZSDJ(11).Text = "": DBCombo1.Text = "": DBCombo1.Text = ""''设置控件有效或无效Comok.Enabled = True: Comdj.Enabled = False: Comprint.Enabled = False: ZSDJ(8).Enabled = TrueZSDJ(10).Enabled = True: ZSDJ(11).Enabled = True: DBCombo1.Enabled = True: Combo1.Enabled = TrueCombo2.Enabled = True: ZSDJ(0).SetFocus ''ZSDJ(0)获得焦点End SubPrivate Sub comok_Click()Dim mydb1 As DatabaseDim myrs1 As RecordsetSet mydb1 = Workspaces(0).OpenDatabase(App.Path & "\kfgl.mdb")Set myrs1 = mydb1.OpenRecordset("djys", dbOpenTable)Data1.Recordset.FindFirst "房间号 like" + Chr(34) + DBCombo1.Text + Chr(34) + "and 标志 like" + Chr(34) + "1" + Chr(34) + ""If Data1.Recordset.NoMatch Then''添加住宿信息Data1.Recordset.AddNewIf bh.Text <> "" Then Data1.Recordset.Fields("凭证号码") = bh.TextIf ZSDJ(0).Text <> "" Then Data1.Recordset.Fields("姓名") = ZSDJ(0).TextIf Combo1.Text <> "" Then Data1.Recordset.Fields("证件名称") = Combo1.TextIf ZSDJ(1).Text <> "" Then Data1.Recordset.Fields("证件号码") = ZSDJ(1).TextIf ZSDJ(2).Text <> "" Then Data1.Recordset.Fields("详细地址") = ZSDJ(2).TextIf ZSDJ(3).Text <> "" Then Data1.Recordset.Fields("出差事由") = ZSDJ(3).TextIf DBCombo1.Text <> "" Then Data1.Recordset.Fields("房间号") = Val(DBCombo1.Text)If ZSDJ(4).Text <> "" Then Data1.Recordset.Fields("客房类型") = ZSDJ(4).TextIf DTP1.Value <> "" Then Data1.Recordset.Fields("住宿日期") = DTP1.ValueIf tim1.Value <> "" Then Data1.Recordset.Fields("住宿时间") = tim1.ValueIf ZSDJ(5).Text <> "" Then Data1.Recordset.Fields("客房价格") = Val(ZSDJ(5).Text)If ZSDJ(6).Text <> "" Then Data1.Recordset.Fields("住宿天数") = ZSDJ(6).TextIf ZSDJ(8).Text <> "" Then Data1.Recordset.Fields("折扣") = ZSDJ(8).TextIf ZSDJ(7).Text <> "" Then Data1.Recordset.Fields("宿费") = ZSDJ(7).TextIf Combo2.Text <> "" Then Data1.Recordset.Fields("结款方式") = Combo2.TextIf ZSDJ(9).Text <> "" Then Data1.Recordset.Fields("应收宿费") = ZSDJ(9).TextIf ZSDJ(10).Text <> "" Then Data1.Recordset.Fields("预收金额") = Val(ZSDJ(10).Text)If DTP2.Value <> "" Then Data1.Recordset.Fields("提醒日期") = DTP2.ValueIf tim2.Value <> "" Then Data1.Recordset.Fields("提醒时间") = tim2.ValueIf DTP3.Value <> "" Then Data1.Recordset.Fields("退宿日期") = DTP3.ValueIf tim3.Value <> "" Then Data1.Recordset.Fields("退宿时间") = tim3.ValueIf ZSDJ(11).Text <> "" Then Data1.Recordset.Fields("备注") = ZSDJ(11).TextData1.Recordset.Fields("日期") = DateData1.Recordset.Fields("时间") = TimeData1.Recordset.Fields("BZ") = Left(Date, 4) & Right(Left(Date, 7), 2) & Right(Date, 2) & Left(Time, 2) & Left(Right(Time, 5), 2)Data1.Recordset.Fields("标志") = "1"''更新记录Data1.Recordset.Update''添加住宿预收信息myrs1.AddNewIf bh.Text <> "" Then myrs1.Fields("凭证号码") = bh.TextIf ZSDJ(0).Text <> "" Then myrs1.Fields("姓名") = ZSDJ(0).TextIf Combo1.Text <> "" Then myrs1.Fields("证件名称") = Combo1.TextIf ZSDJ(1).Text <> "" Then myrs1.Fields("证件号码") = ZSDJ(1).TextIf ZSDJ(2).Text <> "" Then myrs1.Fields("详细地址") = ZSDJ(2).TextIf ZSDJ(3).Text <> "" Then myrs1.Fields("出差事由") = ZSDJ(3).TextIf DBCombo1.Text <> "" Then myrs1.Fields("房间号") = Val(DBCombo1.Text)If ZSDJ(5).Text <> "" Then myrs1.Fields("客房价格") = Val(ZSDJ(5).Text)If DTP1.Value <> "" Then myrs1.Fields("住宿日期") = DTP1.ValueIf tim1.Value <> "" Then myrs1.Fields("住宿时间") = tim1.ValueIf ZSDJ(6).Text <> "" Then myrs1.Fields("住宿天数") = ZSDJ(6).TextIf Combo2.Text <> "" Then myrs1.Fields("结款方式") = Combo2.TextIf ZSDJ(8).Text <> "" Then myrs1.Fields("折扣") = ZSDJ(8).TextIf ZSDJ(7).Text <> "" Then myrs1.Fields("宿费") = ZSDJ(7).TextIf ZSDJ(9).Text <> "" Then myrs1.Fields("应收宿费") = ZSDJ(9).TextIf ZSDJ(10).Text <> "" Then myrs1.Fields("预收金额") = Val(ZSDJ(10).Text)If DTP2.Value <> "" Then myrs1.Fields("提醒日期") = DTP2.ValueIf tim2.Value <> "" Then myrs1.Fields("提醒时间") = tim2.ValueIf DTP3.Value <> "" Then myrs1.Fields("退宿日期") = DTP3.ValueIf tim3.Value <> "" Then myrs1.Fields("退宿时间") = tim3.ValueIf ZSDJ(11).Text <> "" Then myrs1.Fields("备注") = ZSDJ(11).Textmyrs1.Fields("日期") = Datemyrs1.Fields("时间") = Timemyrs1.Fields("BZ") = Left(Date, 4) & Right(Left(Date, 7), 2) & Right(Date, 2) & Left(Time, 2) & Left(Right(Time, 5), 2)myrs1.Fields("标志") = "1"''更新记录myrs1.Update''更新房间状态Data2.Recordset.FindFirst "房间号 like " + Chr(34) + DBCombo1.Text + Chr(34) + ""Data2.Recordset.EditData2.Recordset.Fields("房态") = "入住"Data2.Recordset.Update''设置控件有效或无效For i = 0 To 6ZSDJ(i).Enabled = FalseNext iZSDJ(8).Enabled = False: ZSDJ(10).Enabled = False: ZSDJ(11).Enabled = FalseDBCombo1.Enabled = False: Combo1.Enabled = FalseEnd IfComok.Enabled = False: Comprint.Enabled = True: Comdj.Enabled = TrueComprint.SetFocusEnd SubPrivate Sub comcancel_Click() ''取消操作For i = 0 To 11ZSDJ(i).Enabled = FalseNext iComprint.Enabled = False: Comok.Enabled = False: DBCombo1.Enabled = FalseCombo1.Enabled = False: Combo2.Enabled = False: DTP2.Enabled = False: DTP3.Enabled = Falsetim2.Enabled = False: tim3.Enabled = False: Comdj.Enabled = TrueEnd SubPrivate Sub comprint_Click() ''打印住宿登记单据Printer.Height = 8000: Printer.Width = 8000Printer.CurrentX = 1100: Printer.CurrentY = 300Printer.FontSize = 12Printer.Print "龙海宾馆 (住宿证) "Dim A, B, C, D As IntegerA = 100:B = 500:C = 4800:D = 400Printer.FontSize = 10Printer.CurrentX = 100 + APrinter.CurrentY = B + 200Printer.Print Date & " " & Time & " NO." & bh.Text B = B + DPrinter.Line (A, B + 100)-(C, B + 100)Printer.CurrentX = 100 + APrinter.CurrentY = B + 200Printer.Print "姓名:" & ZSDJ(0).TextB = B + DPrinter.CurrentX = 100 + APrinter.CurrentY = B + 200Printer.Print "房间号:" & DBCombo1.TextB = B + DPrinter.CurrentX = 100 + APrinter.CurrentY = B + 200Printer.Print "押金:" & Format(ZSDJ(10).Text, "0.00")B = B + DPrinter.CurrentX = 100 + APrinter.CurrentY = B + 200Printer.Print Combo2.Text & ":" & ZSDJ(8).Text &。
酒店管理系统软件(VB)大作业

声明:本作品完全由个人创作,对于应付老师留得软件大作业很有帮助(西工大),本作品仅供个人交流学习,不建议作为商业用途,否则后果自负。
由于vb软件还有很多参数的设定,在此不变于抓图。
因此如果读者完全按照本文档所示结果可能出错,请设置data控件的数据库连接(本作品用access数据库,需要时读者自行建立)以上两个图是程序运行后的部分截图数据库截图(图上的各个名字必须与之对应)Form1截图Form1的代码:Public yonghu As String,mima As StringPublic jibie As Integer '用户的身份级别Dim r0 As Single 'x0,y0为圆心坐标Dim r1 As Single,r2 As Single,r3 As Single ’r0圆半径,r1时钟刻度外圈半径Dim r4 As Single ’r2时钟长刻度内圈半径,r3时钟短刻度内半径Dim r5 As Single, r6 As Single,r7 As Single ’r4时钟标注文字半径,r5时钟时针半径,r6时钟分针半径Dim x0 As Single,y0 As Single 'r7时钟秒针半径Private Sub bangzhu_Click()Form9。
ShowEnd SubPrivate Sub bumen_Click()Form6。
ShowEnd SubPrivate Sub fangcha_Click()Form2。
ShowEnd SubPrivate Sub Form_Load()Label1.Top = 1000 '初始化两个标签的位置Label2.Top = 1000dingwei '将时针,秒针和分针定位到圆心位置jibie = —1yonghu = ””mima = ""End SubPrivate Sub guanli_Click()Form14.ShowEnd SubPrivate Sub Timer1_Timer()’利用定时时钟采用文字的移动Label1。
VB酒店管理系统

设计题目:酒店客房管理系统 设计题目:酒店客房管理系统 客房 1 课程设计的目的
NO.1
本系统是模拟酒店客房管理系统。 主要用于宾馆旅客入住情况登记,包括旅客的姓名 及身份证号的登记,以及入住房间信息.当旅客离开时,需要办理退房结帐手续.对于一定 时间没有旅客入住情况实现基本查询,报表打印功能.对于宾馆本身也实现了客房增减,入 住情况查询等功能. 无论各种等级的宾馆,使用客房管理系统都具有非常实用的价值.使用该系统可以大 大节省时间,提高办公效率,而且非常方便的实现旅客信息的查询,以及对宾馆本身客房入 住情况及时了解.因此,客房管理系统的开发无疑具有深远的意义. 本系统是采用 Visu l Basic6.0 高级语言进行程序编制,以 Access 数据库为程序数据库。 a
表31为usersinfo管理员资料数据表字段名类型大小说明姓名text20管理人员帐号密码text20管理人员密码权限text管理人员权限表32旅客信息表为旅客的个人信息加入住客房信息数据结构表字段名类型大小说明登记号text旅客入住号姓名text旅客姓名身份证号码text18旅客身份证号房间号text入住房间号登记日期text日期时间旅客入住时间性别text旅客性别籍贯text旅客籍贯表33为room资料数据表
NO.4
表 3-4 为 quit 资料数据表。quit 资料数据表记录了所有退房的基本资料,管理员可 添加、删除和查询该表。类型的基本资料,包括登记号、登记日期、退房日期、付款金额、 退房备注信息。
字段名 登记号 登记日期 退房时间 付款金额 退房备注信息 类型 Text 日期/时间 日期/时间 Text Text 单精度型 8 大小 8 说明 旅客入住号 旅客登记时间 旅客退房时间 付费金额 退房备注信息
酒店管理系统代码

}
}
}
}
}
}
return (x);
}
/////////////////////////////09030317///////李俊杰/////////////////////
int dengji()
{
if(strcmp(zj,fvip[i].id)==0)
{
j=1;break;
}
}
if(j==0)
{
printf("会员信息有误!\n");
printf("%d",j);
return(flag);
}
if(j==1)
if(flat1[i].norms==1)
printf("单间 100元\n");
if(flat1[i].norms==2)
printf("标间 200元\n");
if(flat1[i].norms==3)
printf("VIP 300元\n");
}
}
for(i=0;!feof(fp);i++)
fread(&f[i],sizeof(struct flat),1,fp);
fclose(fp);
len=i;
fp=fopen("hy.txt","rb");
for(i=0;!feof(fp);i++)
fread(&fvip[i],sizeof(struct hy),1,fp);
{
int x,len,vlen,p=1,i,j=0,flag=1;
酒店管理系统软件(VB)大作业

酒店管理系统软件(VB)大作业声明:本作品完全由个人创作,对于应付老师留得软件大作业很有帮助(西工大),本作品仅供个人交流学习,不建议作为商业用途,否则后果自负. 由于vb软件还有很多参数的设定,在此不变于抓图。
因此如果读者完全按照本文档所示结果可能出错,请设置data控件的数据库连接(本作品用access数据库,需要时读者自行建立)以上两个图是程序运行后的部分截图数据库截图(图上的各个名字必须与之对应)Form1截图Form1的代码:Pub lic yonghu As String, mima As String Public jibie As Integer ’用户的身份级别Dim r0 As Single ’x0,y0为圆心坐标Dim r1 As Single, r2 As Single, r3 As Single ’r0圆半径,r1时钟刻度外圈半径Dim r4 As Single ’r2时钟长刻度内圈半径,r3时钟短刻度内半径Dim r5 As Single, r6 As Single, r7 As Single ’r4时钟标注文字半径,r5时钟时针半径,r6时钟分针半径Dim x0 As Single, y0 As Single 'r7时钟秒针半径Private Sub bangzhu_Click()Form9.ShowEnd SubPrivate Sub bumen_Click()Form6.ShowEnd SubPrivate Sub fangcha_Click() Form2。
ShowEnd SubPrivate Sub Form_Load() Label1。
Top = 1000 '初始化两个标签的位置Label2.Top = 1000dingwei '将时针,秒针和分针定位到圆心位置jibie = -1yonghu = ""mima = ””End SubPrivate Sub guanli_Click() Form14.ShowEnd SubPrivate Sub Timer1_Timer()’利用定时时钟采用文字的移动 Label1.Top = Label1。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Private Sub exit_Click()EndEnd SubPrivate Sub fixno_Click() Form12.ShowEnd SubPrivate Sub guestinfo_Click() Form7.ShowEnd SubPrivate Sub guestroom_Click() Form3.ShowEnd SubPrivate Sub MDIForm_Load()End SubPrivate Sub roombook_Click() Form10.ShowEnd SubPrivate Sub save_Click() Form2.ShowEnd SubPrivate Sub cmdin_Click() Form2.ShowUnload Form1End SubPrivate Sub cmdout_Click() EndEnd SubPrivate Sub Label1_Click() End SubPrivate Sub cmd1_Click()Static i As IntegerIf Text1.Text = "" ThenMsgBox "用户名不能为空!", vbOKOnly + vbCritical, "错误"Text1.SetFocusExit SubEnd IfAdouser.RefreshIf Not Adouser.Recordset.EOF ThenText1.Text = Adouser.Recordset!UserNameText2.Text = Adouser.Recordset!PasswordElseText1.Text = ""Text2.Text = ""End IfIf Text1.Text = Text1.Text And Text2.Text = Text2.Text ThenAdouser.Recordset.CloseUnload Form2frmmdi.ShowElseMsgBox "用户名或密码不正确!", vbOKOnly + vbInformation, "提示"i = i + 1If i >= 3 ThenAdouser.Recordset.CloseEndEnd IfText2.SetFocusUnload Form2End IfEnd SubPrivate Sub cmd2_Click() EndEnd SubPrivate Sub Form_Load() Text1.Text = ""Text2.Text = ""End SubPrivate Sub cmdadd_Click() Form4.ShowEnd SubPrivate Sub cmddelet_Click()Form5.ShowEnd SubPrivate Sub cmdfix_Click()Form6.ShowEnd SubPrivate Sub Command1_Click()frmmdi.ShowUnload Form3End SubPrivate Sub DataGrid1_Click()End SubPrivate Sub cmdadd_Click()Open App.Path & "\客房信息" For Append As #1Print #1, Space(10) & Text1.Text & Space(20) & Text2.Text & Space(20) & Text3.Text & Space(20)& Text4.Text & Space(20) & Text5.TextClose #1Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text1.SetFocusEnd SubPrivate Sub cmdlook_Click()Dim inputdata As Stringpic1.Clspic1.Printpic1.Print Space(20) & "房间编号" & Space(20) & "房间级别" & Space(20) & "房间类型" & Space(20) & "房间价格" & Space(20) & "是否住人"Open App.Path & "\客房信息" For Input As #1Do While Not EOF(1)Line Input #1, inputdatapic1.Print inputdataLoopClose #1Adoroom.RefreshEnd SubPrivate Sub Command1_Click()Form3.ShowUnload Form4End SubPrivate Sub Form_Load()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""End SubPrivate Sub cmdok_Click() Adoroom.RefreshEnd SubPrivate Sub Command1_Click() Form3.ShowUnload Form5End SubPrivate Sub Form_Load()End SubPrivate Sub cmdok_Click()With Adodelet.RecordsetIf .EOF <> True And .BOF <> True ThenIf !是否住人ThenMsgBox "当前房间有客人居住,你不能删除!", vbOKOnly + vbInformation, "提示"Exit SubElseOn Error GoTo deleteerrWith Adodelet.RecordsetIf Not .EOF And Not .BOF ThenIf MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then.Delete.MoveNextIf .EOF Then .MoveLastEnd IfEnd IfEnd WithExit Subdeleteerr:MsgBox Err.DescriptionEnd IfEnd IfEnd WithEnd SubPrivate Sub cmgok_Click()On Error GoTo deleteerrWith Adodelet.RecordsetIf Not .EOF And Not .BOF ThenIf MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then.Delete.MoveNextIf .EOF Then .MoveLastEnd IfEnd IfEnd WithExit Subdeleteerr:MsgBox Err.DescriptionEnd SubPrivate Sub Command1_Click()Form3.ShowUnload Form6End SubPrivate Sub Form_Load()End SubPrivate Sub cmdadd_Click() Form8.ShowEnd SubPrivate Sub Command1_Click() Form9.ShowEnd SubPrivate Sub Command2_Click() frmmdi.ShowUnload Form7End SubPrivate Sub Command3_Click() Form11.ShowEnd SubPrivate Sub Form_Load()End SubOption ExplicitPrivate Sub txtcard_krypress(keyascii As Integer)If (keyascii < 48 Or keyascii > 57) And keyascii <> 8 Then keyascii = 0End IfEnd SubPrivate Sub txtroomno_krypress(keyascii As Integer)If (keyascii < 48 Or keyascii > 57) And keyascii <> 8 Then keyascii = 0End IfEnd SubPrivate Sub cmd1_Click()End SubPrivate Sub cmdcancel_Click()Form7.ShowUnload Form8End SubPrivate Sub cmdok_Click()Dim inputdata As StringOpen App.Path & "\客人信息" For Append As #1Adoguest.Recordset.AddNewPrint #1, Space(10) & txtguestname.Text & Space(25) & txtcard.Text & Space(25) & txtroomno.Text & Space(25) & txtdate.TextClose #1txtguestname.Text = ""txtcard.Text = ""txtroomno.Text = ""txtdate.Text = ""txtguestname.SetFocusEnd SubPrivate Sub Form_Load()txtroomno.Text = ""txtguestname.Text = ""txtcard.Text = ""txtdate.Text = ""End SubPrivate Sub Command1_Click()On Error GoTo deleteerrWith adoco1.RecordsetIf Not .EOF And Not .BOF ThenIf MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then .Delete.MoveNextIf .EOF Then .MoveLastEnd IfEnd IfEnd WithExit Subdeleteerr:MsgBox Err.DescriptionEnd SubPrivate Sub Command2_Click()Form7.ShowUnload Form9End SubPrivate Sub Form_Load()End SubPrivate Sub Command3_Click()On Error GoTo deleteerrWith Adobook.RecordsetIf Not .EOF And Not .BOF ThenIf MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then .Delete.MoveNextIf .EOF Then .MoveLastEnd IfEnd IfEnd WithExit Subdeleteerr:MsgBox Err.DescriptionEnd SubPrivate Sub Form_Load()End SubPrivate Sub Command1_Click() Adodc1.RefreshEnd SubPrivate Sub Command2_Click() Form7.ShowUnload Form11End SubPrivate Sub Form_Load()End SubPrivate Sub Command1_Click()Dim sqlstmt As Stringsqlstmt = "insert into books (username,password,)" _+ "values('" + Trim(UserName) + "','" + Trim(Password) Adodc1.Recordset.AddNewAdodc1.Recordset!UserName = Trim(Text1.Text)Adodc1.Recordset!Password = Trim(Text2.Text)Adodc1.Recordset.UpdateAdodc1.RefreshMsgBox ("it is ok !")Text1.Text = " "Text2.Text = " "End SubPrivate Sub Command2_Click()Form2.ShowUnload Form12End SubPrivate Sub Form_Load()End Sub。