📄 frmtuantiyuding.frm
字号:
If Not mrc.EOF Then
cboItem(0).Clear
Do While Not mrc.EOF
cboItem(0).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
restrooms = mrc.RecordCount
mrc.Close
End If
Case 3
If Option1(4).Value Then
txtSQL = "select * from rooms where roomprice='" & cboItem(3).Text & "'and putup<>'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
cboItem(0).Clear
Do While Not mrc.EOF
cboItem(0).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
restrooms = mrc.RecordCount
mrc.Close
End If
End Select
End Sub
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMsg As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
For intCount = 1 To 8
If Trim(Text1(intCount)) = "" Then
Select Case intCount
Case 1
sMsg = "团体人数"
Case 2
sMsg = "负责人姓名"
Case 3
sMsg = "负责人身份证号"
Case 4
sMsg = "入住日期"
Case 5
sMsg = "折扣"
Case 6
sMsg = "预收款"
Case 7
sMsg = "预定时间"
Case 8
sMsg = "预定天数"
End Select
sMsg = sMsg & "不能为空"
MsgBox sMsg, vbOKOnly + vbExclamation, "警告"
Text1(intCount).SetFocus
End If
Next
If Not (Len(Text1(3)) = 15 Or Len(Text1(3)) = 18) Then
MsgBox "身份证号必为15或18位"
Exit Sub
End If
If DateSerial(Text1(4).Text, Text3.Text, Text6.Text) < Date Then
MsgBox "预定入住时间必须大于今天!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = "select * from bookin "
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.AddNew
'bookno
mrc!bookno = txtNo
'customname
mrc!customname = Text1(2)
'customID
mrc!customID = Text1(3)
'roomno
mrc!roomno = cboItem(0)
'indate
mrc!indate = DateSerial(Text1(4).Text, Text3.Text, Text6.Text)
'discount
mrc!discount = Text1(5)
'inmemo
mrc!inmemo = Text5
'checkdate
'mrc.Fields(7) = ""
'ammount
mrc!amMount = 0
'bgroup
mrc!bgroup = "y"
'prinID
mrc!prinID = Text1(3)
mrc!dymoney = Text1(6)
mrc!tianshu = Text1(8)
mrc!ydtime = Date
mrc.Update
mrc.Close
txtSQL = "select * from rooms where roomNO='" & cboItem(0) & "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
mrc!putup = "y"
End If
mrc.Update
mrc.Close
''the other guy
For intCount = 1 To Val(Text1(1)) - 1
txtSQL = "select * from bookin "
Set mrc = ExecuteSQL(txtSQL, msgtext)
mrc.AddNew
'bookno
mrc!bookno = 0
'customname
mrc!customname = Text1(2) & "_group"
'customID
mrc!customID = 0
'roomno
mrc!roomno = cboItem(0).List(intCount)
'indate
mrc!indate = DateSerial(Text1(4).Text, Text3, Text6)
'discount
mrc!discount = Text1(5)
'inmemo
mrc!inmemo = cboItem(0)
'checkdate
'mrc.Fields(7) = ""
'ammount
mrc!amMount = 0
'bgroup
mrc!bgroup = "y"
'prinID
mrc!prinID = Text1(3)
mrc!dymoney = 0
mrc!tianshu = Text1(8)
mrc!ydtime = Date
mrc.Update
mrc.Close
txtSQL = "select * from rooms where roomNO='" & cboItem(0).List(intCount) & "'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
mrc!putup = "y"
mrc.Update
mrc.Close
End If
Next
If gintBmode = 1 Then
MsgBox "添加团体订房信息成功!", vbOKOnly + vbExclamation, "添加团体订房消息"
Unload Me
If flagBedit Then
Unload frmBookin
End If
frmGroupBook.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo prinID,dymoney from bookin where ammount = '0'"
Else
MsgBox "修改订房信息成功!", vbOKOnly + vbExclamation, "修改订房消息"
Unload Me
If flagBedit Then
Unload frmBookin
End If
frmGroupBook.txtSQL = "select bookno,customname,customID,roomno,indate,discount,inmemo,prinID,dymoney from bookin where ammount = '0'"
End If
End Sub
Private Sub command1_click()
Dim intCount As Integer
If Val(restrooms) >= Val(Text1(1)) Then
Text4 = ""
For intCount = cboItem(0).ListIndex To cboItem(0).ListIndex + Val(Text1(1)) - 1
Text4 = Text4 & cboItem(0).List(intCount) & ";"
Next
End If
End Sub
Private Sub command3_click()
If mblChange And cmdsave.Enabled Then
If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
'保存
Call cmdSave_Click
End If
End If
Unload Me
End Sub
Private Sub Form_Load()
Dim sSql As String
Dim intCount As Integer
Dim msgtext As String
Text1(7) = Date
If flagSedit Then
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
For intCount = 1 To 3
cboItem(intCount).Clear
cboItem(intCount).AddItem mrc.Fields(intCount)
cboItem(intCount).ListIndex = 0
Next intCount
End If
txtNo = GetRkno()
gintBmode = 1
Else
If gintBmode = 1 Then
Me.Caption = Me.Caption & "添加"
txtSQL = "select DISTINCT roomNO from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cboItem(0).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
Else
MsgBox "请先进行客房登记!", vbOKOnly + vbExclamation, "警告"
cmdsave.Enabled = False
Exit Sub
End If
restrooms = mrc.RecordCount
mrc.Close
txtNo = GetRkno
txtSQL = "select DISTINCT roomtype from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cboItem(1).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
txtSQL = "select DISTINCT roomposition from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cboItem(2).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
txtSQL = "select DISTINCT roomprice from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cboItem(3).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
ElseIf gintBmode = 2 Then
txtSQL = "select * from bookin "
Set mrc = ExecuteSQL(txtSQL, msgtext)
If mrc.EOF = False Then
mrc.AddNew
'bookno
txtNo = mrc.Fields(0)
'customname
Text1(2) = mrc.Fields(1)
'customID
Text1(3) = mrc.Fields(2)
'roomno
Text4.Text = mrc.Fields(3)
'indate
Text1(4) = mrc.Fields(4)
'discount
Text1(5) = mrc.Fields(5)
'inmeno
Text2 = mrc.Fields(6)
'checkdate
'prinID
Text1(3) = mrc.Fields(10)
End If
'mrc.Close
Me.Caption = Me.Caption & "修改"
txtSQL = "select * from rooms where roomNO='" & cboItem(0).Text & "'and putup<>'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
For intCount = 1 To 3
cboItem(intCount).Clear
cboItem(intCount).AddItem mrc.Fields(intCount)
cboItem(intCount).ListIndex = 0
Next intCount
End If
mrc.Close
End If
End If
mblChange = False
End Sub
Private Function GetRkno() As String
GetRkno = Format(Now, "yy-mm-dd")
Randomize
GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
End Function
Private Sub Option1_Click(Index As Integer)
Dim mrc As ADODB.Recordset
'Dim intCount As Integer
Dim msgtext As String
''
Select Case Index
Case 1
txtSQL = "select DISTINCT roomNO from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
cboItem(0).Clear
Do While Not mrc.EOF
cboItem(0).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
restrooms = mrc.RecordCount
mrc.Close
Case 2
txtSQL = "select DISTINCT roomtype from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
cboItem(1).Clear
Do While Not mrc.EOF
cboItem(1).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
Case 3
txtSQL = "select DISTINCT roomposition from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
cboItem(2).Clear
Do While Not mrc.EOF
cboItem(2).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
Case 3
txtSQL = "select DISTINCT roomprice from rooms where putup <> 'y'"
Set mrc = ExecuteSQL(txtSQL, msgtext)
If Not mrc.EOF Then
cboItem(3).Clear
Do While Not mrc.EOF
cboItem(3).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
End If
mrc.Close
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -