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

📄 frmsplb.frm

📁 一个简单的用vb制作的公司贸易管理系统
💻 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       =   4110
   ClientWidth     =   9435
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6120
   ScaleWidth      =   9435
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame2 
      Caption         =   "商品列表"
      Height          =   5655
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   9255
      Begin MSFlexGridLib.MSFlexGrid Grid 
         Height          =   5295
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   9015
         _ExtentX        =   15901
         _ExtentY        =   9340
         _Version        =   393216
         Cols            =   6
         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        =   1
      Top             =   5865
      Width           =   9435
      _ExtentX        =   16642
      _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
Dim txtsql, Msgtext As String

Private Sub Form_Load()

    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 product " & SQLTJ & " order by spmc"
    '    Else
    '        SQL = "select * from SP order by spmc"
    '    End If
    '    Rst.Open SQL, db, 1, 3

    txtsql = "select * from products"
    ' where 工厂编号='" & FrmRKD.Combo1.Text & "'"

    Set Rst = ExecuteSQL(txtsql, Msgtext)

    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(6)
        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)

        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 products where productid=" & Grid.TextMatrix(Grid.RowSel, 0)
        'Set OpenSPRs = New ADODB.Recordset
        'OpenSPRs.Open SQL, db, 1, 3
        Set OpenSPRs = ExecuteSQL(SQL, Msgtext)

        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("cn_productname")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 2) = OpenSPRs.Fields("工厂货号")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 3) = OpenSPRs.Fields("产品规格")
        FrmSELL.Grid.TextMatrix(FrmSELL.Grid.Rows - 1, 4) = OpenSPRs.Fields("产品材料")
        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("productid")
        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 Grid_KeyUp(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
      Case vbKeyEscape
        Unload Me
    End Select
End Sub

⌨️ 快捷键说明

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