⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmorderroomedit.frm

📁 酒店管理系统 基于VB和SQL的一个很好的程序 可以实现酒店的日常管理工作
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Top             =   855
         Width           =   90
      End
      Begin VB.Label Label16 
         AutoSize        =   -1  'True
         Caption         =   "其他费用(元)"
         Height          =   180
         Left            =   4440
         TabIndex        =   38
         Top             =   855
         Width           =   1260
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         Caption         =   "折扣(%)"
         Height          =   180
         Left            =   2280
         TabIndex        =   37
         Top             =   855
         Width           =   810
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "入住天数"
         Height          =   180
         Left            =   8160
         TabIndex        =   36
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "报价(元)"
         Height          =   180
         Left            =   240
         TabIndex        =   35
         Top             =   855
         Width           =   900
      End
      Begin VB.Label lblRoomNo 
         AutoSize        =   -1  'True
         Caption         =   "lblRoomNo"
         Height          =   180
         Left            =   1200
         TabIndex        =   29
         Top             =   360
         Width           =   810
      End
      Begin VB.Label lblPrice 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "0"
         Height          =   180
         Left            =   4080
         TabIndex        =   22
         Top             =   360
         Width           =   90
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "参考价格(元)"
         Height          =   180
         Left            =   2280
         TabIndex        =   15
         Top             =   360
         Width           =   1260
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "入住日期(yyyy-mm-dd)"
         Height          =   180
         Left            =   4440
         TabIndex        =   14
         Top             =   360
         Width           =   1980
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "客房编号:"
         Height          =   180
         Left            =   240
         TabIndex        =   13
         Top             =   360
         Width           =   810
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户信息"
      Height          =   1815
      Left            =   120
      TabIndex        =   11
      Top             =   120
      Width           =   3135
      Begin VB.CommandButton Cmd_Cust 
         Caption         =   "选择客户"
         Height          =   375
         Left            =   1920
         TabIndex        =   0
         Top             =   1200
         Width           =   1095
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "编 号:"
         Height          =   180
         Left            =   120
         TabIndex        =   45
         Top             =   360
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "类 型:"
         Height          =   180
         Left            =   120
         TabIndex        =   44
         Top             =   1320
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "姓 名:"
         Height          =   180
         Left            =   120
         TabIndex        =   43
         Top             =   840
         Width           =   540
      End
      Begin VB.Label lblCtype 
         AutoSize        =   -1  'True
         Caption         =   "lblCtype"
         Height          =   180
         Left            =   840
         TabIndex        =   21
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label lblCname 
         AutoSize        =   -1  'True
         Caption         =   "lblCname"
         Height          =   180
         Left            =   840
         TabIndex        =   20
         Top             =   840
         Width           =   720
      End
      Begin VB.Label lblCid 
         AutoSize        =   -1  'True
         Caption         =   "lblCid"
         Height          =   180
         Left            =   840
         TabIndex        =   19
         Top             =   360
         Width           =   540
      End
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "押金(元)"
      Height          =   180
      Left            =   240
      TabIndex        =   34
      Top             =   7230
      Width           =   900
   End
   Begin VB.Label lblOrderDate 
      AutoSize        =   -1  'True
      Caption         =   "lblOrderDate"
      Height          =   180
      Left            =   5640
      TabIndex        =   33
      Top             =   7230
      Width           =   1080
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "预定日期"
      Height          =   180
      Left            =   4680
      TabIndex        =   32
      Top             =   7230
      Width           =   720
   End
   Begin VB.Label lblEmpName 
      AutoSize        =   -1  'True
      Caption         =   "lblEmpName"
      Height          =   180
      Left            =   3600
      TabIndex        =   31
      Top             =   7230
      Width           =   900
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "操作人员"
      Height          =   180
      Left            =   2640
      TabIndex        =   30
      Top             =   7230
      Width           =   720
   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
  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 txtDays_Change()
  Cal_Total
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 + -