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

📄 main_qtgl_ktgl_jcfw.frm

📁 餐饮企业的管理系统主要包括前台管理、后台管理、财务管理、报表打印等功能
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         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         =   "Adodc1"
         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
   End
End
Attribute VB_Name = "main_qtgl_ktgl_jcfw"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset       '定义数据集对象
Dim rs5 As New ADODB.Recordset

Private Sub Combo1_Click()
    If Combo1.ListIndex = 1 Then
        MS1.TextMatrix(MS1.Row, 6) = 0
    Else
        MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    End If
    Dim a, B As Single
    For i = 1 To 101
        If MS1.TextMatrix(i, 1) <> "" And MS1.TextMatrix(i, 5) <> "" Then
            pz.text = i                                  '品种数
            a = Val(MS1.TextMatrix(i, 6)) + a    '求合计金额
            B = Val(MS1.TextMatrix(i, 5)) + B    '求合计数量
        End If
    Next i
 '使用Format函数将数据格式为“0.00”格式
    hjsl.text = B: hjje.text = Format(a, "0.00")
End Sub

Private Sub Combo1_LostFocus()
    MS1.TextMatrix(MS1.Row, 7) = Combo1.text
    If MS1.TextMatrix(MS1.Row, 7) = "赠单" Then
        MS1.TextMatrix(MS1.Row, 6) = 0
    Else
        MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    End If
    Dim a, B As Single
    For i = 1 To 101
        If MS1.TextMatrix(i, 1) <> "" And MS1.TextMatrix(i, 5) <> "" Then
            pz.text = i                                  '品种数
            a = Val(MS1.TextMatrix(i, 6)) + a    '求合计金额
            B = Val(MS1.TextMatrix(i, 5)) + B    '求合计数量
        End If
    Next i
 '使用Format函数将数据格式为“0.00”格式
    hjsl.text = B: hjje.text = Format(a, "0.00")
End Sub

Private Sub Form_Activate()     '初始化设置
 Combo1.AddItem ("点单"): Combo1.AddItem ("赠单"): Combo1.ListIndex = 0
 For i = 0 To 7
  Label4(i).Caption = main_qtgl_ktgl.Label4(i).Caption
 Next i
 Sql = "select * from 点单临时表 where 房台编号='" + Label4(0).Caption + "'"
 Call FunAdo(Adodc3, Sql)
 Adodc3.Refresh
 If Adodc3.Recordset.RecordCount > 0 Then
  '赋值给djh.caption等
  djh.Caption = Adodc3.Recordset.Fields("单据号")
  Labbh.Caption = Adodc3.Recordset.Fields("服务员编号")
  Labxm.Caption = Adodc3.Recordset.Fields("服务员姓名")
 End If
 labrq.Caption = Now
End Sub
Private Sub Form_Load()
    FormNumber = 3
    Dim sqlStr1 As String
    MS1.Rows = 102: MS1.Cols = 9     '定义ms1表的总行数、总列数
    s = Array("450", "2400", "1200", "750", "900", "900", "1200", "900", "2100")
    y = Array("序号", "商品名称", "商品编号", "单位", "单价", "数量", "金额", "状态", "备注")
    For i = 0 To 8
        MS1.ColWidth(i) = s(i): MS1.TextMatrix(0, i) = y(i)
    Next i
    MS1.FixedRows = 1: MS1.FixedCols = 1     '设置固定行、列
 '定义MS1表的列序号
    For i = 1 To 101
        MS1.TextMatrix(i, 0) = i
    Next i
    Me.Caption = Me.Caption & "    " & frm_main.St1.Panels(3).text
    Sql = "select * from 房间台号信息表"
    sqlStr = "select * from 商品基础信息表"
    sqlStr1 = "select * from 商品基础信息表"
    Call FunAdo(Adodc1, Sql)
    Call FunAdo(Adodc2, sqlStr)
    Call FunAdo(Adodc3, sqlStr1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
  main_qtgl_ktgl.Enabled = True
End Sub
Private Sub grid1_KeyDown(KeyCode As Integer, Shift As Integer)
   With Adodc2.Recordset
        If .RecordCount > 0 Then    '当记录大于零时
           If .Fields("商品全称") <> "" Then
              '赋值给MS1表格
              If .Fields("商品全称") <> "" Then MS1.TextMatrix(MS1.Row, 1) = Trim(.Fields("商品全称"))
              If .Fields("商品编号") <> "" Then MS1.TextMatrix(MS1.Row, 2) = Trim(.Fields("商品编号"))
              If .Fields("单位") <> "" Then MS1.TextMatrix(MS1.Row, 3) = Trim(.Fields("单位"))
              If .Fields("单价") <> "" Then MS1.TextMatrix(MS1.Row, 4) = .Fields("单价")
              Text1.text = MS1.text     '赋值给text1.text
              Text1.SetFocus
              MS1.Col = 5
              grid1.Visible = False
           Else
              MsgBox ("无数据选择!!!")
              grid1.Visible = False
              Text1.SetFocus
           End If
        End If
   End With
   Text1.SetFocus
  
  If KeyCode = vbKeyEscape Then    '按ESC键
     grid1.Visible = False     'grid1不可见
     Text1.SetFocus
  End If
End Sub
Private Sub MS1_Click()     '单击MS1表格
  If MS1.Row >= 1 And MS1.TextMatrix(MS1.Row - 1, 7) <> "" Then
     Text1.Visible = True
     Text1.SetFocus
  End If
End Sub
Private Sub MS1_entercell()
 frm_main.Text1.text = "3"
 Call entercell     '调用函数
End Sub
Private Sub MS1_RowColChange()     '格式化MS1表的第4列、第6列
 For i = 1 To 101
  If MS1.TextMatrix(i, 1) <> "" Then
     MS1.TextMatrix(MS1.Row, 4) = Format(MS1.TextMatrix(MS1.Row, 4), "#0.00")
     MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
     MS1.TextMatrix(MS1.Row, 6) = Format(MS1.TextMatrix(MS1.Row, 6), "#0.00")
  End If
 Next i
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then
     MS1.text = Combo1.text
     Combo1.Visible = False
     MS1.Col = 8
     Text1.Visible = True
     Text1.SetFocus
  End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
  frm_main.Text1.text = "3"
  If KeyCode = vbKeyReturn Then
     If MS1.Col = 1 Then
     'With语句用来在一个单一对象或一个用户定义类型上执行一系列的语句。
        With Adodc2.Recordset
        If .RecordCount > 0 Then
          '赋值给MS1表格
           If .Fields("商品全称") <> "" Then MS1.TextMatrix(MS1.Row, 1) = Trim(.Fields("商品全称"))
           If .Fields("商品编号") <> "" Then MS1.TextMatrix(MS1.Row, 2) = Trim(.Fields("商品编号"))
           If .Fields("单位") <> "" Then MS1.TextMatrix(MS1.Row, 3) = Trim(.Fields("单位"))
           If .Fields("单价") <> "" Then MS1.TextMatrix(MS1.Row, 4) = .Fields("单价")
           Text1.SetFocus
           Text1.text = MS1.text     '赋值给text1.text
           grid1.Visible = False
           MS1.Col = 4
        End If
        End With
     End If
     Call movereturn     '调用函数
  End If
  If KeyCode = vbKeyUp Then
     If MS1.Row > 1 Then MS1.Row = MS1.Row - 1
  End If
  If KeyCode = vbKeyDown Then
     'If MS1.Row < 99 Then MS1.Row = MS1.Row + 1
     grid1.Visible = True
  End If
  If KeyCode = vbKeyLeft Then Call moveleft     '调用函数
  If KeyCode = vbKeyRight Then Call moveright     '调用函数
  If KeyCode = vbKeyPageDown Then
   If MS1.Col = 1 Then
   sqlStr = "select * from 商品基础信息表,库存信息表 where 商品级别<>'1级'and 商品基础信息表.商品编号=库存信息表.商品编号"
    Call FunAdo(Adodc2, sqlStr)
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
       grid1.Visible = True
       grid1.SetFocus
    End If
   End If
  End If
End Sub
Private Sub Text1_Change()
  MS1.text = Text1.text   '赋值给MS1.text
  If MS1.Col = 1 Then
   If Text1.text = "" Then
      grid1.Visible = False
    Else
      '筛选商品名称或简称符合text1的记录
      sqlStr = "select * from 商品基础信息表 where (本级名称 like '" + Text1.text + "'+ '%')or(本级简称  like '" + Text1.text + "'+'%')and 商品基础信息表.商品级别<>'1级'"
      Call FunAdo(Adodc2, sqlStr)
      Adodc2.Refresh
      If Adodc2.Recordset.RecordCount > 0 Then
         grid1.Visible = True
         Text1.SetFocus
      End If
   End If
  End If
  If MS1.Col = 2 Then
     If MS1.TextMatrix(MS1.Row, 1) = "" Then
        MsgBox ("无商品名称,请重新输入!!!")
        MS1.Col = 1
     End If
  End If
      If MS1.TextMatrix(MS1.Row, 7) = "赠单" Then
        MS1.TextMatrix(MS1.Row, 6) = ""
        MS1.TextMatrix(MS1.Row, 6) = 0
    ElseIf MS1.Col = 4 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    ElseIf MS1.Col = 5 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    End If
  If MS1.Col = 7 Then
   Text1.Visible = False: Combo1.Visible = True
   Combo1.Width = MS1.CellWidth
   Combo1.Left = MS1.CellLeft + MS1.Left: Combo1.Top = MS1.CellTop + MS1.Top
   Combo1.SetFocus
  End If
  Dim a, B As Single
  For i = 1 To 101
      If MS1.TextMatrix(i, 1) <> "" And MS1.TextMatrix(i, 5) <> "" Then
      pz.text = i     '品种数
      a = Val(MS1.TextMatrix(i, 6)) + a     '求合计金额
      B = Val(MS1.TextMatrix(i, 5)) + B     '求合计数量
  End If
  Next i
  hjsl.text = B: hjje.text = Format(a, "0.00")
End Sub
Private Sub Comdj_Click()
 '确定文本框在MS1表格中的大小和位置
 Text1.Width = MS1.CellWidth: Text1.Height = MS1.CellHeight
 Text1.Left = MS1.CellLeft + MS1.Left: Text1.Top = MS1.CellTop + MS1.Top
 MS1.Enabled = True
 MS1.Col = 1: MS1.Row = 1
 '设置控件可用或不可用状态
 Combc.Enabled = True: Comqx.Enabled = True
 Comdj.Enabled = False: Text1.Visible = True
 Text1.SetFocus
End Sub
Private Sub Combc_Click()     '确定加菜
  rs1.Open "select * from 点单临时表", cnn, adOpenKeyset, adLockOptimistic
  If MS1.TextMatrix(1, 1) <> "" And MS1.TextMatrix(1, 5) <> "" Then
    For i = 1 To 100
     If MS1.TextMatrix(i, 1) <> "" And MS1.TextMatrix(i, 5) <> "" Then
     '添加新记录到"点单临时表"中
      rs1.AddNew
      If MS1.TextMatrix(i, 1) <> "" Then rs1.Fields("商品名称") = Trim(MS1.TextMatrix(i, 1))
      If MS1.TextMatrix(i, 2) <> "" Then rs1.Fields("商品编号") = Trim(MS1.TextMatrix(i, 2))
      If MS1.TextMatrix(i, 3) <> "" Then rs1.Fields("单位") = Trim(MS1.TextMatrix(i, 3))
      If MS1.TextMatrix(i, 4) <> "" Then rs1.Fields("单价") = Val(MS1.TextMatrix(i, 4))
      If MS1.TextMatrix(i, 5) <> "" Then rs1.Fields("数量") = Val(MS1.TextMatrix(i, 5))
      If MS1.TextMatrix(i, 6) <> "" Then rs1.Fields("金额") = Val(MS1.TextMatrix(i, 6))
      If MS1.TextMatrix(i, 7) <> "" Then rs1.Fields("状态") = Trim(MS1.TextMatrix(i, 7))
      If MS1.TextMatrix(i, 8) <> "" Then rs1.Fields("备注") = Trim(MS1.TextMatrix(i, 8))
      If Label4(0).Caption <> "" Then rs1.Fields("房台编号") = Label4(0).Caption
      If Label4(6).Caption <> "" Then rs1.Fields("房台类别") = Label4(2).Caption
      If labrq.Caption <> "" Then rs1.Fields("点单日期") = Trim(labrq.Caption)
      If Labbh.Caption <> "" Then rs1.Fields("服务员编号") = Labbh.Caption
      If Labxm.Caption <> "" Then rs1.Fields("服务员姓名") = Labxm.Caption
      If djh.Caption <> "" Then rs1.Fields("单据号") = Trim(djh.Caption)
      rs1.Fields("是否结账") = "否"
      rs1.Update
      Adodc3.Refresh
      Set rs5 = New ADODB.Recordset
      '筛选符合商品编号的记录
      rs5.Open "select * from 库存信息表 where 商品编号='" & Trim(MS1.TextMatrix(i, 2)) & "'", cnn, adOpenKeyset, adLockOptimistic
      If rs5.RecordCount > 0 Then     '当记录大于零时
        If rs5.Fields("商品名称") <> "" Then
         '更新库存数量、库存金额
          rs5.Fields("库存数量") = rs5.Fields("库存数量") - Trim(Val(MS1.TextMatrix(i, 5)))
          rs5.Fields("库存金额") = Val(rs5.Fields("库存数量")) * Val(rs5.Fields("进价"))
          rs5.Update
        End If
      End If
      rs5.Close
     End If
    Next i
    rs1.Close     '关闭数据集对象
    Combc.Enabled = False: Comdj.Enabled = True: Comqx.Enabled = False
    Text1.Visible = False: MS1.Enabled = False: grid1.Visible = False
    '清空数据
     For i = 1 To 100
     For j = 1 To 8
         MS1.TextMatrix(i, j) = ""
     Next j
     Next i
     pz.text = "0": hjsl.text = "0": hjje.text = "0"
   Else
     MsgBox ("填写数据不完整,请核对,再保存")
     MS1.Col = 1: MS1.Row = 1
     grid1.Visible = False
  End If
End Sub
Private Sub Comqx_Click()     '取消操作
 For i = 1 To 101
 For j = 1 To 8
     MS1.TextMatrix(i, j) = ""
 Next j
 Next i
 MS1.Enabled = False: Comdj.Enabled = True
 pz.text = "0": hjje.text = "0": hjsl.text = "0"
 Comdj.SetFocus
End Sub
Private Sub ComExit_Click()
 main_qtgl_ktgl.Enabled = True
 Unload Me
End Sub
Private Sub Text1_LostFocus()
    If MS1.TextMatrix(MS1.Row, 7) = "赠单" Then
        MS1.TextMatrix(MS1.Row, 6) = ""
        MS1.TextMatrix(MS1.Row, 6) = 0
    ElseIf MS1.Col = 4 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    ElseIf MS1.Col = 5 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
    End If
End Sub

⌨️ 快捷键说明

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