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

📄 frmorderroomedit1.frm

📁 一个小型管理系统.~!!不同的用户拥有不同的权限
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "报价(元)"
         Height          =   180
         Left            =   240
         TabIndex        =   17
         Top             =   855
         Width           =   900
      End
      Begin VB.Label lblRoomNo 
         AutoSize        =   -1  'True
         Caption         =   "lblRoomNo"
         Height          =   180
         Left            =   1200
         TabIndex        =   16
         Top             =   360
         Width           =   810
      End
      Begin VB.Label lblPrice 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "0"
         Height          =   180
         Left            =   4080
         TabIndex        =   15
         Top             =   360
         Width           =   90
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "参考价格(元)"
         Height          =   180
         Left            =   2280
         TabIndex        =   14
         Top             =   360
         Width           =   1260
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "入住日期(yyyy-mm-dd)"
         Height          =   180
         Left            =   4440
         TabIndex        =   13
         Top             =   360
         Width           =   1980
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "客房编号:"
         Height          =   180
         Left            =   240
         TabIndex        =   12
         Top             =   360
         Width           =   810
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户信息"
      Height          =   1815
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   3135
      Begin MSAdodcLib.Adodc Adodc3 
         Height          =   330
         Left            =   2160
         Top             =   0
         Visible         =   0   'False
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   582
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         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         =   "Adodc3"
         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 VB.TextBox txtCname 
         Height          =   270
         Left            =   1080
         TabIndex        =   42
         Top             =   840
         Width           =   1815
      End
      Begin VB.TextBox txtCid 
         Height          =   270
         Left            =   1080
         TabIndex        =   41
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label2 
         Caption         =   "客户类别:"
         Height          =   255
         Left            =   120
         TabIndex        =   44
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label lblCtype 
         Caption         =   "临时客户"
         Height          =   255
         Left            =   1080
         TabIndex        =   43
         Top             =   1320
         Width           =   735
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "身份证:"
         Height          =   180
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   630
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "姓 名:"
         Height          =   180
         Left            =   120
         TabIndex        =   1
         Top             =   840
         Width           =   540
      End
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "押金(元)"
      Height          =   180
      Left            =   120
      TabIndex        =   40
      Top             =   7110
      Width           =   900
   End
   Begin VB.Label lblOrderDate 
      AutoSize        =   -1  'True
      Caption         =   "lblOrderDate"
      Height          =   180
      Left            =   5520
      TabIndex        =   39
      Top             =   7110
      Width           =   1080
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "预定日期"
      Height          =   180
      Left            =   4560
      TabIndex        =   38
      Top             =   7110
      Width           =   720
   End
   Begin VB.Label lblEmpName 
      AutoSize        =   -1  'True
      Caption         =   "lblEmpName"
      Height          =   180
      Left            =   3480
      TabIndex        =   37
      Top             =   7110
      Width           =   900
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "操作人员"
      Height          =   180
      Left            =   2520
      TabIndex        =   36
      Top             =   7110
      Width           =   720
   End
End
Attribute VB_Name = "FrmOrderRoomEdit1"
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 txtCid = "" 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
  If FrmOrderRoomEdit1.Modify = False Then
  With MyCust
  .CustLevel = "普通客户"
  .CustFrom = "1"
  .Idtype = "身份证"
  .OrgName = "1"
  .Sex = "男"
  .Postcode = "1"
  .Address = "1"
  .Office = "1"
  .Mobile = "1"
  .Home = "1"
  .Job = "1"
  .CustId = MakeStr(txtCid)
  .CustName = MakeStr(txtCname)
  .CustType = MakeStr(lblCtype)
  .Insert
  End With
  End If
  '刷新当前记录信息
  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_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(txtCid)
  .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 Text1_Change()

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 txtCid_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 120 Then
KeyAscii = 0
End If

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 + -