📄 frm客房登记.frm
字号:
Left = 240
TabIndex = 8
Top = 1320
Width = 1335
End
Begin VB.Label Label3
BackColor = &H80000013&
Caption = "客房标准:"
Height = 255
Left = 240
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.Label Label2
BackColor = &H80000013&
Caption = "客房编号:"
Height = 255
Left = 240
TabIndex = 6
Top = 360
Width = 1335
End
End
Begin VB.Frame Frame1
BackColor = &H80000013&
Caption = "房间状态"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3015
Left = 240
TabIndex = 1
Top = 240
Width = 8415
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frm客房登记.frx":122C
Height = 2055
Left = 120
TabIndex = 4
Top = 840
Width = 8175
_ExtentX = 14420
_ExtentY = 3625
_Version = 393216
BackColor = 65280
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
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
Caption = "客房信息"
ColumnCount = 6
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
BeginProperty Column02
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 Column03
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 Column04
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 Column05
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
ColumnWidth = 1154.835
EndProperty
BeginProperty Column01
ColumnWidth = 1305.071
EndProperty
BeginProperty Column02
ColumnWidth = 1335.118
EndProperty
BeginProperty Column03
ColumnWidth = 1349.858
EndProperty
BeginProperty Column04
ColumnWidth = 1260.284
EndProperty
BeginProperty Column05
ColumnWidth = 1379.906
EndProperty
EndProperty
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2520
Style = 2 'Dropdown List
TabIndex = 3
Top = 360
Width = 1695
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "请选择标准名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 2
Top = 480
Width = 1815
End
End
End
End
Attribute VB_Name = "frm客房登记"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open Adodc1.ConnectionString
If Combo1.Text = "" Then
MsgBox "请选择房间标准!!!"
ElseIf Combo1.Text = "所有" Then
rs.Open "select * from 客房信息表 where 是否被预定= '否' and 房间状态 = '空房'", cn, 1, 3
Set DataGrid1.DataSource = rs
Else
rs.Open "select * from 客房信息表 where 客房标准 = '" & Combo1.Text & "' and 是否被预定= '否' and 房间状态 = '空房'", cn, 1, 3
If rs.EOF Then
Set DataGrid1.DataSource = Nothing
DataGrid1.Refresh
Else
Set DataGrid1.DataSource = rs
End If
End If
End Sub
Private Sub Command1_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
cn.Open frm登录.Adodc1.ConnectionString
If Text(0) = "" Or Text(1) = "" Or Text(2) = "" Or Text(3) = "" Or Text(4) = "" Or Text(5) = "" Then
MsgBox "请选择要登记的房间编号!!!"
Else
rs.Open "select * from 顾客登记表", cn, 1, 3
If Text(6) = "" Then
MsgBox "顾客姓名不能为空,请重新输入顾客姓名!!!"
Text(6).SetFocus
ElseIf Combo2.Text = "" Then
MsgBox "请选择顾客的证件类型!!!"
Combo2.SetFocus
ElseIf Text(7) = "" Then
MsgBox "证件号码不能为空,请重新选择证件号码!!!"
Text(7).SetFocus
ElseIf Text(9) = "" Then
MsgBox "登记房间要交押金!!!"
Text(9).SetFocus
ElseIf Text(10) = "" Then
MsgBox "请输入折扣比例!!!"
Text(10).SetFocus
Else
rs.AddNew
Dim i As Integer
For i = 0 To 6
rs.Fields(i) = Text(i)
Next i
rs.Fields(7) = Combo2.Text
rs.Fields(8) = Text(7)
rs.Fields(9) = Text(8)
rs.Fields(10) = Text(9)
rs.Fields(11) = Text(10)
If Text(11) = "" Then
rs.Fields(12) = "无"
Else
rs.Fields(12) = Text(11)
End If
rs.Update
MsgBox "登记成功!!!"
For i = 1 To 11
Text(i) = ""
Next i
rs1.Open "select * from 客房信息表 where 客房编号 = '" & Text(0).Text & "'", cn, 1, 3
rs1.Fields(11) = "入住"
rs1.Update
rs1.Close
rs2.Open "select * from 客房信息表 where 是否被预定= '否' and 房间状态 = '空房'", cn, 1, 3
Set DataGrid1.DataSource = rs2
DataGrid1.Refresh
End If
End If
End Sub
Private Sub Command2_Click()
Dim i As Integer
i = MsgBox("是否确认退出?", vbYesNo, "提示")
If i = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Load()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open frm登录.Adodc1.ConnectionString
Combo1.AddItem ("所有")
rs.Open "select * from 客房标准信息表", cn, 1, 3
While Not rs.EOF
Combo1.AddItem (rs.Fields(1))
rs.MoveNext
Wend
End Sub
Private Sub DataGrid1_Click()
Dim j As Integer
For j = 0 To 5
Text(j) = DataGrid1.Columns(j)
Text(j).Enabled = False
Next j
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
DataGrid1_Click
End Sub
Private Sub Timer1_Timer()
Text(8) = Format(Now, "yyyy-m-dd hh:mm:ss AM/PM")
Text(8).Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -