?? main_zjyj.frm
字號:
TabIndex = 20
Top = 1455
Width = 1455
_ExtentX = 2566
_ExtentY = 476
_Version = 393216
Enabled = 0 'False
Format = 30015490
CurrentDate = 37203
End
Begin MSComCtl2.DTPicker DTP2
Height = 300
Left = 4110
TabIndex = 28
Top = 1050
Width = 1410
_ExtentX = 2487
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 30015489
CurrentDate = 37207
End
Begin MSComCtl2.DTPicker DTP1
Height = 300
Left = 1380
TabIndex = 29
Top = 1050
Width = 1410
_ExtentX = 2487
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 30015489
CurrentDate = 37203
End
Begin MSComCtl2.DTPicker DTP3
Height = 300
Left = 6825
TabIndex = 30
Top = 1050
Width = 1410
_ExtentX = 2487
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 30015489
CurrentDate = 37207
End
Begin VB.Label Lab6
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 = 225
TabIndex = 18
Top = 1080
Width = 6780
End
Begin VB.Label Lab7
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 = 240
TabIndex = 17
Top = 1455
Width = 6525
End
Begin VB.Label Lab4
BackStyle = 0 'Transparent
Caption = "姓 名 已交押金 住宿天數"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 270
TabIndex = 12
Top = 285
Width = 8025
End
Begin VB.Label Lab5
BackStyle = 0 'Transparent
Caption = "房間號碼 房間類型 房間價格"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 210
TabIndex = 11
Top = 690
Width = 6585
End
End
Begin VB.Label Lab8
BackStyle = 0 'Transparent
Caption = "操作員:"
Height = 240
Left = 195
TabIndex = 7
Top = 4185
Width = 735
End
Begin VB.Label Lab0
BackColor = &H00808000&
Caption = " 追加押金"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 390
Left = 3330
TabIndex = 5
Top = 165
Width = 2190
End
End
Attribute VB_Name = "main_zjyj"
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"
Data3.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Activate()
czy.Text = main.StatusBar1.Panels(4).Text '賦值給czy.text
'查詢住宿登記信息
Data2.RecordSource = "select 憑證號碼 from djb where 標志='1'order by 憑證號碼"
Data2.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True '設置主窗體有效
End Sub
Private Sub DBCombo1_Change()
'查詢住宿登記信息
Data1.RecordSource = "select * from djb where 憑證號碼='" & DBCombo1.Text & "'"
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then '當記錄大于零時賦值給text2等
If Data1.Recordset.Fields("姓名") <> "" Then Text2.Text = Data1.Recordset.Fields("姓名")
If Data1.Recordset.Fields("預收金額") <> "" Then Text3.Text = Data1.Recordset.Fields("預收金額")
If Data1.Recordset.Fields("住宿天數") <> "" Then Text4.Text = Data1.Recordset.Fields("住宿天數")
If Data1.Recordset.Fields("房間號") <> "" Then Text5.Text = Data1.Recordset.Fields("房間號")
If Data1.Recordset.Fields("客房類型") <> "" Then Text6.Text = Data1.Recordset.Fields("客房類型")
If Data1.Recordset.Fields("客房價格") <> "" Then Text7.Text = Data1.Recordset.Fields("客房價格")
If Data1.Recordset.Fields("住宿日期") <> "" Then DTP1.Value = Data1.Recordset.Fields("住宿日期")
If Data1.Recordset.Fields("住宿時間") <> "" Then tim1.Value = Data1.Recordset.Fields("住宿時間")
If Data1.Recordset.Fields("提醒日期") <> "" Then DTP2.Value = Data1.Recordset.Fields("提醒日期")
If Data1.Recordset.Fields("提醒時間") <> "" Then tim2.Value = Data1.Recordset.Fields("提醒時間")
If Data1.Recordset.Fields("退宿日期") <> "" Then DTP3.Value = Data1.Recordset.Fields("退宿日期")
If Data1.Recordset.Fields("退宿時間") <> "" Then tim3.Value = Data1.Recordset.Fields("退宿時間")
End If
End Sub
Private Sub DBCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1.SetFocus
End Sub
Private Sub Text1_Change() '計算提醒日期及時間
DTP2.Value = DTP1.Value + Int(Val(Text3.Text) + Val(Text1.Text)) / Val(Text7.Text)
If (Val(Text3.Text) + Val(Text1.Text) - Int(Val(Text3.Text) + Val(Text1.Text))) / Val(Text7.Text) > 0.5 * Val(Text7.Text) Then
tim2.Value = #6:00:00 PM#
Else
tim2.Value = #12:00:00 AM#
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Command1.SetFocus
End Sub
Private Sub Command1_Click()
'保存追加押金信息
If Text1.Text <> "" And DBCombo1.Text <> "" Then
'查詢住宿登記信息
Data1.RecordSource = "select * from djb where 憑證號碼='" & DBCombo1.Text & "'"
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then
'編輯住宿登記信息
Data1.Recordset.Edit
Data1.Recordset.Fields("預收金額") = Val(Text3.Text) + Val(Text1.Text)
Data1.Recordset.Fields("提醒日期") = DTP2.Value
Data1.Recordset.Fields("提醒時間") = tim2.Value
Data1.Recordset.Update '更新數據
'查詢住宿登記預收信息
Data3.RecordSource = "select * from djys where 憑證號碼='" & DBCombo1.Text & "'"
Data3.Refresh
'編輯住宿登記預收信息
Data3.Recordset.Edit
Data3.Recordset.Fields("預收金額") = Val(Text3.Text) + Val(Text1.Text)
Data3.Recordset.Fields("提醒日期") = DTP2.Value
Data3.Recordset.Fields("提醒時間") = tim2.Value
Data3.Recordset.Update '更新數據
Data3.Refresh
'設置控件有效或無效
Command1.Enabled = False: Command2.Enabled = False: Command4.Enabled = True
Command5.Enabled = True: Command3.Enabled = True
Command5.SetFocus 'command5獲得焦點
Else
MsgBox ("請檢查憑證號碼是否有效,再保存!")
End If
Else
MsgBox ("請填寫完整的數據,再保存!")
End If
End Sub
Private Sub Command2_Click() '取消操作
DBCombo1.Enabled = False: Command1.Enabled = False: Command2.Enabled = False
Command4.Enabled = False: Command5.Enabled = True: Command3.Enabled = True
'清空數據
Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = "":
Text5.Text = "": Text6.Text = "": Text7.Text = ""
'初始化日期
DTP1.Value = Date: DTP2.Value = Date: DTP3.Value = Date
End Sub
Private Sub Command3_Click()
Unload Me
main.Enabled = True '設置主窗體有效
End Sub
Private Sub Command4_Click() '打印追加押金單據
Printer.Height = 8000: Printer.Width = 8000
Printer.CurrentX = 1100: Printer.CurrentY = 300
Printer.FontSize = 12
Printer.Print "龍海賓館 (追加押金) "
Dim A, B, C, D As Integer
A = 100: B = 500: C = 4800: D = 400
Printer.FontSize = 10
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print Date & " " & Time & " NO." & DBCombo1.Text
B = B + D
Printer.Line (A, B + 100)-(C, B + 100)
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "姓名:" & Text1.Text
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "房間號:" & Text5.Text
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "追加押金:" & Format(Text1.Text, "0.00")
B = B + D
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "補交日期: " & DTP2.Value
B = B + D
Printer.Line (A, B + 100)-(C, B + 100)
Printer.CurrentX = 100 + A
Printer.CurrentY = B + 200
Printer.Print "操作員: " & czy.Text & " 歡迎光臨"
Printer.EndDoc
End Sub
Private Sub Command5_Click() '登記
Frame1.Enabled = True: DBCombo1.Enabled = True: Command1.Enabled = True
Command2.Enabled = True: Command3.Enabled = False: Command4.Enabled = True
Command5.Enabled = False
Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = ""
Text5.Text = "": Text6.Text = "": Text7.Text = ""
DBCombo1.SetFocus 'DBCombo1獲得焦點
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -