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

📄 main_qtgl_ktgl_jcfw.frm

📁 毕业论文 看看 毕业论文 看看 毕业论文 看看
💻 FRM
📖 第 1 页 / 共 4 页
字号:
         BeginProperty Column12 
            ColumnWidth     =   14.74
         EndProperty
      EndProperty
   End
   Begin MSFlexGridLib.MSFlexGrid MS1 
      Height          =   1935
      Left            =   15
      TabIndex        =   20
      Top             =   1320
      Width           =   11160
      _ExtentX        =   19685
      _ExtentY        =   3413
      _Version        =   393216
      Rows            =   1
      Cols            =   1
      FixedRows       =   0
      FixedCols       =   0
      BackColor       =   16777215
      BackColorFixed  =   8421504
      ForeColorSel    =   16777215
      BackColorBkg    =   16777215
      GridColorFixed  =   16777215
      Enabled         =   0   'False
      FocusRect       =   2
      ScrollBars      =   2
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Frame Frame2 
      Height          =   705
      Left            =   7545
      TabIndex        =   21
      Top             =   30
      Width           =   3600
      Begin VB.Label labrq 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H0000C000&
         Height          =   195
         Left            =   1260
         TabIndex        =   37
         Top             =   315
         Width           =   2145
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "点单日期:"
         Height          =   225
         Left            =   150
         TabIndex        =   24
         Top             =   330
         Width           =   915
      End
   End
   Begin VB.Frame Frame4 
      Height          =   705
      Left            =   7545
      TabIndex        =   22
      Top             =   585
      Width           =   3600
      Begin VB.Label djh 
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FF0000&
         Height          =   195
         Left            =   1260
         TabIndex        =   38
         Top             =   330
         Width           =   2175
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "结帐单据号:"
         Height          =   225
         Left            =   150
         TabIndex        =   23
         Top             =   330
         Width           =   1110
      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 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
 Adodc3.RecordSource = "select * from 点单临时表 where 房台编号='" + Label4(0).Caption + "'"
 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()
 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
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)
  If KeyCode = vbKeyReturn Then
   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
  End If
  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 frm_main.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 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 frm_main.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
  End If
  If KeyCode = vbKeyLeft Then Call frm_main.moveleft     '调用函数
  If KeyCode = vbKeyRight Then Call frm_main.moveright     '调用函数
  If KeyCode = vbKeyPageDown Then
   If MS1.Col = 1 Then
    Adodc2.RecordSource = "select * from 商品基础信息表 where 商品级别='3级'"
    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的记录
      Adodc2.RecordSource = "select * from 商品基础信息表 where (本级名称 like '" + Text1.text + "'+ '%')or(本级简称  like '" + Text1.text + "'+'%')and 商品基础信息表.商品级别='3级'"
      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.Col = 4 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
  If MS1.Col = 5 Then MS1.TextMatrix(MS1.Row, 6) = Val(MS1.TextMatrix(MS1.Row, 4)) * Val(MS1.TextMatrix(MS1.Row, 5))
  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

⌨️ 快捷键说明

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