?? frmregedit.frm
字號:
Height = 255
Left = 2040
TabIndex = 12
Top = 803
Width = 975
End
Begin VB.CommandButton Cmd_Cust
Caption = "選擇客戶"
Height = 375
Left = 1920
TabIndex = 3
Top = 1200
Width = 1095
End
Begin VB.Label lblCid
AutoSize = -1 'True
Caption = "lblCid"
Height = 180
Left = 840
TabIndex = 9
Top = 360
Width = 540
End
Begin VB.Label lblCname
AutoSize = -1 'True
Caption = "lblCname"
Height = 180
Left = 840
TabIndex = 8
Top = 840
Width = 720
End
Begin VB.Label lblCtype
AutoSize = -1 'True
Caption = "lblCtype"
Height = 180
Left = 840
TabIndex = 7
Top = 1320
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "姓 名:"
Height = 180
Left = 120
TabIndex = 6
Top = 840
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "類 型:"
Height = 180
Left = 120
TabIndex = 5
Top = 1320
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "編 號:"
Height = 180
Left = 120
TabIndex = 4
Top = 360
Width = 540
End
End
Begin VB.CommandButton Cmd_Close
Caption = "關(guān) 閉"
Height = 495
Left = 9120
TabIndex = 1
Top = 4403
Width = 1095
End
Begin VB.CommandButton Cmd_OK
Caption = "確 定"
Height = 495
Left = 7680
TabIndex = 0
Top = 4403
Width = 1095
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "操作人員"
Height = 180
Left = 240
TabIndex = 35
Top = 4560
Width = 720
End
Begin VB.Label lblEmpName
AutoSize = -1 'True
Caption = "lblEmpName"
Height = 180
Left = 1200
TabIndex = 34
Top = 4560
Width = 900
End
End
Attribute VB_Name = "FrmRegEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '添加(false)、修改(true)設(shè)置
Public TmpId As Integer '入住登記編號
'計算預(yù)定當前房間的總費用
Private Sub Cal_Total()
lblTotal = Round(Val(txtPrice) * Val(ComboRate) * Val(txtDays) / 100, 0) + Val(txtOtherFee)
End Sub
'根據(jù)入住日期計算退房日期
Private Sub Cat_LeaveDate()
txtLeaveDate.Text = DateAdd("d", Val(txtDays), Trim(txtInDate))
End Sub
Private Sub Refresh_Room()
'客房信息記錄,只顯示空房列表,即status=0
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "SELECT r.RoomNo As 房間編號, t.TypeName As 房間類型," _
+ " t.RoomNum As 房間個數(shù), t.Bednum As 床位數(shù)量, r.Position As 朝向," _
+ " r.Price as 價格, r.ObjList as 物品清單 FROM Room r, RoomType t" _
+ " WHERE r.TypeId=t.TypeId And r.Status=0 ORDER BY r.RoomNo"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
With DataGrid1
.Columns(0).Width = 0
.Columns(1).Width = 1000
.Columns(2).Width = 1000
.Columns(3).Width = 1000
.Columns(4).Width = 1000
.Columns(5).Width = 1000
.Columns(6).Width = 1000
End With
End Sub
Private Sub Refresh_OrderList()
'顯示指定客戶的所有預(yù)定信息
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "SELECT l.ListId as 編號, l.RoomNo as 客房編號, l.Days as 預(yù)定天數(shù), " _
+ " l.Price As 預(yù)定單價, l.Rate As 預(yù)定折扣, l.OtherFee As 其他收費," _
+ " l.Memo As 備注說明, l.OrderId FROM OrderList l, OrderRoom o" _
+ " WHERE l.OrderId=o.OrderId And o.CustId='" + Trim(lblCid) _
+ "' ORDER BY ListId"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
With DataGrid1
.Columns(0).Width = 0
.Columns(1).Width = 1000
.Columns(2).Width = 1000
.Columns(3).Width = 1000
.Columns(4).Width = 1000
.Columns(5).Width = 1000
.Columns(6).Width = 1000
.Columns(7).Width = 0
End With
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then '有預(yù)定,顯示與此客戶有關(guān)的預(yù)定信息
Refresh_OrderList
Else '沒有預(yù)定,則顯示空閑客房信息
Refresh_Room
End If
End Sub
Private Sub Cmd_Close_Click()
Unload Me
End Sub
Private Sub Cmd_Cust_Click()
FrmCustSlt.Show 1
lblCid.Caption = FrmCustSlt.TmpCustId
lblCname.Caption = FrmCustSlt.TmpCustName
lblCtype.Caption = FrmCustSlt.TmpCustType
'如果選中“有預(yù)定”,則根據(jù)選擇的客戶顯示預(yù)定信息
If Check1.Value = 1 Then
Refresh_OrderList
End If
End Sub
Private Sub Cmd_OK_Click()
'對用戶輸入數(shù)據(jù)的有效性進行判斷
If lblCid = "" Then
MsgBox "請選擇客戶"
Exit Sub
End If
If lblRoomNo = "" Then
MsgBox "請選擇房間"
Exit Sub
End If
If Trim(txtInDate) = False Then
MsgBox "請錄入入住日期"
txtInDate.SetFocus
Exit Sub
End If
If Trim(txtLeaveDate) = False Then
MsgBox "請錄入退房日期"
txtLeaveDate.SetFocus
Exit Sub
End If
If Val(txtDays) <= 0 Then
MsgBox "請錄入入住天數(shù)"
txtDays.SetFocus
Exit Sub
End If
If Val(txtPrice) <= 0 Then
MsgBox "請錄入有效的報價"
txtPrice.SetFocus
Exit Sub
End If
If Val(ComboRate) <= 0 Or Val(ComboRate) > 100 Then
MsgBox "折扣應(yīng)該在0~100之間"
ComboRate.SetFocus
Exit Sub
End If
If Val(txtOtherFee) < 0 Then
MsgBox "請錄入有效的其他費用"
txtOtherFee.SetFocus
Exit Sub
End If
If Val(txtFirstPay) < 0 Then
MsgBox "請錄入有效的押金"
txtFirstPay.SetFocus
Exit Sub
End If
'將此入住記錄保存
With MyReg
.CustId = lblCid
.RoomNo = lblRoomNo
.InDate = MakeStr(txtInDate)
.LeaveDate = MakeStr(txtLeaveDate)
.Days = Val(txtDays)
.Price = Val(txtPrice)
.Rate = Val(ComboRate)
.OtherFee = Val(txtOtherFee)
.FirstPay = Val(txtFirstPay)
.Memo = MakeStr(txtMemo)
.UserName = CurUser.UserName
'根據(jù)變量modify決定插入數(shù)據(jù)或修改數(shù)據(jù)
If Modify = False Then
.Insert
Else
.Update (TmpId)
'如果是修改數(shù)據(jù),則不允許更新房間等信息,所以退出
Unload Me
End If
End With
'如果選擇預(yù)定信息,則更新表OrderList,表OrderRoom和表Room中的數(shù)據(jù)
If Check1.Value = 1 Then
'刪除預(yù)定房間數(shù)據(jù)
MyOrderList.Delete (Adodc1.Recordset.Fields(0))
'如果表OrderList中當前預(yù)定編號中的所有預(yù)定房間都被刪除,則從表OrderRoom中刪除預(yù)定記錄
If MyOrderList.GetRoomNum(Adodc1.Recordset.Fields(7)) = 0 Then
MyOrderRoom.Delete (Adodc1.Recordset.Fields(7))
End If
End If
'更新房間狀態(tài)為入住,即Status=2
MyRoom.Status = 2
MyRoom.UpdateStatus (lblRoomNo)
Unload Me
End Sub
Private Sub ComboRate_Change()
Cal_Total
End Sub
Private Sub ComboRate_Click()
Cal_Total
End Sub
Private Sub DataGrid1_Click()
Dim TmpRoomNo As String
'如果沒有選擇記錄,則返回
If Adodc1.Recordset.EOF = True Then
Exit Sub
End If
If Check1.Value = 1 Then '將預(yù)定記錄中的房間信息帶入到入住登記信息中
'客戶信息
'房間號
TmpRoomNo = Trim(Adodc1.Recordset.Fields(1))
lblRoomNo = TmpRoomNo
'入住日期
txtInDate = Date
'入住天數(shù)
txtDays = Trim(Adodc1.Recordset.Fields(2))
'報價
txtPrice = Trim(Adodc1.Recordset.Fields(3))
'折扣
ComboRate = Trim(Adodc1.Recordset.Fields(4))
'其他費用
txtOtherFee = Trim(Adodc1.Recordset.Fields(5))
'其他說明
If IsNull(Adodc1.Recordset.Fields(6)) = True Then
txtMemo = ""
Else
txtMemo = Trim(Adodc1.Recordset.Fields(6))
End If
Else '從房間信息中帶入數(shù)據(jù)
lblRoomNo.Caption = Trim(Adodc1.Recordset.Fields(0))
txtPrice = Trim(Adodc1.Recordset.Fields(5))
End If
End Sub
Private Sub Form_Load()
If Check1.Value = 1 Then '有預(yù)定,顯示與此客戶有關(guān)的預(yù)定信息
Refresh_OrderList
Else '沒有預(yù)定,則顯示空閑客房信息
Refresh_Room
End If
End Sub
Private Sub txtDays_Change()
Cal_Total
Cat_LeaveDate
End Sub
Private Sub txtOtherFee_Change()
Cal_Total
End Sub
Private Sub txtPrice_Change()
Cal_Total
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -