📄 frmtiaojia.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 frmTiaoJia
BorderStyle = 1 'Fixed Single
Caption = " 调 价"
ClientHeight = 6075
ClientLeft = 45
ClientTop = 435
ClientWidth = 9105
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmTiaoJia.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 6075
ScaleWidth = 9105
Begin MSComctlLib.ImageList ilt
Left = 120
Top = 1650
_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 = "frmTiaoJia.frx":1042
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmTiaoJia.frx":2094
Key = ""
EndProperty
EndProperty
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1365
Left = 60
ScaleHeight = 1335
ScaleWidth = 8925
TabIndex = 2
Top = 4650
Width = 8955
Begin Manage.xpcmdbutton cmdSave
Height = 375
Left = 7830
TabIndex = 11
Top = 720
Width = 885
_ExtentX = 1561
_ExtentY = 661
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 cmdEdit
Height = 375
Left = 7830
TabIndex = 10
Top = 180
Width = 885
_ExtentX = 1561
_ExtentY = 661
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.TextBox txtPrice
Appearance = 0 'Flat
Height = 345
Left = 5970
TabIndex = 5
Top = 720
Width = 1605
End
Begin VB.Label lblUnit
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 345
Left = 930
TabIndex = 14
Top = 750
Width = 1125
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "单 位"
Height = 210
Index = 2
Left = 180
TabIndex = 13
Top = 810
Width = 630
End
Begin VB.Label lblPrice
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 345
Left = 3150
TabIndex = 12
Top = 750
Width = 1545
End
Begin VB.Label lblName
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 345
Left = 4950
TabIndex = 9
Top = 210
Width = 2595
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "商品名称"
Height = 210
Index = 1
Left = 3960
TabIndex = 8
Top = 240
Width = 840
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "调 价"
Height = 210
Index = 19
Left = 5220
TabIndex = 7
Top = 810
Width = 630
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "现 价"
Height = 210
Index = 14
Left = 2460
TabIndex = 6
Top = 810
Width = 630
End
Begin VB.Label lblID
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 345
Left = 1140
TabIndex = 4
Top = 210
Width = 2595
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "商品编码"
Height = 210
Index = 0
Left = 150
TabIndex = 3
Top = 240
Width = 840
End
End
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 4485
Left = 2760
TabIndex = 1
Top = 90
Width = 6255
_ExtentX = 11033
_ExtentY = 7911
_Version = 393216
Cols = 5
FixedCols = 0
Appearance = 0
End
Begin MSComctlLib.TreeView tvw
Height = 4485
Left = 60
TabIndex = 0
Top = 90
Width = 2625
_ExtentX = 4630
_ExtentY = 7911
_Version = 393217
HideSelection = 0 'False
Indentation = 353
LabelEdit = 1
LineStyle = 1
Style = 7
ImageList = "ilt"
BorderStyle = 1
Appearance = 0
End
End
Attribute VB_Name = "frmTiaoJia"
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
txtPrice.Locked = False
Grid.Enabled = False
tvw.Enabled = False
txtPrice.SetFocus
Else
cmdEdit.Caption = "修 改"
cmdSave.Enabled = False
txtPrice.Locked = True
txtPrice.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(txtPrice.Text) = False Then MsgBox "您填写的价格不是有效的数字!", 64: Exit Sub
SQL = "update yaopin_unit set price =" & txtPrice.Text & _
" where id='" & lblID.Caption & "' and unit='" & lblUnit.Caption & "'"
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Grid.TextMatrix(Grid.RowSel, 3) = txtPrice.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
txtPrice.Locked = True
Grid.FormatString = " 商 品 编 码|^ 商 品 名 称|^ 单 位|^ 现 价"
tvw.Nodes.Add , , "all", "所有类别", 1
Pid = tvw.Nodes(1).Index
'Set tvw.ImageList = ilt
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)
lblPrice.Caption = Grid.TextMatrix(Grid.RowSel, 3)
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,price from v_yaopin_list"
Else
SQL = "select id,name,unit,price from v_yaopin_list where id like '" & Mid(Node.Key, 2) & "%'"
End If
FillGrid " 商 品 编 码|^ 商 品 名 称|^ 单 位|^ 现 价", SQL, Grid, 4
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 Then KeyAscii = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -