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

📄 接待预定.frm

📁 餐饮管理系统 登记模板
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            ImageIndex      =   9
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "预定"
            ImageIndex      =   10
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
            ImageIndex      =   7
         EndProperty
      EndProperty
   End
   Begin VB.Label Label21 
      BackColor       =   &H8000000E&
      Height          =   495
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   615
   End
End
Attribute VB_Name = "JDYD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'为了防止每次刷新都需要从数据库读取数据
'这里设定一个数组来保存所有房间的信息
Private Type TableInfo
    TableName As String '房台名称
    TableNo As String '房台号
    TableSatus As Integer  '房台状态
    TableClassName As String '房台类型
    DeptName As String '餐厅类型
End Type
'定义结构体数组保存每个房台的信息
Dim myTableInfo(100) As TableInfo
'用来统计各种房态的房台数量,如空闲数量,使用数量,禁用数量等
Dim TableCount(6) As Integer

'定义房台数量
Dim TableNum As Integer
'定义当前选中的台桌
Private CurrentRow As Integer
Private CurrentCol As Integer
Private Const TotalRowNum = 8 '定义MSFlexGrid1的总行数
Private Const TotalColNum = 8 '定义MSFlexGrid1的总列数




Private Sub Combo1_click()
    MSFlexGrid1.Clear
    ShowTableInfo (Combo1.Text)

End Sub

Private Sub Form_Load()
'在窗体载入内存的时候,获得每个房台的信息
'通过MSFlexGrid1控件来设置每个房台的信息
'首先设置每个单元格的基本属性,如长、宽等
'With MSFlexGrid1点菜收银
    MSFlexGrid1.ColWidth(-1) = 800
    MSFlexGrid1.RowHeight(-1) = 800
    
    SetTableInfo
    ShowTableInfo ("中餐厅")
    
    '设置房台状态颜色
    Label1(0).BackColor = vbWhite
    Label1(1).BackColor = vbRed
    Label1(2).BackColor = vbYellow
    Label1(3).BackColor = vbBlue
    Label1(4).BackColor = RGB(1, 1, 1)
    Label1(4).ForeColor = vbWhite
    Label1(5).BackColor = vbGreen
    '设定工具栏的下拉按钮
    '设定第一个按钮的类型为下拉按钮类型
    Toolbar1.Buttons(1).Style = tbrDropdown
    dbRecord.Open "select 餐厅名称 from 餐厅类型 ", dbConn, 1, 1
    Do While Not dbRecord.EOF
        Toolbar1.Buttons(1).ButtonMenus.Add , , dbRecord(0).Value
        dbRecord.MoveNext
    Loop
    dbRecord.Close
'End With
End Sub

Private Sub SetTableInfo()
    '统计房台数据
    TableNum = 1
    '每个房台的状态信息保存在数据库表格房台信息表中
    dbRecord.Open "select 房台编号,房台名称,餐厅名称,房台类型名称,房台状态 from 房台状态信息 order by 房台编号", dbConn, 1, 1
    Do While Not dbRecord.EOF
        myTableInfo(TableNum).TableNo = dbRecord(0).Value
        myTableInfo(TableNum).TableName = dbRecord(1).Value
        myTableInfo(TableNum).DeptName = dbRecord(2).Value
        myTableInfo(TableNum).TableClassName = dbRecord(3).Value
        myTableInfo(TableNum).TableSatus = dbRecord(4).Value
        dbRecord.MoveNext
        TableNum = TableNum + 1
    Loop
    dbRecord.Close
End Sub

Private Sub ShowTableInfo(DeptName As String)
Dim i As Integer
Dim RowNum As Integer '保存当前MSFlexGrid1的行数
Dim ColNum As Integer '保存当前MSFlexGrid1的列数
Dim tempNum As Integer
RowNum = 0
tempNum = 0
MSFlexGrid1.Redraw = False
    For i = 0 To 6
        TableCount(i) = 0
    Next
    '循环设置每个房台的信息
    For i = 0 To TableNum - 1
        If myTableInfo(i + 1).DeptName = DeptName Then
            ColNum = tempNum Mod TotalColNum
            If (ColNum = 0) And (tempNum <> 0) Then
                'ColNum = TotalColNum
                RowNum = RowNum + 1
            End If
            MSFlexGrid1.Col = ColNum
            MSFlexGrid1.Row = RowNum
            MSFlexGrid1.Text = myTableInfo(i + 1).TableNo & vbCrLf
            MSFlexGrid1.Text = MSFlexGrid1.Text + myTableInfo(i + 1).TableName & vbCrLf
            MSFlexGrid1.Text = MSFlexGrid1.Text + myTableInfo(i + 1).TableClassName
            Select Case myTableInfo(i + 1).TableSatus
                Case 0
                TableCount(0) = TableCount(0) + 1
                Case 1
                MSFlexGrid1.CellBackColor = vbRed
                TableCount(1) = TableCount(1) + 1
                Case 2
                MSFlexGrid1.CellBackColor = vbYellow
                TableCount(2) = TableCount(2) + 1
                Case 3
                MSFlexGrid1.CellBackColor = vbBlue
                TableCount(3) = TableCount(3) + 1
                Case 4
                MSFlexGrid1.CellBackColor = RGB(1, 1, 1)
                MSFlexGrid1.CellForeColor = vbWhite
                TableCount(4) = TableCount(4) + 1
                Case 5
                MSFlexGrid1.CellBackColor = vbGreen
                TableCount(5) = TableCount(5) + 1
                
            End Select
            tempNum = tempNum + 1
        End If
    Next
MSFlexGrid1.Redraw = True
SetTableNum
End Sub



Private Sub MSFlexGrid1_Click()
    CurrentRow = MSFlexGrid1.Row
    CurrentCol = MSFlexGrid1.Col
End Sub

Private Sub MSFlexGrid1_DblClick()
Dim tempNum As Integer
    tempNum = CurrentRow * TotalColNum + CurrentCol + 1
    
    Load FTYD
    FTYD.TableNo = myTableInfo(tempNum).TableNo
    FTYD.TableName = myTableInfo(tempNum).TableName
    Unload Me
    FTYD.Show 1
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim i As Integer
Dim tempNum As Integer
    tempNum = CurrentRow * TotalColNum + CurrentCol + 1
    
    '按钮单击事件
    Select Case Button.Index
        Case 2
            FTLB.Show 1
        Case 3
            AbbidenTable
        Case 4
            Load FTYD
            FTYD.TableNo = myTableInfo(tempNum).TableNo
            FTYD.TableName = myTableInfo(tempNum).TableName
            Unload Me
            FTYD.Show 1
        Case 5
            Unload Me
    End Select
End Sub
Private Sub SetTableNum()
    Label1(0).Caption = " 空闲 " + CStr(TableCount(0))
    Label1(1).Caption = " 使用 " + CStr(TableCount(1))
    Label1(2).Caption = " 结帐 " + CStr(TableCount(2))
    Label1(3).Caption = " 续单 " + CStr(TableCount(3))
    Label1(4).Caption = " 禁用 " + CStr(TableCount(4))
    Label1(5).Caption = " 预约 " + CStr(TableCount(5))
End Sub

Private Function GetTableNO(TableInfo As String) As String
Dim TableArray() As String
    TableArray = Split(TableInfo, vbCrLf)
    GetTableNO = TableArray(0)
End Function
Private Function GetTableName(TableInfo As String) As String
Dim TableArray() As String
    TableArray = Split(TableInfo, vbCrLf)
    GetTableName = TableArray(1)
End Function

Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
            MSFlexGrid1.Clear
            For i = 0 To 6
                TableCount(i) = 0
            Next
            ShowTableInfo (ButtonMenu.Text)
End Sub

'禁用某个台桌
Private Sub AbbidenTable()
Dim tempsql As String
Dim tempNum As Integer '计算当前台桌在myTableInfo中的编号
    MSFlexGrid1.Col = CurrentCol
    MSFlexGrid1.Row = CurrentRow
    
    
    tempNum = CurrentRow * TotalColNum + CurrentCol + 1
'    MsgBox myTableInfo(tempNum).TableNo
    '更改数据库信息
    
    tempsql = "select 房台状态 from 房台状态信息 where 房台编号='" & myTableInfo(tempNum).TableNo & "'"
    Set dbRecord = dbConn.Execute(tempsql)
    '如果已经禁止,则取消禁止
    If dbRecord(0) = "4" Then
        MSFlexGrid1.Redraw = False
        MSFlexGrid1.CellBackColor = vbWhite
        MSFlexGrid1.CellForeColor = RGB(1, 1, 1)
        MSFlexGrid1.Redraw = True
        tempsql = "update 房台状态信息 set 房台状态=0 where 房台编号='" & myTableInfo(tempNum).TableNo & "'"
        dbConn.Execute (tempsql)
       ElseIf dbRecord(0) = "0" Then  '如果没有禁止,则禁止
        tempsql = "update 房台状态信息 set 房台状态=4 where 房台编号='" & myTableInfo(tempNum).TableNo & "'"
        dbConn.Execute (tempsql)
        MSFlexGrid1.Redraw = False
        MSFlexGrid1.CellBackColor = RGB(1, 1, 1)
        MSFlexGrid1.CellForeColor = vbWhite
        MSFlexGrid1.Redraw = True
    Else  '其他情况表示正在使用或者被预订了
        MsgBox "该桌已经在使用或者被预订,不能禁止!"
    End If
    dbRecord.Close
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -