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