📄 frmorderroomedit.frm
字号:
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid2
Height = 1335
Left = 120
TabIndex = 7
Top = 360
Width = 6615
_ExtentX = 11668
_ExtentY = 2355
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
BorderStyle = 0
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
MarqueeStyle = 3
AllowFocus = 0 'False
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.Frame Frame5
Caption = "统计信息"
Height = 855
Left = 0
TabIndex = 1
Top = 5880
Width = 10095
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "合计金额(元)"
Height = 180
Left = 3600
TabIndex = 5
Top = 360
Width = 1260
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "预定数量(间)"
Height = 180
Left = 240
TabIndex = 4
Top = 360
Width = 1260
End
Begin VB.Label lblSum
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "0"
Height = 180
Left = 5640
TabIndex = 3
Top = 360
Width = 90
End
Begin VB.Label lblCount
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "0"
Height = 180
Left = 2400
TabIndex = 2
Top = 360
Width = 90
End
End
Begin VB.TextBox txtFirstPay
Alignment = 1 'Right Justify
Height = 270
Left = 1200
TabIndex = 0
Text = "0"
Top = 7065
Width = 855
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "操作人员"
Height = 180
Left = 2520
TabIndex = 45
Top = 7110
Width = 720
End
Begin VB.Label lblEmpName
AutoSize = -1 'True
Caption = "lblEmpName"
Height = 180
Left = 3480
TabIndex = 44
Top = 7110
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "预定日期"
Height = 180
Left = 4560
TabIndex = 43
Top = 7110
Width = 720
End
Begin VB.Label lblOrderDate
AutoSize = -1 'True
Caption = "lblOrderDate"
Height = 180
Left = 5520
TabIndex = 42
Top = 7110
Width = 1080
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "押金(元)"
Height = 180
Left = 120
TabIndex = 41
Top = 7110
Width = 900
End
End
Attribute VB_Name = "FrmOrderRoomEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OId As Integer '预定编号
Public Modify As Boolean '添加(false)、修改(true)设置
'计算预定当前房间的总费用
Private Sub Cal_Total()
lblTotal = Round(Val(txtPrice) * Val(ComboRate) * Val(txtDays) / 100, 0) + Val(txtOtherFee)
End Sub
Private Sub Refresh_Room()
'客房信息记录,只显示空房列表,即status=0
Adodc2.ConnectionString = Conn
Adodc2.RecordSource = "SELECT r.RoomNo As 房间编号, t.TypeName As 房间类型," _
+ " t.RoomNum As 房间个数, t.Bednum As 床位数量, 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"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2
With DataGrid2
.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()
'预定信息记录,Status=1的为预定信息
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "SELECT ListId As 编号, RoomNo As 客房编号, Days As 预定天数, " _
+ " Price As 预定单价, Rate As 预定折扣, OtherFee As 其他收费," _
+ " Memo As 备注说明 FROM OrderList WHERE OrderId=" _
+ Trim(OId) + " ORDER BY ListId"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
With DataGrid1
.Columns(0).Width = 0
.Columns(1).Width = 1200
.Columns(2).Width = 1200
.Columns(3).Width = 1200
.Columns(4).Width = 1200
.Columns(5).Width = 1200
.Columns(6).Width = 3000
End With
End Sub
Private Sub Cmb_Rate_Change()
'折扣更改,则总额更改
lblTotal.Caption = Val(Cmb_Rate.Text) * Val(txtTotal.Text)
End Sub
Private Sub Cmd_Add_Click()
If lblCid = "" Then
MsgBox "请选择客户"
Exit Sub
End If
If lblRoomNo = "" Then
MsgBox "请选择房间"
Exit Sub
End If
If IsDate(Trim(txtInDate)) = False Then
MsgBox "请录入日期格式的入住日期"
txtInDate.SetFocus
Exit Sub
End If
If Val(txtDays) <= 0 Then
MsgBox "请录入入住天数"
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 "折扣应该在0~100之间"
ComboRate.SetFocus
Exit Sub
End If
If Val(txtOtherFee) < 0 Then
MsgBox "请录入有效的其他费用"
txtOtherFee.SetFocus
Exit Sub
End If
'添加预定详细信息
With MyOrderList
.OrderId = OId
.RoomNo = MakeStr(lblRoomNo)
.InDate = Trim(txtInDate)
.Days = Val(txtDays)
.Price = Val(txtPrice)
.Rate = Val(ComboRate)
.OtherFee = Val(txtOtherFee)
.Memo = MakeStr(txtMemo)
'插入预定客房记录
.Insert
End With
'刷新当前记录信息
Refresh_OrderList
'增加总预定套数和总金额
lblCount = Val(lblCount) + 1
lblSum = Val(lblSum) + Val(lblTotal)
'将房间的状态设置为空闲
MyRoom.Status = 1
MyRoom.UpdateStatus (lblRoomNo)
'刷新空闲房间的显示
Refresh_Room
DataGrid2_Click
End Sub
Private Sub Cmd_Close_Click()
'因为退出将不保存当前的数据,所以判断是否要退出
'如果Modify为false,表示新记录,则关闭时需要删除已经保存的记录
If Modify = False Then
If MsgBox("退出将不保存当前数据,是否要退出", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
MyOrderRoom.Delete (OId)
'删除已经预定的客房信息记录
MyOrderList.DeleteByOrderId (OId)
End If
Unload Me
End Sub
Private Sub Cmd_Cust_Click()
FrmCustSlt.Show 1
lblCid.Caption = FrmCustSlt.TmpCustId
lblCname.Caption = FrmCustSlt.TmpCustName
lblCtype.Caption = FrmCustSlt.TmpCustType
End Sub
Private Sub Cmd_Del_Click()
'删除预定列表信息
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
If MsgBox("是否删除当前预定记录", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
'更新总预定套数和总金额
lblCount = Val(lblCount) - 1
lblSum = Val(lblSum) - Round(Adodc1.Recordset(2) * Adodc1.Recordset.Fields(3) _
* Adodc1.Recordset.Fields(4) / 100, 0) - Adodc1.Recordset.Fields(5)
'将房间的状态设置为空闲
MyRoom.Status = 0
MyRoom.UpdateStatus (Adodc1.Recordset.Fields(1))
'刷新空闲房间的显示
Refresh_Room
DataGrid2_Click
'按编号删除预定客房信息
MyOrderList.Delete (Adodc1.Recordset.Fields(0))
Refresh_OrderList
End Sub
Private Sub Cmd_OK_Click()
'将此预定记录保存
With MyOrderRoom
.OrderId = OId
.CustId = MakeStr(lblCid)
.FirstPay = Val(txtFirstPay)
.OrderDate = Date
.UserName = CurUser.UserName
'因为添加新的预定记录时,在打开此窗体前就事先插入了一条初始的预定记录
'所以这里不存在插入记录,只是更新记录
.Update (OId)
End With
'更改选中客房的状态值为1, 批量更新状态值
MyRoom.Status = 1
MyRoom.UpdateListStatus (OId)
Unload Me
End Sub
Private Sub ComboRate_Change()
Cal_Total
End Sub
Private Sub ComboRate_Click()
Cal_Total
End Sub
Private Sub DataGrid2_Click()
'如果选中一个房间,则在预定信息中显示的客房编号和价格
If Adodc2.Recordset.EOF = True Then
lblRoomNo = ""
lblPrice = 0
txtPrice = 0
txtInDate = ""
txtDays = 0
ComboRate.Text = 100
txtOtherFee = 0
Else
lblRoomNo.Caption = Trim(Adodc2.Recordset.Fields(0))
lblPrice = Trim(Adodc2.Recordset.Fields(5))
txtPrice = lblPrice
ComboRate.Text = 85
End If
End Sub
Private Sub Form_Load()
'刷新客房信息
Refresh_Room
'刷新预定信息
Refresh_OrderList
'统计预定套数和预定总额
lblCount.Caption = MyOrderList.GetRoomNum(OId)
' lblTotal.Caption = MyOrderList.GetSum(OId)
End Sub
Private Sub MonthView1_KeyPress(KeyAscii As Integer)
MonthView1.Visible = False
End Sub
Private Sub MonthView1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date, Cancel As Boolean)
txtInDate.Text = MonthView1.Value
End Sub
Private Sub txtDays_Change()
Cal_Total
End Sub
Private Sub txtInDate_Click()
MonthView1.Visible = True
End Sub
Private Sub txtOtherFee_Change()
Cal_Total
End Sub
Private Sub txtPrice_Change()
Cal_Total
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -