📄 房态图.frm
字号:
End Sub
Private Sub ListView1_DblClick()
On Error GoTo E200203
If QAccount_ID = "" Then
MsgBox "请注意:没有登记帐号,可能有错,请通过其他方式查询!", 48, "提示"
Else
Select Case Adodc9.Recordset.Fields("出售方式")
Case "包房"
Registration_Type = "显示"
Registration_Type2 = Adodc9.Recordset.Fields("当前状态") & "修改"
住宿登录.Show
Case "共享"
Select Case Adodc9.Recordset.Fields("当前状态")
Case "售出"
Query_Type = "在住客人"
客人查询.Show
Case "预订"
Query_Type = "预订客人"
客人查询.Show
End Select
End Select
End If
Exit Sub
E200203:
MsgBox "请注意:可能重复打开窗口,请先关闭后再查询!", 64, "提示"
End Sub
Private Sub ListView1_ItemClick(ByVal Item As ComctlLib.ListItem)
On Error GoTo err19
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & Item & "'"
Adodc9.Refresh
Me.Text6.Text = Adodc9.Recordset.Fields("床位数") - Adodc9.Recordset.Fields("住客")
Me.Text4.Text = IIf(IsNull(Adodc9.Recordset.Fields("床位数")), 0, Adodc9.Recordset.Fields("床位数"))
Me.Text5.Text = IIf(IsNull(Adodc9.Recordset.Fields("类型")), "", Adodc9.Recordset.Fields("类型"))
Me.Text3.Text = IIf(IsNull(Adodc9.Recordset.Fields("出售方式")), "", Adodc9.Recordset.Fields("出售方式"))
RoomNO = Item
Room_Rate = IIf(IsNull(Adodc9.Recordset.Fields("日房价")), 0, Adodc9.Recordset.Fields("日房价"))
Room_Type = IIf(IsNull(Adodc9.Recordset.Fields("类型")), "", Adodc9.Recordset.Fields("类型"))
Room_Statu = IIf(IsNull(Adodc9.Recordset.Fields("当前状态")), "", Adodc9.Recordset.Fields("当前状态"))
Room_Share_Type = IIf(IsNull(Adodc9.Recordset.Fields("出售方式")), "", Adodc9.Recordset.Fields("出售方式"))
QAccount_ID = IIf(IsNull(Adodc9.Recordset.Fields("帐号")), "", Adodc9.Recordset.Fields("帐号"))
CuanWeiShu = IIf(IsNull(Adodc9.Recordset.Fields("床位数")), "", Adodc9.Recordset.Fields("床位数"))
ZhuKeRenShu = IIf(IsNull(Adodc9.Recordset.Fields("住客")), "", Adodc9.Recordset.Fields("住客"))
'Account_ID = IIf(IsNull(adodc9.Recordset.Fields("帐号")), "", adodc9.Recordset.Fields("帐号"))
'Adodc9.Recordset.Close
Exit Sub
err19:
MsgBox "操作错误,错误代码1019", 48, "提示"
End Sub
Private Sub Option1_Click()
Me.Frame2.Visible = True
Me.Frame3.Visible = False
Me.Text1.SetFocus
End Sub
Private Sub Option2_Click()
On Error GoTo err20
Me.Combo1.Clear
Me.Frame2.Visible = False
Me.Frame3.Visible = True
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 房间状态"
Adodc9.Refresh
If Adodc9.Recordset.RecordCount > 0 Then
While Not Adodc9.Recordset.EOF
Me.Combo1.AddItem Adodc9.Recordset.Fields("房间状态")
Adodc9.Recordset.MoveNext
Wend
End If
Adodc9.Recordset.Close
Exit Sub
err20:
MsgBox "操作错误,错误代码1020", 48, "提示"
End Sub
Private Sub Option3_Click()
On Error GoTo err21
Me.Combo1.Clear
Me.Frame2.Visible = False
Me.Frame3.Visible = True
Me.Combo1.Clear
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 项目编码 where 编码 like 'FL%' order by 名称"
Adodc9.Refresh
While Not Adodc9.Recordset.EOF
Me.Combo1.AddItem Adodc9.Recordset.Fields("名称")
If Adodc9.Recordset.Fields("首选项") = "是" Then
Me.Combo1.Text = Adodc9.Recordset.Fields("名称")
End If
Adodc9.Recordset.MoveNext
Wend
Adodc9.Recordset.Close
Exit Sub
err21:
MsgBox "操作错误,错误代码1021", 48, "提示"
End Sub
Private Sub Option4_Click()
On Error GoTo err22
Dim List_item As ListItem
Me.Frame2.Visible = False
Me.Frame3.Visible = False
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) & "%"
Exit Sub
err22:
MsgBox "操作错误,错误代码1022", 48, "提示"
End Sub
Private Sub baofan()
If Room_Statu = "空房" Then
If Load_Statu = "使用" Then
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = Registration_Type
Adodc9.Recordset.Fields("出售方式") = "包房"
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Fields("住客") = 1
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Room_Update = True
Unload Me
End If
Else
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("当前状态") = Registration_Type
Adodc9.Recordset.Fields("出售方式") = "包房"
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Room_Update = True
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 "共享"
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
End If
Room_Update = False
End If
End If
End Sub
Private Sub gongxiang()
If Room_Statu = "空房" Then
If Load_Statu = "使用" Then
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房 where 房号 like '" & RoomNO & "'"
Adodc9.Refresh
Adodc9.Recordset.Fields("当前状态") = Registration_Type
Adodc9.Recordset.Fields("出售方式") = "共享"
Adodc9.Recordset.Fields("住客") = 1
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Room_Update = True
Unload Me
End If
Else
If Load_Statu = "使用" Then
Select Case Room_Share_Type
Case "共享"
If ZhuKeRenShu >= CuanWeiShu Then
MsgBox RoomNO & "房间已满,不能再住!", 16, "提示"
Else
'Adodc9.Recordset.Fields("当前状态") = Registration_Type
'Adodc9.Recordset.Fields("出售方式") = "共享"
Adodc9.Recordset.Fields("住客") = Adodc9.Recordset.Fields("住客") + 1
Adodc9.Recordset.Fields("帐号") = Account_ID
Adodc9.Recordset.Update
Adodc9.Recordset.Close
Room_Rate = 0
Room_Update = True
Unload Me
End If
Case "包房"
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Case Else
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
End Select
Else
MsgBox "请注意:" & RoomNO & "房间当前状态是:[" & Room_Statu & "],被[" & QAccount_ID & "]帐号" & Room_Share_Type & ",不能" & Registration_Type & "!", 48, "提示"
Room_Update = False
End If
End If
End Sub
Private Sub ReLoadStatu()
Dim List_item As ListItem
Adodc9.ConnectionString = My_PROVIDER
Adodc9.CommandType = adCmdText
Adodc9.RecordSource = "select * from 客房"
Adodc9.Refresh
Me.ListView1.ListItems.Clear
While Not Adodc9.Recordset.EOF
Select Case Adodc9.Recordset.Fields("当前状态")
Case "空房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 1
Case "脏房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 2
Case "维修房"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 3
Case "售出"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 4
Case "预订"
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 5
Case Else
ListView1.ListItems.Add , , Adodc9.Recordset.Fields("房号"), 1
End Select
Adodc9.Recordset.MoveNext
Wend
Adodc9.Recordset.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -