📄 reserve.frm
字号:
BeginProperty Column05
ColumnWidth = 2085.166
EndProperty
BeginProperty Column06
ColumnWidth = 2085.166
EndProperty
BeginProperty Column07
ColumnWidth = 2085.166
EndProperty
BeginProperty Column08
ColumnWidth = 2085.166
EndProperty
BeginProperty Column09
ColumnWidth = 2085.166
EndProperty
BeginProperty Column10
ColumnWidth = 2085.166
EndProperty
EndProperty
End
Begin MSDataGridLib.DataGrid DataGrid2
Bindings = "Reserve.frx":0ADE
Height = 3015
Left = 0
TabIndex = 34
Top = 1320
Width = 9135
_ExtentX = 16113
_ExtentY = 5318
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "离店时间"
Height = 180
Left = 4680
TabIndex = 28
Top = 4440
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "客房编号"
Height = 180
Left = 7440
TabIndex = 27
Top = 4440
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "客房价格"
Height = 180
Left = 360
TabIndex = 26
Top = 5160
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "联系电话"
Height = 180
Left = 6120
TabIndex = 25
Top = 4440
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "预定单号"
Height = 180
Left = 360
TabIndex = 24
Top = 4440
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "客房类型"
Height = 180
Left = 1800
TabIndex = 23
Top = 4440
Width = 720
End
Begin VB.Label Label6
Caption = "抵店时间"
Height = 255
Left = 3240
TabIndex = 22
Top = 4440
Width = 735
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "身份证号"
Height = 180
Left = 1800
TabIndex = 21
Top = 5160
Width = 720
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "预收款"
Height = 180
Left = 3360
TabIndex = 20
Top = 5160
Width = 540
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "预定人"
Height = 180
Left = 4680
TabIndex = 19
Top = 5160
Width = 540
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "业务员"
Height = 180
Left = 6120
TabIndex = 18
Top = 5160
Width = 540
End
End
Attribute VB_Name = "Reserve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub LoadData()
Dim str As String, str1 As String, flag%, mark%
If Len(Trim(Text1.Text)) = 0 Then '无预定单号
If Len(Trim(Text2.Text)) = 0 Then '无预定人
flag = 0
Else '匹配预定人
flag = 1: str1 = Text2.Text: mark = 2
End If
Else '匹配预定单号
flag = 1: str = Text1.Text: mark = 1
If Len(Trim(Text2.Text)) <> 0 Then '匹配预定单号和预定人
flag = 2: str1 = Text2.Text: mark = 2
End If
End If
'根据查询条件重新填充DataGrid
If flag = 0 Then
OpenTable Adodc1, "select * from 预定单 "
ElseIf flag = 1 And mark = 1 Then
OpenTable Adodc1, "select * from 预定单 " + "where " + " 预定单号 " + " like '" + str + "%'"
ElseIf flag = 1 And mark = 2 Then
OpenTable Adodc1, "select * from 预定单 " + "where " + " 预定人 " + " like '" + str1 + "%'"
ElseIf flag = 2 And mark = 2 Then
OpenTable Adodc1, "select * from 预定单 " + "where " + " 预定单号 " + " like '" + str + "%'" + " and " + " 预定人 " + " like '" + str1 + "%'"
End If
End Sub
Private Sub Money_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub Number_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 88 Then
KeyAscii = 0
End If
End Sub
Private Sub Operation_KeyPress(KeyAscii As Integer)
If KeyAscii > 0 And (KeyAscii < 65 Or KeyAscii > 90) And (KeyAscii < 97 Or KeyAscii > 122) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub People_KeyPress(KeyAscii As Integer)
If KeyAscii > 0 And (KeyAscii < 65 Or KeyAscii > 90) And (KeyAscii < 97 Or KeyAscii > 122) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub Phone_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub RoomType_LostFocus()
Dim str As String
str = RoomType.Text
OpenTable Adodc4, "select * from 客房类型信息 where 客房类型='" + str + "'"
If Not Adodc4.Recordset.EOF Then
Price.Text = Adodc4.Recordset.Fields(2)
End If
End Sub
Private Sub Search_Click()
LoadData
End Sub
Private Sub Select_Click()
Adodc1.Recordset.Update
Dim rs As Recordset
Set rs = Adodc1.Recordset
Reside.Id.Text = rs(0)
Reside.RoomType.Text = Me.RoomType.Text
Reside.Arrive = Date
Reside.Ltime.Text = Me.Ltime.Text
Reside.Phone.Text = Me.Phone.Text
Reside.RoomCode.Text = Me.RoomCode.Text
Reside.Price.Text = Me.Price.Text
Reside.Number.Text = Me.Number.Text
Reside.Money.Text = Me.Money.Text
Reside.People.Text = Me.People.Text
Reside.Operation.Text = Me.Operation.Text
biaozhi = True
Unload Me
End Sub
Private Sub SelectRoom_Click()
If Trim(RoomType.Text) = "" Then
fla = False
Else
fla = True
strRoomState = RoomType.Text
End If
RoomState.Set.Enabled = False
RoomState.SelectReside.Visible = False
RoomState.SelectReserve.Visible = True
RoomState.SelectReside.Enabled = False
RoomState.SelectReserve.Enabled = True
RoomState.Show vbModal
End Sub
Private Sub Form_Load()
LoadData
Calendar1.Value = Date
Calendar2.Value = Date
SetTextBoxState (False)
ListId.Enabled = False
RoomCode.Enabled = False
Price.Enabled = False
End Sub
Private Sub SetToolBarState(ByVal State As Boolean)
'设置Button的是否能够单击
Toolbar1.Buttons("first").Enabled = State
Toolbar1.Buttons("before").Enabled = State
Toolbar1.Buttons("next").Enabled = State
Toolbar1.Buttons("last").Enabled = State
Toolbar1.Buttons("new").Enabled = State
Toolbar1.Buttons("modify").Enabled = State
Toolbar1.Buttons("delete").Enabled = State
Toolbar1.Buttons("save").Enabled = Not State
Toolbar1.Buttons("cancel").Enabled = Not State
End Sub
Private Sub SetTextBoxState(ByVal State As Boolean)
RoomType.Enabled = State
Arrive.Enabled = State
Ltime.Enabled = State
Phone.Enabled = State
Number.Enabled = State
Money.Enabled = State
People.Enabled = State
Operation.Enabled = State
DataGrid1.Enabled = Not State
SelectRoom.Enabled = State
End Sub
Private Sub Clear()
Dim strT As String, strID As String
OpenTable Adodc3, "select max(预定单号) from 预定单 "
If Not IsNull(Adodc3.Recordset.Fields(0)) Then
strT = ""
strID = Trim(str(Int(Mid(Adodc3.Recordset(0), 3, 4) + 1)))
For i = Len(strID) To 3
strT = strT & "0"
Next i
ListId = "YD" & strT & strID
Else: ListId = "YD0001"
End If
RoomType.Text = ""
Phone.Text = ""
RoomCode.Text = ""
Price.Text = ""
Number.Text = ""
Money.Text = ""
People.Text = ""
Operation.Text = ""
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If StrComp(Button.Key, "first") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
ElseIf StrComp(Button.Key, "before") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
End If
ElseIf StrComp(Button.Key, "next") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
End If
ElseIf StrComp(Button.Key, "last") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
ElseIf StrComp(Button.Key, "new") = 0 Then
Adodc1.Recordset.AddNew
SetTextBoxState (True)
SetToolBarState (False)
Clear
ElseIf StrComp(Button.Key, "modify") = 0 Then
SetTextBoxState (True)
SetToolBarState (False)
ElseIf StrComp(Button.Key, "delete") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
If MsgBox("确定要删除吗?", vbYesNo, "提示") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
Else
MsgBox "当前无记录!", 64, "提示"
End If
ElseIf StrComp(Button.Key, "save") = 0 Then
If RoomType = "" Then
MsgBox "客房类型不能为空", , "提示"
ElseIf Arrive = "" Or Arrive < Date Then MsgBox "抵店时间错误", , "提示"
ElseIf Ltime = "" Or Ltime < Arrive Then MsgBox "离店时间错误", , "提示"
ElseIf Phone = "" Then MsgBox "联系电话不能为空", , "提示"
ElseIf RoomCode = "" Then MsgBox "客房未选择", , "提示"
ElseIf Number = "" Then MsgBox "身份证号不能为空", , "提示"
ElseIf Money = "" Then MsgBox "预收款未填", , "提示"
ElseIf People = "" Then MsgBox "预定人不能为空", , "提示"
ElseIf Operation = "" Then MsgBox "业务员不能为空", , "提示"
Else
SetTextBoxState (False)
SetToolBarState (True)
Adodc1.Recordset.Update
OpenTable Adodc5, "select * from 客房信息 " + " where " + " 客房编号 " + " = '" + RoomCode + " '"
Adodc5.Recordset(4) = "将到"
Adodc5.Recordset.Update
End If
ElseIf StrComp(Button.Key, "cancel") = 0 Then
SetTextBoxState (False)
SetToolBarState (True)
Form_Load
ElseIf StrComp(Button.Key, "exit") = 0 Then
LoadData
Unload Me
End If
End Sub
Private Sub Arrive_Click()
Calendar1.Visible = True
End Sub
Private Sub Ltime_Click()
Calendar2.Visible = True
End Sub
Private Sub Calendar1_Click()
Arrive.Text = Calendar1.Value
Calendar1.Visible = False
End Sub
Private Sub Calendar2_Click()
Ltime.Text = Calendar2.Value
Calendar2.Visible = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -