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

📄 frmstockview.frm

📁 < 飞鸿商品>>零售是基于VB+SQL2000开的商品零售管理系统. 开发的很好.可以一看
💻 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 frmStockView 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "库存浏览"
   ClientHeight    =   7050
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9945
   Icon            =   "frmStockView.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   7050
   ScaleWidth      =   9945
   Begin VB.PictureBox picQuery 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   2295
      Left            =   2760
      ScaleHeight     =   2265
      ScaleWidth      =   7095
      TabIndex        =   0
      Top             =   3990
      Width           =   7125
      Begin VB.ComboBox cobObject 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1470
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   690
         Width           =   1965
      End
      Begin VB.ComboBox cobOper 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   4860
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   690
         Width           =   1725
      End
      Begin VB.TextBox txt 
         Appearance      =   0  'Flat
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   780
         TabIndex        =   3
         Top             =   1230
         Width           =   5745
      End
      Begin Manage.xpcmdbutton cmdCancel 
         Height          =   345
         Left            =   4770
         TabIndex        =   1
         Top             =   1740
         Width           =   1005
         _ExtentX        =   1773
         _ExtentY        =   609
         Caption         =   "取  消"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Manage.xpcmdbutton cmdExec 
         Height          =   345
         Left            =   2580
         TabIndex        =   2
         Top             =   1740
         Width           =   1005
         _ExtentX        =   1773
         _ExtentY        =   609
         Caption         =   "执  行"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "请指定查询条件"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   0
         Left            =   360
         TabIndex        =   9
         Top             =   240
         Width           =   1470
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "查询对象"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   1
         Left            =   420
         TabIndex        =   8
         Top             =   780
         Width           =   840
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "运算符"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   2
         Left            =   4110
         TabIndex        =   7
         Top             =   780
         Width           =   630
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "值"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   3
         Left            =   420
         TabIndex        =   6
         Top             =   1290
         Width           =   210
      End
   End
   Begin Manage.xpcmdbutton cmdClose 
      Height          =   435
      Left            =   7140
      TabIndex        =   10
      Top             =   6450
      Width           =   1365
      _ExtentX        =   2408
      _ExtentY        =   767
      Caption         =   "关  闭"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin Manage.xpcmdbutton cmdQuery 
      Height          =   435
      Left            =   4920
      TabIndex        =   11
      Top             =   6450
      Width           =   1365
      _ExtentX        =   2408
      _ExtentY        =   767
      Caption         =   "查  询"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSFlexGridLib.MSFlexGrid Grid 
      Height          =   3855
      Left            =   2760
      TabIndex        =   12
      Top             =   60
      Width           =   7125
      _ExtentX        =   12568
      _ExtentY        =   6800
      _Version        =   393216
      Cols            =   5
      FixedCols       =   0
      Appearance      =   0
      FormatString    =   "  商 品 编 码|^ 商 品 名 称 |^ 单    位|^  厂    家      |^ 库 存 数 量"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.TreeView tvw 
      Height          =   6225
      Left            =   60
      TabIndex        =   13
      Top             =   60
      Width           =   2625
      _ExtentX        =   4630
      _ExtentY        =   10980
      _Version        =   393217
      HideSelection   =   0   'False
      Indentation     =   353
      LabelEdit       =   1
      LineStyle       =   1
      Style           =   7
      ImageList       =   "ImageList1"
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1140
      Top             =   6420
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmStockView.frx":1042
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmStockView.frx":2094
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmStockView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCancel_Click()
  picQuery.Visible = False
  cobObject.ListIndex = -1
  cobOper.ListIndex = -1
  txt.Text = ""
  tvw.Enabled = True
  Grid.Height = 6225
End Sub

Private Sub cmdClose_Click()
  Unload Me
End Sub

Private Sub cmdExec_Click()
If cobOper.ListIndex = -1 Or cobObject.ListIndex = -1 Or txt.Text = "" Then Exit Sub

Dim A As Collection, B As Collection
Dim SQL As String

Set A = New Collection
Set B = New Collection
A.Add "id"
A.Add "name"
A.Add "changjia"
A.Add "stock"
B.Add "="
B.Add ">"
B.Add "<"
B.Add "like"

If cobObject.ListIndex = 3 Then
  SQL = "select id,name,unit,changjia,stock from v_stock where switch=1 and " _
      & "" & A(cobObject.ListIndex + 1) & " " & B(cobOper.ListIndex + 1) & " " & txt.Text
Else
  If cobOper.ListIndex = 3 Then
    SQL = "select id,name,unit,changjia,stock from v_stock where switch=1 and " _
        & "" & A(cobObject.ListIndex + 1) & " " & B(cobOper.ListIndex + 1) & "'%" & txt.Text & "%'"
  Else
    SQL = "select id,name,unit,changjia,stock from v_stock where switch=1 and " _
        & "" & A(cobObject.ListIndex + 1) & " " & B(cobOper.ListIndex + 1) & " '" & txt.Text & "'"
  End If
End If

FillGrid "  商 品 编 码|^ 商 品 名 称 |^ 单    位|^  厂    家      |^ 库 存 数 量", SQL, Grid, 5
Set A = Nothing
Set B = Nothing

cmdCancel_Click

End Sub

Private Sub cmdQuery_Click()
  Grid.Height = 3855
  cobObject.ListIndex = -1
  cobOper.ListIndex = -1
  txt.Text = ""
  picQuery.Visible = True
  tvw.Enabled = False
End Sub

Private Sub Form_Load()
Dim Rst As ADODB.Recordset
Dim CRst As ADODB.Recordset
Dim SQL As String
Dim I As Integer
Dim J As Integer
Dim Pid As Integer
Dim Nod As Node

picQuery.Visible = False
Grid.Height = 6225
Grid.FormatString = "  商 品 编 码|^ 商 品 名 称 |^ 单    位|^  厂    家      |^ 库 存 数 量"

cobObject.AddItem "商品编码"
cobObject.AddItem "商品名称"
cobObject.AddItem "生产厂家"
cobObject.AddItem "库存数量"

cobOper.AddItem "等于"
cobOper.AddItem "大于"
cobOper.AddItem "小于"
cobOper.AddItem "包含"

tvw.Nodes.Add , , "all", "所有类别", 1
Pid = tvw.Nodes(1).Index
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select * from yaopin_types where len(id)=2"
Rst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If Rst.EOF Then Exit Sub

For I = 1 To Rst.RecordCount
  Set Nod = tvw.Nodes.Add
  Nod.Text = Rst.Fields("name").Value
  Nod.Key = "n" & Rst.Fields("id").Value
  Nod.Image = 1
  Set Nod.Parent = tvw.Nodes(1)
  
  Set CRst = New ADODB.Recordset
  CRst.CursorLocation = adUseClient
  SQL = "select * from yaopin_types where id like '" & Rst.Fields("id") & "%' and len(id)=4"
  CRst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
  If CRst.EOF Then GoTo move1
  
  For J = 1 To CRst.RecordCount
    tvw.Nodes.Add Nod.Index, tvwChild, "s" & CRst.Fields("id"), CRst.Fields("name").Value, 1
    CRst.MoveNext
  Next
move1:
  CRst.Close
  Set CRst = Nothing
  
  Rst.MoveNext
Next
Rst.Close

Set Rst = Nothing
End Sub


Private Sub tvw_NodeClick(ByVal Node As MSComctlLib.Node)
Dim SQL As String
Dim ID As String

If Node.Key = "all" Then
  SQL = "select id,name,unit,changjia,stock from v_stock where switch=1"
Else
  SQL = "select id,name,unit,changjia,stock from v_stock where switch=1 and id like '" & Mid(Node.Key, 2) & "%'"
End If

FillGrid "  商 品 编 码|^ 商 品 名 称 |^ 单    位|^  厂    家      |^ 库 存 数 量", SQL, Grid, 5

End Sub

⌨️ 快捷键说明

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