Private Sub Form_Load()
'自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
Data2.DatabaseName = App.Path & "\KFGL.MDB"
Data3.DatabaseName = App.Path & "\KFGL.MDB"
Data4.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Activate()
czy.Text = main.StatusBar1.Panels(4).Text '赋值给czy.text
'查询住宿登记信息
Data4.RecordSource = "select * from djb where 标志='1'"
Data4.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True '设置主窗体有效
End Sub
Private Sub DBCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Texbz.SetFocus 'texbz获得焦点
End Sub
Private Sub DBCOMBO2_Change()
If DBCombo2.Text <> "" Then
Data1.Recordset.FindFirst "房间号='" & DBCombo2.Text & "'and 标志='1'"
If Data1.Recordset.NoMatch Then
MsgBox ("请核准住宿房间和住宿人!")
Else
If Data1.Recordset.Fields("客房类型") <> "" Then
With Data1.Recordset
'查询空闲房间
Data2.RecordSource = "select * from kf where 房间类型='" & .Fields("客房类型") & "'and 房态='空房'"
Data2.Refresh
'赋值给bh.text等
If .Fields("凭证号码") <> "" Then bh.Text = .Fields("凭证号码")
If .Fields("姓名") <> "" Then Texxmb.Text = .Fields("姓名")
If .Fields("证件名称") <> "" Then Combo1.Text = .Fields("证件名称")
If .Fields("证件号码") <> "" Then Texsfz.Text = .Fields("证件号码")
If .Fields("客房价格") <> "" Then Texjg.Text = .Fields("客房价格")
End With
End If
End If
DBCombo1.Enabled = True
Texbz.Enabled = True
End If
End Sub
Private Sub DBCOMBO2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DBCombo1.SetFocus '按回车键DBCombo1获得焦点
End Sub
Private Sub texbz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Comok.SetFocus '按回车键comok获得焦点
End Sub
Private Sub comdj_Click() '登记
Frame2.Enabled = True: Frame3.Enabled = True: DBCombo2.Enabled = True
DBCombo1.Enabled = True: Texjg.Enabled = True: Comok.Enabled = True
Comcancel.Enabled = True: Comok.Enabled = True: Comdj.Enabled = False
DBCombo2.SetFocus 'DBCombo2获得焦点
End Sub
Private Sub comok_Click() '确定调房
Dim bh As String '定义一个字符串类型的变量
'查询空闲房间信息
Data2.RecordSource = "select * from kf where 房间号='" & DBCombo1.Text & "'and 房态='空房'"
Data2.Refresh
If Data2.Recordset.RecordCount > 0 Then
Dim mydb1 As Database
Dim myrs2 As Recordset
Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\KFGL.MDB")
'查询所有住宿登记信息
Data1.RecordSource = "select * from djb"
Data1.Refresh
Data1.Recordset.FindFirst "房间号 ='" & DBCombo2.Text & "'and 标志='1'"
bh = Data1.Recordset.Fields("凭证号码")
Data1.Recordset.Edit '编辑住宿登记信息
If DBCombo1.Text <> "" Then Data1.Recordset.Fields("房间号") = Val(DBCombo1.Text)
If Texbz.Text <> "" Then Data1.Recordset.Fields("备注") = Texbz.Text
Data1.Recordset.Fields("标志") = "1"
Data1.Recordset.Fields("摘要") = "由源房" & DBCombo2.Text & "调到目标房" & DBCombo1.Text
Data1.Recordset.Update '更新记录
Data3.RecordSource = "select * from djys where 凭证号码='" & Data1.Recordset.Fields("凭证号码") & "'"
Data3.Refresh
If Data3.Recordset.EOF = False Then Data3.Recordset.MoveLast
If Data3.Recordset.BOF = False Then Data3.Recordset.MoveFirst
If Data3.Recordset.RecordCount > 0 Then
Data3.Recordset.MoveFirst
For i = 1 To Data3.Recordset.RecordCount
Data3.Recordset.Edit '编辑住宿登记预收信息
If DBCombo1.Text <> "" Then Data3.Recordset.Fields("房间号") = Val(DBCombo1.Text)
If Texbz.Text <> "" Then Data3.Recordset.Fields("备注") = Texbz.Text
Data3.Recordset.Fields("标志") = "1"
Data3.Recordset.Fields("摘要") = "由源房" & DBCombo2.Text & "调到目标房" & DBCombo1.Text
Data3.Recordset.Update '更新记录
If Data3.Recordset.EOF = False Then Data3.Recordset.MoveNext
Next i
End If
'编辑客房状态
Data2.Recordset.Edit
Data2.Recordset.Fields("房态") = "入住"
Data2.Recordset.Update
Data2.RecordSource = "select * from kf"
Data2.Refresh
Data2.Recordset.FindFirst "房间号 ='" & DBCombo2.Text & "'"
Data2.Recordset.Edit
Data2.Recordset.Fields("房态") = "空房"
Data2.Recordset.Update
'查询空闲房间信息
Data3.RecordSource = "select * from kf where 房态='空房'"
Data3.Refresh
Data4.Refresh
'设置控件有效或无效
Texxmb.Enabled = False: Texsfz.Enabled = False: DBCombo1.Enabled = False
DBCombo2.Enabled = False: Texbz.Enabled = False: Comok.Enabled = False
Comcancel.Enabled = False: Comdj.Enabled = True
'清空数据
DBCombo1.Text = "": DBCombo2.Text = "": Texxmb.Text = ""
Texsfz.Text = "": Texbz.Text = "": Texjg.Text = ""
Comdj.SetFocus 'Comdj获得焦点
Else
MsgBox ("所选房间已有人入住,请选择空房,再保存!!!")
End If
End Sub
Private Sub comcancel_Click() '取消操作
DBCombo2.Enabled = True: DBCombo1.Enabled = True: Comdj.Enabled = True
Comok.Enabled = False: Texbz.Enabled = True
DBCombo1.Text = "": DBCombo2.Text = "": Texxmb.Text = ""
Texsfz.Text = "": Texbz.Text = "": Texjg.Text = ""
End Sub
Private Sub comend_Click()
Unload Me
main.Enabled = True '设置主窗体有效
End Sub
6.3.4退宿结帐
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>