📄 main_kfyd.frm
字号:
Width = 1065
End
Begin VB.Label Lab3
BackStyle = 0 'Transparent
Caption = "详细地址"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 345
TabIndex = 8
Top = 2025
Width = 1350
End
Begin VB.Label Lab2
BackStyle = 0 'Transparent
Caption = "联系电话"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 345
TabIndex = 7
Top = 1500
Width = 1065
End
Begin VB.Label Lab1
BackStyle = 0 'Transparent
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 495
TabIndex = 6
Top = 1005
Width = 855
End
Begin VB.Image Image1
Height = 4710
Left = -15
Picture = "main_kfyd.frx":84477
Stretch = -1 'True
Top = 0
Width = 9660
End
End
Attribute VB_Name = "main_kfyd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
Data2.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Activate()
'筛选房间类型
Data2.RecordSource = "select 房间类型 from kf group by 房间类型"
Data2.Refresh
DTP1.Value = Date
czy.Text = main.StatusBar1.Panels(4).Text
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texts.SetFocus
If KeyCode = vbKeyRight Then Texts.SetFocus
If KeyCode = vbKeyUp Then DTP1.SetFocus
If KeyCode = vbKeyLeft Then DTP1.SetFocus
End Sub
Private Sub texxm_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then combo1.SetFocus
If KeyCode = vbKeyRight Then combo1.SetFocus
End Sub
Private Sub texsfz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texdh.SetFocus
If KeyCode = vbKeyRight Then Texdh.SetFocus
If KeyCode = vbKeyUp Then Texxm.SetFocus
If KeyCode = vbKeyLeft Then Texxm.SetFocus
End Sub
Private Sub texdh_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texdz.SetFocus
If KeyCode = vbKeyUp Then Texsfz.SetFocus
End Sub
Private Sub texdz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texdw.SetFocus
If KeyCode = vbKeyUp Then Texdh.SetFocus
End Sub
Private Sub texdw_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DBCombo1.SetFocus
If KeyCode = vbKeyUp Then Texdz.SetFocus
End Sub
Private Sub texje_Change()
Texje.Text = Val(Texje.Text)
End Sub
Private Sub texts_Change()
Texts.Text = Val(Texts.Text)
Texje.Text = Val(Texts.Text) * Val(DBCombo2.Text) '计算预付金额
End Sub
Private Sub texts_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Comok.SetFocus
If KeyCode = vbKeyUp Then DBCombo2.SetFocus
If KeyCode = vbKeyLeft Then DTP1.SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texsfz.SetFocus
If KeyCode = vbKeyRight Then Texsfz.SetFocus
End Sub
Private Sub DBCombo1_Change()
If DBCombo1.Text <> "" Then
'查询客房信息
Data1.RecordSource = "select * from kf where kf.房间类型 like " + Chr(34) + DBCombo1.Text + Chr(34) + ""
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then
DBCombo1.Text = Data1.Recordset.Fields("房间类型")
DBCombo2.Text = Data1.Recordset.Fields("价格")
Else
MsgBox ("无此房间!")
End If
End If
End Sub
Private Sub DBCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DBCombo2.SetFocus
End Sub
Private Sub DBCOMBO2_Change()
DBCombo2.Text = Val(DBCombo2.Text)
End Sub
Private Sub DBCOMBO2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTP1.SetFocus
If KeyCode = vbKeyRight Then DTP1.SetFocus
If KeyCode = vbKeyUp Then DBCombo1.SetFocus
If KeyCode = vbKeyLeft Then DBCombo1.SetFocus
End Sub
Private Sub comok_Click()
If Texxm.Text <> "" And Texsfz.Text <> "" And Texts.Text <> "" Then
Dim mydb1 As Database
Dim myrs1 As Recordset
Dim myrs2 As Recordset
Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\KFGL.MDB")
Set myrs1 = mydb1.OpenRecordset("kfyd", dbOpenTable)
'添加客房预定信息
myrs1.AddNew
If Texxm.Text <> "" Then myrs1.Fields("姓名") = Texxm.Text
myrs1.Fields("证件名称") = combo1.Text
If Texsfz.Text <> "" Then myrs1.Fields("身份证号") = Texsfz.Text
If Texdh.Text <> "" Then myrs1.Fields("联系电话") = Texdh.Text
If Texdz.Text <> "" Then myrs1.Fields("详细地址") = Texdz.Text
If Texdw.Text <> "" Then myrs1.Fields("工作单位") = Texdw.Text
If DBCombo1.Text <> "" Then myrs1.Fields("客房类型") = DBCombo1.Text
If DBCombo2.Text <> "" Then myrs1.Fields("房间价格") = Val(DBCombo2.Text)
If DTP1.Value <> "" Then myrs1.Fields("预住日期") = DTP1.Value
If Texts.Text <> "" Then myrs1.Fields("预住天数") = Val(Texts.Text)
If Texje.Text <> "" Then myrs1.Fields("预付金额") = Val(Texje.Text)
'更新数据库
myrs1.Update
Texxm.Enabled = False
Texsfz.Enabled = False
Texdh.Enabled = False
Texdz.Enabled = False
Texdw.Enabled = False
Texje.Enabled = False
Texts.Enabled = False
DBCombo1.Enabled = False
DBCombo2.Enabled = False
Comok.Enabled = False
Comprint.Enabled = True
Else
MsgBox ("姓名和身份证号必须填写!!!")
End If
End Sub
Private Sub comcancel_Click()
'取消操作
Texxm.Enabled = True
Texsfz.Enabled = True
Texdh.Enabled = True
Texdz.Enabled = True
Texdw.Enabled = True
Texje.Enabled = True
Texts.Enabled = True
DBCombo1.Enabled = True
DBCombo2.Enabled = True
Texxm.Text = ""
Texsfz.Text = ""
Texdh.Text = ""
Texdz.Text = ""
Texdw.Text = ""
Texje.Text = ""
Texts.Text = ""
DBCombo1.Text = ""
DBCombo2.Text = ""
Comok.Enabled = True
End Sub
Private Sub comprint_Click()
'打印客房预定信息
Printer.Height = 6000
Printer.Width = 4000
Printer.CurrentX = 850
Printer.CurrentY = 300
Printer.FontSize = 12
Printer.Print " 龙海宾馆(客房预定单) "
Dim A, B, C, D As Integer
A = 100
B = 500
C = 3800
D = 400
Printer.FontSize = 10
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "姓名:" & Texxm.Text & " " & combo1.Text & ":" & Texsfz.Text
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "工作单位: " & Texdw.Text
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "房间类型:" & DBCombo1.Text & " " & " 房价:" & Format(DBCombo2.Text, "0.00")
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "预住日期:" & Left(DTP1.Value, 10) & " 住宿天数: " & Texts.Text & "天"
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "预付金额: " & Format(Texje.Text, "0.00")
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "操作员: "
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print Date & " " & Time
Printer.EndDoc
End Sub
Private Sub comend_Click()
main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -