Private Sub Form_Load() '自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub Text1_Change()
'查询客房信息
Data1.RecordSource = "select * from kf where kf.房间号 like " + Chr(34) + Text1.Text + "*" + Chr(34) + ""
Data1.Refresh
End Sub
Private Sub Command1_Click() '允许修改客房信息
DBGrid1.AllowUpdate = True
End Sub
Private Sub Command2_Click() '删除客房信息
If Data1.Recordset.RecordCount > 0 Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub
Private Sub Command3_Click()
main.Enabled = True
Unload Me
End Sub
6.4.3房态查看
Private Sub Form_Activate()
Dim i As Integer '定义一个整型变量
Dim criteria As String '定义一个字符串变量
Dim mydb1 As Database '定义数据库
Dim myrs1 As Recordset '定义字段
Dim myrs2 As Recordset
Dim myrs3 As Recordset
Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\kfgl.mdb") '定义数据环境
Set myrs1 = mydb1.OpenRecordset("kf", dbOpenSnapshot) '定义数据表
'入住房间查询
sql = "select * from kf where kf.房态 like " + Chr(34) + "入住" + Chr(34) + ""
Set myrs2 = mydb1.OpenRecordset(sql)
'文修房间查询
sql = "select * from kf where kf.房态 like " + Chr(34) + "文修" + Chr(34) + ""
Set myrs3 = mydb1.OpenRecordset(sql)
For i = 1 To 25 '房态显示
criteria = "房间号 ='" & Command1(i).Caption & "'"
myrs1.FindFirst criteria
If myrs1.NoMatch Then
Else
If myrs1.Fields("房态") = "空房" Then Command1(i).Picture = LoadPicture("") '空房
If myrs1.Fields("房态") = "入住" Then Command1(i).Picture = LoadPicture(App.Path & "\image\rz.ico")
If myrs1.Fields("房态") = "文修" Then Command1(i).Picture = LoadPicture(App.Path & "\image\wx.ico")
End If
Next i
If Not myrs2.EOF Then myrs2.MoveLast
If Not myrs3.EOF Then myrs3.MoveLast
Labsy.Caption = myrs2.RecordCount '客房入住数
Labwx.Caption = myrs3.RecordCount '客房文修数
Labkx.Caption = 25 - Val(Labwx.Caption) - Val(Labsy.Caption) '客房空闲数
Labsyl.Caption = Val(Labsy.Caption) / 25 * 100 & "%" '客房使用率
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub Command1_Click(Index As Integer) '查询住宿信息
main_zscx.Text2.Text = "1"
If Index >= 0 <= 25 Then
main_zscx.Data1.RecordSource = "select * from djb where 标志='1'and 房间号='" & Command1(Index).Caption & "'"
main_zscx.Data1.Refresh
End If
Load main_zscx
main_zscx.Show
End Sub
Private Sub Command2_Click()
Unload Me
main.Enabled = True
End Sub
6.5 挂帐管理
6.5.1客户结款
Private Sub Form_Load()
'自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.MDB"
Data2.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
'客户结款
Data1.RecordSource = "select * from gzmx where 挂账单位='" & DBCombo1.Text & "'"
Data1.Refresh
If Data1.Recordset.EOF = False Then Data1.Recordset.MoveLast
'添加客户结款信息
Data1.Recordset.AddNew
Data1.Recordset.Fields("日期") = Date
Data1.Recordset.Fields("时间") = Time
Data1.Recordset.Fields("摘要") = "客户还款"
Data1.Recordset.Fields("姓名") = Text2.Text
If DBCombo1.Text <> "" Then Data1.Recordset.Fields("挂账单位") = DBCombo1.Text
Data1.Recordset.Fields("还款金额") = Format(Val(Text1.Text), "0.00")
Data1.Recordset.Fields("金额累计") = Format((Val(khye.Text) - Val(Text1.Text)), "0.00")
Data1.Recordset.Update '更新记录
'清空数据
Text1.Text = "": khye.Text = "": Text2.Text = ""
End Sub
Private Sub Command2_Click()
main.Enabled = True
Unload Me
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>