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

📄 frmxianzi.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 frmXianZi 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "设置库存上下限"
   ClientHeight    =   6045
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9075
   Icon            =   "frmXianZi.frx":0000
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   6045
   ScaleWidth      =   9075
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1620
      Top             =   3090
      _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         =   "frmXianZi.frx":08CA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmXianZi.frx":191C
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   1365
      Left            =   60
      ScaleHeight     =   1335
      ScaleWidth      =   8925
      TabIndex        =   0
      Top             =   4620
      Width           =   8955
      Begin VB.TextBox txtShang 
         Appearance      =   0  'Flat
         Height          =   345
         Left            =   3240
         TabIndex        =   14
         Top             =   750
         Width           =   1605
      End
      Begin VB.TextBox txtXia 
         Appearance      =   0  'Flat
         Height          =   345
         Left            =   5970
         TabIndex        =   3
         Top             =   720
         Width           =   1605
      End
      Begin Manage.xpcmdbutton cmdSave 
         Height          =   375
         Left            =   7830
         TabIndex        =   1
         Top             =   720
         Width           =   885
         _ExtentX        =   1561
         _ExtentY        =   661
         Caption         =   "保  存"
         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 Manage.xpcmdbutton cmdEdit 
         Height          =   375
         Left            =   7830
         TabIndex        =   2
         Top             =   180
         Width           =   885
         _ExtentX        =   1561
         _ExtentY        =   661
         Caption         =   "修  改"
         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.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            =   150
         TabIndex        =   11
         Top             =   240
         Width           =   840
      End
      Begin VB.Label lblID 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         ForeColor       =   &H80000008&
         Height          =   345
         Left            =   1140
         TabIndex        =   10
         Top             =   210
         Width           =   2595
      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           =   14
         Left            =   2460
         TabIndex        =   9
         Top             =   810
         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           =   19
         Left            =   5220
         TabIndex        =   8
         Top             =   810
         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           =   1
         Left            =   3960
         TabIndex        =   7
         Top             =   240
         Width           =   840
      End
      Begin VB.Label lblName 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         ForeColor       =   &H80000008&
         Height          =   345
         Left            =   4950
         TabIndex        =   6
         Top             =   210
         Width           =   2595
      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            =   180
         TabIndex        =   5
         Top             =   810
         Width           =   630
      End
      Begin VB.Label lblUnit 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         ForeColor       =   &H80000008&
         Height          =   345
         Left            =   930
         TabIndex        =   4
         Top             =   750
         Width           =   795
      End
   End
   Begin MSFlexGridLib.MSFlexGrid Grid 
      Height          =   4485
      Left            =   2760
      TabIndex        =   12
      Top             =   60
      Width           =   6255
      _ExtentX        =   11033
      _ExtentY        =   7911
      _Version        =   393216
      Cols            =   5
      FixedCols       =   0
      SelectionMode   =   1
      AllowUserResizing=   2
      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          =   4485
      Left            =   60
      TabIndex        =   13
      Top             =   60
      Width           =   2625
      _ExtentX        =   4630
      _ExtentY        =   7911
      _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            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "frmXianZi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdEdit_Click()
If cmdEdit.Caption = "修  改" Then
  cmdEdit.Caption = "取  消"
  cmdSave.Enabled = True
  txtShang.Locked = False
  txtXia.Locked = False
  Grid.Enabled = False
  tvw.Enabled = False
  txtShang.SetFocus
  txtShang.SelStart = 0
  txtShang.SelLength = Len(txtShang.Text)
Else
  cmdEdit.Caption = "修  改"
  cmdSave.Enabled = False
  txtShang.Locked = True
  txtXia.Locked = True
  txtShang.Text = ""
  txtXia.Text = ""
  Grid.Enabled = True
  tvw.Enabled = True
End If
End Sub

Private Sub cmdSave_Click()
Dim Cmd As ADODB.Command
Dim SQL As String

If IsNumeric(txtShang.Text) = False Or IsNumeric(txtXia.Text) = False Then MsgBox "您填写的库存限制不是有效的数字!", 64: Exit Sub

SQL = "update yaopin_list set kushang ='" & txtShang.Text & "',kuxia='" & txtXia.Text & _
    "' where id='" & lblID.Caption & "'"
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute

Grid.TextMatrix(Grid.RowSel, 3) = txtShang.Text
Grid.TextMatrix(Grid.RowSel, 4) = txtXia.Text

cmdEdit_Click

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

cmdSave.Enabled = False
txtShang.Locked = True
txtXia.Locked = True
Grid.FormatString = " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 上 限  |^ 下 限  "


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 Grid_Click()
If Grid.Text = "" Then Exit Sub

lblID.Caption = Grid.TextMatrix(Grid.RowSel, 0)
lblName.Caption = Grid.TextMatrix(Grid.RowSel, 1)
lblUnit.Caption = Grid.TextMatrix(Grid.RowSel, 2)
txtShang.Text = Grid.TextMatrix(Grid.RowSel, 3)
txtXia.Text = Grid.TextMatrix(Grid.RowSel, 4)

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,kushang,kuxia from v_yaopin_list where switch=1"
Else
  SQL = "select id,name,unit,kushang,kuxia from v_yaopin_list where switch=1 and id like '" & Mid(Node.Key, 2) & "%'"
End If

FillGrid " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 上 限  |^ 下 限  ", SQL, Grid, 5

End Sub

Private Sub txtShang_KeyPress(KeyAscii As Integer)
  If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 46 And KeyAscii <> 8 Then KeyAscii = 0
End Sub

Private Sub txtXia_KeyPress(KeyAscii As Integer)
  If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 46 And KeyAscii <> 8 Then KeyAscii = 0
End Sub

⌨️ 快捷键说明

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