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

📄 frmsplb.frm

📁 一个小型的进销存管理软件,数据采用ACCE
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FrmSPLB 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "商品列表"
   ClientHeight    =   6120
   ClientLeft      =   3435
   ClientTop       =   4005
   ClientWidth     =   11595
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6120
   ScaleWidth      =   11595
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      Caption         =   "商品分类"
      Height          =   5655
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   2535
      Begin MSComctlLib.TreeView TVLB 
         Height          =   5295
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   9340
         _Version        =   393217
         Style           =   5
         ImageList       =   "ImageList2"
         BorderStyle     =   1
         Appearance      =   1
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "商品列表"
      Height          =   5655
      Left            =   2760
      TabIndex        =   0
      Top             =   120
      Width           =   8775
      Begin MSFlexGridLib.MSFlexGrid Grid 
         Height          =   5295
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   8535
         _ExtentX        =   15055
         _ExtentY        =   9340
         _Version        =   393216
         Cols            =   7
         FixedCols       =   0
         RowHeightMin    =   315
         SelectionMode   =   1
         FormatString    =   "商品编码|^ 类 别 码 |^      商  品  名  称 |^      货   号  |^ 规 格 |^ 单  位 |^   产         地 "
      End
      Begin MSComctlLib.ImageList ImageList2 
         Left            =   720
         Top             =   2160
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   16
         ImageHeight     =   16
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   1
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FrmSPLB.frx":0000
               Key             =   ""
            EndProperty
         EndProperty
      End
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   3
      Top             =   5865
      Width           =   11595
      _ExtentX        =   20452
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "FrmSPLB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim index As Integer
Dim Rst, TreeRs, BindRs As ADODB.Recordset
Dim Flag As Boolean
Dim SPLBBM As Integer
Dim SPID As Integer
Dim SQLTJ As String

Private Sub Form_Load()
   
    Call TVLB_Bind
    Call ReSet
    Call FillGrid
        
End Sub
Sub ReSet()
    Grid.Clear
    Grid.Rows = 1
    Grid.FormatString = "商品编码|^ 类 别 码 |^      商  品  名  称 |^      货   号  |^ 规 格 |^ 单  位 |^   产         地 "
End Sub
Sub FillGrid() '商品列表
    Set Rst = New Recordset
    If SQLTJ <> "" Then
        SQL = "select * from SP " & SQLTJ & " order by spmc"
    Else
        SQL = "select * from SP order by spmc"
    End If
    Rst.Open SQL, db, 1, 3
    
    If Rst.EOF Then Exit Sub
    
    Do While Not Rst.EOF
        Grid.Rows = Grid.Rows + 1
        Grid.TextMatrix(Grid.Rows - 1, 0) = Rst.Fields(0)
        Grid.TextMatrix(Grid.Rows - 1, 1) = Rst.Fields(1)
        Grid.TextMatrix(Grid.Rows - 1, 2) = Rst.Fields(2)
        Grid.TextMatrix(Grid.Rows - 1, 3) = Rst.Fields(3)
        Grid.TextMatrix(Grid.Rows - 1, 4) = Rst.Fields(4)
        Grid.TextMatrix(Grid.Rows - 1, 5) = Rst.Fields(5)
        Grid.TextMatrix(Grid.Rows - 1, 6) = Rst.Fields(6)
        Rst.MoveNext
    Loop
    
    SQLTJ = ""
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload Me
End Sub

Private Sub Grid_DblClick()
Dim SumNum, I As Integer
Dim SumJE, SumSE, SumJSHJ As Double

    Dim OpenSPRs As ADODB.Recordset
    If Grid.TextMatrix(Grid.RowSel, 0) <> "" Then
        SQL = "select * from SP where spid=" & Grid.TextMatrix(Grid.RowSel, 0)
    Set OpenSPRs = New ADODB.Recordset
        OpenSPRs.Open SQL, db, 1, 3
        
        If OpenSPRs.EOF Then GoTo Move2:
        
        For I = 1 To IDlist.Count
            If OpenSPRs.Fields(0).Value = IDlist(I) Then GoTo Move2:
        Next
        
        
        FrmSELL.Grid.Rows = FrmSELL.Grid.Rows + 1
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 0) = FrmSELL.Grid.Rows - 1
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 1) = OpenSPRs.Fields("spmc")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 2) = OpenSPRs.Fields("hh")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 3) = OpenSPRs.Fields("gg")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 4) = OpenSPRs.Fields("dw")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 5) = "0"
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 6) = Format(0, "##0.00")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 7) = Format(FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 5) * FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 6), "0.00")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 8) = "0.22"
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 9) = Format(CStr(FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 7) * 0.22), "0.00")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 10) = Format(CStr(FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 7) * (1 + FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 8))), "0.00")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 11) = OpenSPRs.Fields("spid")
        IDlist.Add OpenSPRs.Fields(0).Value
           
        For I = 1 To FrmSELL.Grid.Rows - 1
          SumNum = SumNum + Val(FrmSELL.Grid.TextMatrix(I, 5))
          SumJE = SumJE + Val(FrmSELL.Grid.TextMatrix(I, 7))
          SumSE = SumSE + Val(FrmSELL.Grid.TextMatrix(I, 9))
          SumJSHJ = SumJSHJ + Val(FrmSELL.Grid.TextMatrix(I, 10))
        Next
        
        FrmSELL.lblSL.Caption = SumNum
        FrmSELL.lblJE.Caption = Format(CStr(SumJE), "0.00")
        FrmSELL.lblSE.Caption = Format(CStr(SumSE), "0.00")
        FrmSELL.lblJSHJ.Caption = Format(CStr(SumJSHJ), "0.00")
    
    

Move2:
    OpenSPRs.Close
    Set OpenSPRs = Nothing

    End If
    
    Unload Me
    
End Sub



Private Sub TVLB_Bind()
    Dim Pid As Integer
    Dim nod As Node
    Dim I As Integer
    
    TVLB.Nodes.Clear
    TVLB.Nodes.Add , , , "所有类别", 1
    Pid = TVLB.Nodes(1).index
    
    
    Set BindRs = New ADODB.Recordset
        BindRs.Open "select * from SP_LB", db, 1, 3
    If BindRs.EOF Then GoTo move1:
    
    
    For I = 1 To BindRs.RecordCount
        Set nod = TVLB.Nodes.Add
        nod.Text = BindRs.Fields("SPLBMC")
        nod.Image = 1
        Set nod.Parent = TVLB.Nodes(1)
        
        BindRs.MoveNext
    Next
    
move1:
    BindRs.Close
    Set BindRs = Nothing
    
End Sub


Private Sub Grid_KeyUp(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyEscape
            Unload Me
    End Select
End Sub

Private Sub TVLB_KeyUp(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyEscape
            Unload Me
    End Select
End Sub

Private Sub TVLB_NodeClick(ByVal Node As MSComctlLib.Node)
    Dim LBMC, SPLBID As String
    
    If Node.index = 1 Then
        Call ReSet
        Call FillGrid
        Exit Sub
    End If
    
    index = TVLB.SelectedItem.index
    
    LBMC = TVLB.Nodes.Item(index).Text
    
    Set TreeRs = New Recordset
        SQL = "select SPLB_ID from SP_LB where SPLBMC='" & LBMC & "'"
        TreeRs.Open SQL, db, 1, 3
        
    SPLBID = TreeRs.Fields(0)
        
    SQLTJ = " where splb=" & SPLBID
    
    Call ReSet
    Call FillGrid
End Sub


⌨️ 快捷键说明

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