📄 houseinfo.frm
字号:
myrs.Open str, myCon
myrs.MoveFirst
Combo1.AddItem ("全部")
While Not myrs.EOF
Combo1.AddItem (myrs("kind"))
myrs.MoveNext
Wend
Combo1.ListIndex = 0
End Sub
'加载房间信息
Private Sub LoadHouse()
Dim m As Integer '循环变量
For m = 0 To 39
Command4(m).Visible = False
Command4(m).Caption = ""
Command4(m).Picture = LoadPicture()
Next
Dim str As String
If m_kind = "全部" Then
str = "select * from house order by nam"
Else
str = "select * from house where kind='" & m_kind & "' order by nam"
End If
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
Dim sum As Integer '对应房间总数
sum = myrs.RecordCount
Dim n As Integer '循环变量
Dim m_xingbie As String '保存性别
Dim m_man As String
Dim m_xiu As String
Dim m_sao As String
Dim m_yuding As String
For n = 0 To sum - 1 Step 1
m_xingbie = myrs("xingbie")
m_man = myrs("man")
m_xiu = myrs("weixiu")
m_sao = myrs("qingsao")
m_yuding = myrs("ding")
If m_yuding = 1 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\ding.bmp")
ElseIf m_xiu = 1 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\weixiu.bmp")
ElseIf m_sao = 1 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\qingsao.bmp")
ElseIf m_man = 1 And m_xingbie = 0 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\nanman.bmp")
ElseIf m_man = 1 And m_xingbie = 1 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\nvman.bmp")
ElseIf m_man = 2 And m_xingbie = 0 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\nanweiman.bmp")
ElseIf m_man = 2 And m_xingbie = 1 Then
Command4(n).Picture = LoadPicture(App.Path + "\bmp\nvweiman.bmp")
Else
Command4(n).Picture = LoadPicture(App.Path + "\bmp\kong.bmp")
End If
Command4(n).Visible = True
Command4(n).Caption = myrs("nam")
myrs.MoveNext
Next
End Sub
'设置房间为清扫房
Private Sub SetQingsao()
Dim str As String
str = "select * from house where nam='" & m_name & "'"
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
myrs.MoveFirst
If myrs("weixiu") = 1 Then
MsgBox "请先将该房间设为正常客房!", vbExclamation
ElseIf myrs("zhu") = 0 Then
str = "update house set qingsao='1' where nam='" & m_name & "'"
myCon.Execute (str)
MsgBox "该房间成功设为清扫房!", vbExclamation
Call LoadHouse
Else
MsgBox "该房间有人入住,不能清扫!", vbExclamation
End If
End Sub
'设置房间为清扫完毕
Private Sub SetSaoWan()
Dim str As String
str = "select * from house where nam='" & m_name & "'"
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
myrs.MoveFirst
If myrs("weixiu") = 1 Then
MsgBox "请先将房间设为正常客房!", vbExclamation
ElseIf myrs("qingsao") = 1 Then
str = "update house set qingsao='0' where nam='" & m_name & "'"
myCon.Execute (str)
MsgBox "该房间清扫完毕!", vbExclamation
Call LoadHouse
ElseIf myrs("qingsao") = 0 Then
MsgBox "请先设置房间为清扫房!", vbExclamation
Else
MsgBox "该房间有人入住,不能执行!", vbExclamation
End If
End Sub
'设置房间为维修房
Private Sub SetWeixiu()
Dim str As String
str = "select * from house where nam='" & m_name & "'"
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
myrs.MoveFirst
If myrs("qingsao") = 1 Then
MsgBox "请先将该房间设为正常客房!", vbExclamation
ElseIf myrs("zhu") = 0 Then
str = "update house set weixiu='1' where nam='" & m_name & "'"
myCon.Execute (str)
MsgBox "该房间成功设为维修房!", vbExclamation
Call LoadHouse
Else
MsgBox "该房间有人入住,不能维修!", vbExclamation
End If
End Sub
'设置房间为维修完毕
Private Sub SetXiuwan()
Dim str As String
str = "select * from house where nam='" & m_name & "'"
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
myrs.MoveFirst
If myrs("qingsao") = 1 Then
MsgBox "请先还原该房间为正常客房!", vbExclamation
ElseIf myrs("weixiu") = 1 Then
str = "update house set weixiu='0' where nam='" & m_name & "'"
myCon.Execute (str)
MsgBox "该房间维修完毕!", vbExclamation
Call LoadHouse
ElseIf myrs("weixiu") = 0 Then
MsgBox "请先设置房间为维修房", vbExclamation
Else
MsgBox "该房间有人入住,不能执行!", vbExclamation
End If
End Sub
Private Sub mnu_setjinghao_Click()
Call SetSaoWan
End Sub
Private Sub mnu_setsao_Click()
Call SetQingsao
End Sub
Private Sub mnu_setweihao_Click()
Call SetXiuwan
End Sub
Private Sub mnu_setxiu_Click()
Call SetWeixiu
End Sub
Private Sub mnu_show1_Click()
Frame5.Visible = False
Frame4.Visible = True
End Sub
Private Sub mnu_show2_Click()
End Sub
Private Sub mnu_showbtn_Click()
Frame5.Visible = False
Frame4.Visible = True
End Sub
Private Sub mnu_xiangxi_Click()
Frame4.Visible = False
Frame5.Visible = True
Call LoadsHouse
End Sub
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu mnu_qiehuan
End If
End Sub
Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
PopupMenu mnu_qiehuan2
End Sub
Private Sub showall_Click()
Frame4.Visible = False
Frame5.Visible = True
Call LoadsHouse
End Sub
'加载房间信息
Private Sub LoadsHouse()
Dim m_sum As Integer
m_sum = MSFlexGrid1.Rows - 1
Dim n As Integer
For n = m_sum To 2 Step -1
MSFlexGrid1.RemoveItem (n)
Next
Dim str As String
str = "select * from house order by nam"
Dim myrs As ADODB.Recordset
Set myrs = New ADODB.Recordset
myrs.CursorLocation = adUseClient
myrs.LockType = adLockOptimistic
myrs.CursorType = adOpenDynamic
myrs.Open str, myCon
Dim m_row As Integer
m_row = myrs.RecordCount
If m_row <> 0 Then
MSFlexGrid1.Rows = MSFlexGrid1.Rows + m_row - 1
Dim m As Integer
For m = 1 To m_row
MSFlexGrid1.TextMatrix(m, 0) = myrs("nam")
MSFlexGrid1.TextMatrix(m, 1) = myrs("chuang")
If myrs("ding") = 1 Then
MSFlexGrid1.TextMatrix(m, 2) = 0
Else
MSFlexGrid1.TextMatrix(m, 2) = myrs("zhu")
End If
If myrs("ding") = 1 Then
MSFlexGrid1.TextMatrix(m, 3) = "预订"
ElseIf myrs("weixiu") = 1 Then
MSFlexGrid1.TextMatrix(m, 3) = "维修"
ElseIf myrs("qingsao") = 1 Then
MSFlexGrid1.TextMatrix(m, 3) = "清扫"
ElseIf myrs("kong") = 0 Then
MSFlexGrid1.TextMatrix(m, 3) = "空闲"
ElseIf myrs("man") = 1 Then
MSFlexGrid1.TextMatrix(m, 3) = "客满"
Else
MSFlexGrid1.TextMatrix(m, 3) = "未满"
End If
myrs.MoveNext
Next
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -