?? 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 + -