📄 房态图.frm
字号:
Else
'快速入住
If Room_Statu = "空房" Then
Room_Use_Type = "共享"
Q_Name = ""
Q_Name = InputBox("请输入客人姓名:", "快速入住", "")
If Q_Name <> "" Then
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 参数"
Adodc1.Refresh
Adodc1.Recordset.Fields("帐号") = Adodc1.Recordset.Fields("帐号") + 1
Account_ID = Format(Adodc1.Recordset.Fields("帐号"), "000000")
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 住宿情况 where 姓名 like '" & Q_Name & "' order by 帐号 desc"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If MsgBox("系统记录有同名客人档案" & CStr(Adodc1.Recordset.RecordCount) & "人,是否直接调用?", 65, "提示") = vbOK Then
Set Me.DataGrid1.DataSource = Adodc1
DataGrid1.ReBind
DataGrid1.Refresh
Me.Picture3.Visible = True
End If
Else
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = "售出"
Adodc9.Recordset.Fields("出售方式") = Room_Use_Type
'adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Fields("住客") = Adodc9.Recordset.Fields("住客") + 1
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 住宿情况"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("帐号") = Account_ID
Adodc1.Recordset.Fields("姓名") = Q_Name
Adodc1.Recordset.Fields("房号") = RoomNO
Adodc1.Recordset.Fields("房价") = Room_Rate
Adodc1.Recordset.Fields("房类") = Room_Type
Adodc1.Recordset.Fields("操作员") = CzyName
Adodc1.Recordset.Fields("当前状态") = "入住"
Adodc1.Recordset.Fields("日期") = System_Date
Adodc1.Recordset.Fields("到店日期") = System_Date
Adodc1.Recordset.Fields("到店时间") = Left(Time, 5)
Adodc1.Recordset.Fields("时间") = Left(Time, 5)
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Call ReLoadStatu
MsgBox "新客人 {" & Q_Name & "} 入住" & RoomNO & "房间成功!", 64, "提示"
End If
Else
MsgBox "没有客人姓名,不能入住!", 16, "提示"
End If
'不是空房
Else
If Room_Statu = "预订" Then
If Account_ID = QAccount_ID Then
Room_Use_Type = "包房"
Room_Update = True
Adodc9.Recordset.Close
Unload Me
Else
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Room_Update = False
End If
Else
If Room_Statu = "售出" Then
Select Case Room_Share_Type
Case "共享"
Q_Name = ""
Q_Name = InputBox("请输入客人姓名:", "快速入住", "")
If Q_Name <> "" Then
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 参数"
Adodc1.Refresh
Adodc1.Recordset.Fields("帐号") = Adodc1.Recordset.Fields("帐号") + 1
Account_ID = Format(Adodc1.Recordset.Fields("帐号"), "000000")
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 住宿情况 where 姓名 like '" & Q_Name & "' order by 帐号 desc"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If MsgBox("系统记录有同名客人档案" & CStr(Adodc1.Recordset.RecordCount) & "人,是否直接调用?", 65, "提示") = vbOK Then
Set Me.DataGrid1.DataSource = Adodc1
DataGrid1.ReBind
DataGrid1.Refresh
Me.Picture3.Visible = True
Room_Rate = 0
End If
Else
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = "售出"
Adodc9.Recordset.Fields("出售方式") = Room_Use_Type
Adodc9.Recordset.Fields("住客") = Adodc9.Recordset.Fields("住客") + 1
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Adodc1.ConnectionString = My_PROVIDER
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 住宿情况"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("帐号") = Account_ID
Adodc1.Recordset.Fields("姓名") = Q_Name
Adodc1.Recordset.Fields("房号") = RoomNO
Adodc1.Recordset.Fields("房价") = 0
Adodc1.Recordset.Fields("房类") = Room_Type
Adodc1.Recordset.Fields("操作员") = CzyName
Adodc1.Recordset.Fields("当前状态") = "入住"
Adodc1.Recordset.Fields("日期") = System_Date
Adodc1.Recordset.Fields("到店日期") = System_Date
Adodc1.Recordset.Fields("到店时间") = Left(Time, 5)
Adodc1.Recordset.Fields("时间") = Left(Time, 5)
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Call ReLoadStatu
MsgBox "新客人 {" & Q_Name & "} 入住" & RoomNO & "房间成功!", 64, "提示"
End If
Else
MsgBox "没有客人姓名,不能入住!", 16, "提示"
End If
Case "包房"
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Case Else
MsgBox "房间状态错误,请核查!", 64, "提示"
End Select
Room_Update = False
Else
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],不能" & Registration_Type & "!", 48, "提示"
End If
End If
End If
End If
Exit Sub
err16:
MsgBox "操作错误,错误代码1016", 48, "提示"
End Sub
Private Sub Command7_Click()
On Error GoTo err17
Dim DATA(80)
Dim i As Long
Q_Name = Adodc1.Recordset.Fields("姓名")
For i = 0 To Adodc1.Recordset.Fields.Count - 1
DATA(i) = Adodc1.Recordset.Fields(i)
Next
If Room_Statu = "预订" Then
If Account_ID = QAccount_ID Then
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = "售出"
Adodc9.Recordset.Fields("出售方式") = Room_Use_Type
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Call ReLoadStatu
Else
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Room_Update = False
Exit Sub
End If
Else
Select Case Room_Statu
Case "售出"
Select Case Room_Share_Type
Case "共享"
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Case "包房"
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Case Else
MsgBox "房间状态错误,请核查!", 64, "提示"
End Select
Exit Sub
Case "空房"
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = "售出"
Adodc9.Recordset.Fields("出售方式") = Room_Use_Type
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Call ReLoadStatu
End Select
End If
Adodc1.Recordset.AddNew
For i = 1 To Adodc1.Recordset.Fields.Count - 1
Adodc1.Recordset.Fields(i) = DATA(i)
Next
Adodc1.Recordset.Fields("帐号") = Account_ID
Adodc1.Recordset.Fields("房号") = RoomNO
Adodc1.Recordset.Fields("房价") = Room_Rate
Adodc1.Recordset.Fields("到店日期") = System_Date
Adodc1.Recordset.Fields("到店时间") = Left(Time, 5)
Adodc1.Recordset.Fields("离店日期") = System_Date
Adodc1.Recordset.Fields("天数") = 1
Adodc1.Recordset.Fields("平衡金额") = 0
Adodc1.Recordset.Fields("金额") = 0
Adodc1.Recordset.Fields("预付款") = 0
Adodc1.Recordset.Fields("费用类") = 0
Adodc1.Recordset.Fields("房租") = 0
Adodc1.Recordset.Fields("全日房") = 0
Adodc1.Recordset.Fields("半日房") = 0
Adodc1.Recordset.Fields("钟点房") = 0
Adodc1.Recordset.Fields("电话费") = 0
Adodc1.Recordset.Fields("餐费") = 0
Adodc1.Recordset.Fields("其他") = 0
Adodc1.Recordset.Fields("操作员") = CzyName
Adodc1.Recordset.Fields("日期") = System_Date
Adodc1.Recordset.Fields("时间") = Left(Time, 5)
Adodc1.Recordset.Fields("当前状态") = "入住"
Adodc1.Recordset.Fields("标志") = ""
Adodc1.Recordset.Fields("帐务笔数") = 0
Adodc1.Recordset.Update
Me.Picture3.Visible = False
MsgBox "客人已入住:" & RoomNO & "客房,资料已保存!", 64, "提示"
Exit Sub
err17:
MsgBox "操作错误,错误代码1017", 48, "提示"
End Sub
Private Sub Command8_Click()
Me.Picture3.Visible = False
End Sub
Private Sub Form_Load()
On Error GoTo err18
Dim i As Long
Dim List_item As ListItem
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房"
Adodc9.Refresh
Me.ListView1.ListItems.Clear
For i = 0 To 4
Room(i) = 0
Next
While Not Adodc9.Recordset.EOF
Select Case Adodc9.Recordset.Fields("当前状态")
Case "空房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 1
Room(0) = Room(0) + 1
Case "脏房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 2
Room(1) = Room(1) + 1
Case "维修房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 3
Room(2) = Room(2) + 1
Case "售出"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 4
Room(3) = Room(3) + 1
Case "预订"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 5
Room(4) = Room(4) + 1
Case Else
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 1
End Select
Adodc9.Recordset.MoveNext
Wend
Adodc9.Recordset.Close
Me.Label7.Caption = "空房:" & CStr(Room(0))
Me.Label8.Caption = "脏房:" & CStr(Room(1))
Me.Label9.Caption = "维修房:" & CStr(Room(2))
Me.Label10.Caption = "售出:" & CStr(Room(3))
Me.Label11.Caption = "预订:" & CStr(Room(4))
Me.Label12.Caption = "合计:" & CStr(Room(0) + Room(1) + Room(2) + Room(3) + Room(4))
Me.Label13.Caption = "出租率:" & (Round(Room(3) / (Room(0) + Room(1) + Room(2) + Room(3) + Room(4)), 2) * 100) & "%"
Select Case Load_Statu
Case "使用"
Me.Command5.Visible = True
Me.Command6.Visible = True
Me.Command4.Visible = False
Case "显示"
If Registration_Type = "" Then
Me.Command4.Visible = True
Else
Me.Command4.Visible = False
End If
End Select
Exit Sub
err18:
MsgBox "操作错误,错误代码1018", 48, "提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -