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

📄 点菜.frm

📁 餐饮管理系统 登记模板
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         AutoSize        =   -1  'True
         Caption         =   "加菜单:"
         Height          =   180
         Left            =   3240
         TabIndex        =   6
         Top             =   780
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "酒菜列表:"
         Height          =   180
         Left            =   120
         TabIndex        =   5
         Top             =   1200
         Width           =   900
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "酒菜类别:"
         Height          =   180
         Left            =   180
         TabIndex        =   4
         Top             =   780
         Width           =   900
      End
   End
   Begin VB.Frame Frame1 
      Height          =   915
      Left            =   0
      TabIndex        =   0
      Top             =   4380
      Width           =   8775
      Begin VB.CommandButton Command4 
         Caption         =   "退出"
         Height          =   435
         Left            =   5520
         TabIndex        =   16
         Top             =   300
         Width           =   1275
      End
      Begin VB.CommandButton Command3 
         Caption         =   "落单"
         Height          =   435
         Left            =   4260
         TabIndex        =   15
         Top             =   300
         Width           =   1275
      End
      Begin VB.CommandButton Command2 
         Caption         =   "删除"
         Height          =   435
         Left            =   3000
         TabIndex        =   14
         Top             =   300
         Width           =   1275
      End
      Begin VB.CommandButton Command1 
         Caption         =   "增加"
         Height          =   435
         Left            =   1740
         TabIndex        =   13
         Top             =   300
         Width           =   1275
      End
   End
End
Attribute VB_Name = "DC"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim jcdl(10, 2) As String
Dim jcxl(10, 2) As String

Private Sub Combo1_click()
Dim tempSql As String
Dim tempVar As Variant
On Error Resume Next
'通过酒菜类别获得酒菜的具体信息
tempSql = "select * from 酒菜信息 where 小类编号='" & jcdl(Combo1.ListIndex, 1) & "'"
dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
List1.Clear
Do While Not dbRecord.EOF
    List1.AddItem dbRecord("酒菜名称").Value

    dbRecord.MoveNext
Loop
dbRecord.Close
End Sub

Private Sub Command1_Click()
On Error GoTo Err1

ListView1.ListItems.Add , , Label11.Caption, 1, 1  '显示酒菜名称
ListView1.ListItems(ListView1.ListItems.Count).SubItems(1) = Text1.Text  '显示数量
ListView1.ListItems(ListView1.ListItems.Count).SubItems(2) = Text2.Text  '显示单价
ListView1.ListItems(ListView1.ListItems.Count).SubItems(3) = Combo2.Text  '显示点单说明
ListView1.ListItems(ListView1.ListItems.Count).SubItems(4) = Combo3.Text  '显示点单类型
ListView1.ListItems(ListView1.ListItems.Count).SubItems(5) = FTZD.Text17.Text '显示房台名称
ListView1.ListItems(ListView1.ListItems.Count).SubItems(6) = Label10.Caption   '酒菜编号
ListView1.ListItems(ListView1.ListItems.Count).SubItems(7) = FTZD.Text1.Text   '显示房台编号
Exit Sub
Err1:
    MsgBox "请输入整数!", vbCritical

End Sub

Private Sub Command2_Click()
On Error Resume Next
ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
End Sub

Private Sub Command3_Click()
Dim tempSql As String
Dim tempIndex As Integer
'On Error Resume Next
'落单就是把点菜的信息加入到数据库中
'循环读取listview1中的数据,加入到数据库每日点单中
For tempIndex = 1 To ListView1.ListItems.Count
tempSql = "insert into 每日点单 (酒菜名称,数量,单价,点单说明,点单类型,房台名称,酒菜编号,房台编号,点菜时间) values"
tempSql = tempSql & "('" & ListView1.ListItems(tempIndex).Text & "',"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(1) & ","
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(2) & ",'"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(3) & "','"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(4) & "','"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(5) & "','"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(6) & "','"
tempSql = tempSql & ListView1.ListItems(tempIndex).SubItems(7) & "','"
tempSql = tempSql & Now & "')"
MsgBox tempSql
'tempSql = "insert into 每日点单 set 酒菜名称='青岛啤酒'"
dbConn.Execute (tempSql)
Debug.Print tempSql
tempSql = ""
Next


FTZD.Adodc1.Refresh

Unload Me

End Sub

Private Sub Command4_Click()
Unload Me
'MsgBox ListView1.ListItems(tempIndex).SubItems(1).Text
End Sub

Private Sub Form_Load()
Dim tempSql As String
Dim tempIndex As Integer
On Error Resume Next
'首先获得酒菜的类别
tempSql = "select * from 酒菜小类"

dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
tempIndex = 0
Do While Not dbRecord.EOF
    Combo1.AddItem dbRecord("小类名称").Value
    jcdl(tempIndex, 0) = dbRecord("小类名称").Value
    jcdl(tempIndex, 1) = dbRecord("小类编号").Value
    dbRecord.MoveNext
    tempIndex = tempIndex + 1
Loop
dbRecord.Close
Combo1.ListIndex = 0

'向其他下拉框添加数据
'点单说明下拉框
'编程的时候是从数据库中读取,这样可以增加程序的可扩展性
tempSql = "select * from 点单说明"
dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
Do While Not dbRecord.EOF
    Combo2.AddItem dbRecord("说明内容").Value
    dbRecord.MoveNext
Loop

dbRecord.Close
Combo2.ListIndex = 0
'下面向点单类型下拉框中添加数据
'同样为了能够让程序有更多的可读性,最好使用数据库来实现
tempSql = "select 点单类型名称 from 点单类型"
dbRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly
Do While Not dbRecord.EOF
    Combo3.AddItem dbRecord(0).Value
    dbRecord.MoveNext
Loop
dbRecord.Close
Combo3.ListIndex = 0

'dbConn.BeginTrans  '启动事务处理
ListView1.ColumnHeaders.Add , "", "酒菜名称"
ListView1.ColumnHeaders.Add , "", "数量"
ListView1.ColumnHeaders.Add , "", "单价"
ListView1.ColumnHeaders.Add , "", "点单说明"
ListView1.ColumnHeaders.Add , "", "点单类型"
ListView1.ColumnHeaders.Add , "", "房台名称"
ListView1.ColumnHeaders.Add , "", "酒菜编号"
ListView1.ColumnHeaders.Add , "", "房台编号"


End Sub

Private Sub List1_Click()
Dim tempSql As String
Dim tempRecord As New ADODB.Recordset

'通过选择具体的酒菜名称获得酒菜的详细信息
Set tempRecord = New ADODB.Recordset
tempSql = "select * from 酒菜信息 where 酒菜名称='" & List1.List(List1.ListIndex) & "'"
tempRecord.Open tempSql, dbConn, adOpenStatic, adLockReadOnly

Label10.Caption = tempRecord.Fields("酒菜编号").Value
Label11.Caption = tempRecord.Fields("酒菜名称").Value
Text2.Text = tempRecord.Fields("单价").Value

tempRecord.Close
End Sub

Private Sub List1_DblClick()
Command1_Click
End Sub

Private Sub Text1_Change()
If Len(Text1.Text) > 0 Then
    Command1.Enabled = True
Else
    Command1.Enabled = False
End If
End Sub

⌨️ 快捷键说明

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