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

📄 main.frm

📁 超市管理系统,有课程设计电子文档
💻 FRM
字号:
VERSION 5.00
Begin VB.MDIForm frmMain 
   BackColor       =   &H8000000C&
   Caption         =   "超市管理系统"
   ClientHeight    =   4620
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   6480
   LinkTopic       =   "MDIForm1"
   Picture         =   "Main.frx":0000
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   5000
      Left            =   1320
      Top             =   720
   End
   Begin VB.Menu mnuSystem 
      Caption         =   "系统(&S)"
      Begin VB.Menu mnuSystemUser 
         Caption         =   "用户管理(&U)"
      End
      Begin VB.Menu mnuSystemLogin 
         Caption         =   "重新登录(&L)..."
      End
      Begin VB.Menu mnuSystemBar 
         Caption         =   "-"
      End
      Begin VB.Menu mnuSystemExit 
         Caption         =   "退出(&X)"
      End
   End
   Begin VB.Menu mnuProduct 
      Caption         =   "商品信息(&P)"
      Begin VB.Menu mnuProductAdd 
         Caption         =   "添加商品信息(&A)"
      End
      Begin VB.Menu mnuProductList 
         Caption         =   "显示商品列表(&L)"
      End
      Begin VB.Menu mnuProductChart 
         Caption         =   "商品库存状态(&S)"
      End
      Begin VB.Menu mnuProductFind 
         Caption         =   "查询商品信息(&F)..."
      End
   End
   Begin VB.Menu mnuStock 
      Caption         =   "进货(S)"
      Begin VB.Menu mnuStockAdd 
         Caption         =   "添加进货信息(&A)"
      End
      Begin VB.Menu mnuStockList 
         Caption         =   "显示进货列表(&L)"
      End
      Begin VB.Menu mnuStockFind 
         Caption         =   "查询进货信息(&F)..."
      End
   End
   Begin VB.Menu mnuSell 
      Caption         =   "销售(&I)"
      Begin VB.Menu mnuSellAdd 
         Caption         =   "添加销售信息(&A)"
      End
      Begin VB.Menu mnuSellList 
         Caption         =   "显示销售列表(&L)"
      End
      Begin VB.Menu mnuSellFind 
         Caption         =   "查询销售信息(&C)..."
      End
   End
   Begin VB.Menu mnuworker 
      Caption         =   "员工管理(&W)"
      Begin VB.Menu mnuworkerinfo 
         Caption         =   "员工信息(&W)"
         Begin VB.Menu mnuworkerinfoadd 
            Caption         =   "添加员工信息(&A)"
         End
         Begin VB.Menu mnuworkerinfocor 
            Caption         =   "修改员工信息(&C)"
         End
         Begin VB.Menu mnuworkerinfodel 
            Caption         =   "删除员工信息(&D)"
         End
         Begin VB.Menu mnuworkerinfofin 
            Caption         =   "查询员工信息(&F)"
         End
      End
      Begin VB.Menu mnuaffairsduty 
         Caption         =   "内勤管理(&D)"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "帮助(&H)"
      Begin VB.Menu mnuHelpAbout 
         Caption         =   "关于(&A)..."
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub MDIForm_Activate()
    Timer1.Interval = 3000
    Timer1.Enabled = True
End Sub

Private Sub MDIForm_Load()
    Screen.MousePointer = 11
    frmlogining.Show
    SetWindowPos frmlogining.hwnd, HWND_TOPMOST, _
        0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
    On Error GoTo errHandler
   
    Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
    Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
    Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
    Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
    
    
    Select Case gnUserType
        Case 0:
            mnuSystem.Visible = True
            mnuProduct.Visible = True
            mnuStock.Visible = True
            mnuSell.Visible = True
            mnuHelp.Visible = True
            mnuworker.Visible = True
            
        Case 1:
            mnuSystem.Visible = True
            mnuProduct.Visible = True
            mnuStock.Visible = True
            mnuSell.Visible = False
            mnuHelp.Visible = True
            mnuworker.Visible = False
        Case 2:
            mnuSystem.Visible = True
            mnuProduct.Visible = True
            mnuStock.Visible = False
            mnuSell.Visible = True
            mnuHelp.Visible = True
            mnuworker.Visible = False
        End Select
    
    Exit Sub
    
errHandler:
    MsgBox Err.Description, vbCritical, "错误"
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
    
    If Me.WindowState <> vbMinimized Then
        SaveSetting App.Title, "Settings", "MainLeft", Me.Left
        SaveSetting App.Title, "Settings", "MainTop", Me.Top
        SaveSetting App.Title, "Settings", "MainWidth", Me.Width
        SaveSetting App.Title, "Settings", "MainHeight", Me.Height
    End If
    
    On Error Resume Next
   
    gConn.Close
End Sub


Private Sub mnuaffairs_Click()

End Sub

Private Sub mnuaffairsduty_Click()
frmleiqing.Show
End Sub

Private Sub mnuHelpAbout_Click()
    frmAbout.Show vbModal
End Sub

Private Sub mnuProductAdd_Click()
    
    frmProduct.mbAddMode = True
If gnUserType = 1 Or gnUserType = 0 Then
    frmProduct.Show vbModal
    End If
End Sub

Private Sub mnuProductChart_Click()
   
    Dim rs As New ADODB.Recordset
    rs.Open "select * from products", gConn, adOpenStatic

    Load frmChart
    frmChart.Caption = "当前商品的库存状态"
    
   
    Dim arr()
    ReDim arr(1 To rs.RecordCount, 1 To 2)
    Dim i As Integer
    i = 1
    rs.MoveFirst
    Dim str As String
    While Not rs.EOF
        str = Trim(rs("商品名称"))
        arr(i, 1) = "" & str & ""
        arr(i, 2) = rs("库存数量")
        i = i + 1
        rs.MoveNext
    Wend
            
    With frmChart.charReport
        .Title = "当前商品的库存状态"
        .ChartData = arr
    End With
    
    rs.Close
    
    frmChart.Show vbModal
End Sub

Private Sub mnuProductFind_Click()
    mnuProductList_Click
    frmProductList.cmdfind.Value = True
End Sub

Private Sub mnuProductList_Click()
    Load frmProductList
    frmProductList.SQL = "select * from products"
    frmProductList.Show
End Sub

Private Sub mnuSellAdd_Click()
    frmSell.mbAddMode = True
    frmSell.Show vbModal
End Sub

Private Sub mnuSellFind_Click()
    mnuSellList_Click
    frmSellList.cmdfind.Value = True
End Sub

Private Sub mnuSellList_Click()
    Load frmSellList
    frmSellList.SQL = "select * from sell"
    frmSellList.Show
End Sub

Private Sub mnuStockAdd_Click()
    frmStock.mbAddMode = True
    frmStock.Show vbModal
End Sub

Private Sub mnuStockFind_Click()
    mnuStockList_Click
    frmStockList.cmdfind.Value = True
End Sub

Private Sub mnuStockList_Click()
    Load frmStockList
    frmStockList.SQL = "select * from stock"
    frmStockList.Show
End Sub

Private Sub mnuSystemExit_Click()
    Unload Me
End Sub

Private Sub mnuSystemLogin_Click()
    Unload Me
    frmLogin.Show
End Sub

Private Sub mnuSystemUser_Click()
If gnUserType = 0 Then
    frmUser.Show
End If
End Sub

Private Sub mnuworkerinfoadd_Click()
frmstaff.mbAddMode = True
    frmstaff.Show vbModal
End Sub

Private Sub mnuworkerinfocor_Click()
Load frmstafflist
    frmstafflist.SQL = "select * from staff"
    frmstafflist.Show
End Sub

Private Sub mnuworkerinfodel_Click()
Load frmstafflist
    frmstafflist.SQL = "select * from staff"
    frmstafflist.Show
End Sub

Private Sub mnuworkerinfofin_Click()
Load frmstafflist
  frmstafflist.SQL = "select * from staff"
    frmstafflist.Show

End Sub

Private Sub Timer1_Timer()
frmMain.Timer1.Enabled = False
   
    Unload frmlogining
   
    Screen.MousePointer = 0
End Sub

⌨️ 快捷键说明

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