📄 frmspzl.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 FrmSPZL
BorderStyle = 1 'Fixed Single
Caption = "商品资料"
ClientHeight = 6135
ClientLeft = 3405
ClientTop = 2880
ClientWidth = 9435
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6135
ScaleWidth = 9435
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame2
Caption = "商品列表"
Height = 5655
Left = 120
TabIndex = 1
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
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 0
Top = 5880
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 = "FrmSPZL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Index As Integer
Dim TreeRs As ADODB.Recordset
Dim Rst As Recordset
Dim Flag As Boolean
Dim SPLBBM As Integer
Dim CheckRs As ADODB.Recordset
Dim BindRs As ADODB.Recordset
Dim DelRs As ADODB.Recordset
Dim SPID As Integer
Dim ModifyFlag As Integer
Dim SQLTJ, Msgtext As String
Dim txtsql 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
' txtsql = "select * from products" & SQLTJ & " order by cn_productName"
' Else
txtsql = "select * from products where 工厂编号='" & FrmRKD.Combo1.Text & "'"
'End If
'Rst.Open SQL, db, 1, 3
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)
SPFlag = 0
Unload Me
End Sub
Private Sub Grid_DblClick()
If SPFlag = 2 Then
Dim SumNum, I As Integer
Dim SumJE 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
FrmRKD.Grid.Rows = FrmRKD.Grid.Rows + 1
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 0) = FrmRKD.Grid.Rows - 1
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 1) = OpenSPRs.Fields("cn_productname")
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 2) = OpenSPRs.Fields("工厂货号")
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 3) = OpenSPRs.Fields("产品规格")
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 4) = OpenSPRs.Fields("产品材料")
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 5) = 0
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 6) = Format(0, "0.00")
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 7) = FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 5) * FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 6)
FrmRKD.Grid.TextMatrix(FrmRKD.Grid.Rows - 1, 8) = OpenSPRs.Fields("productid")
IDlist.Add OpenSPRs.Fields(0).Value
For I = 1 To FrmRKD.Grid.Rows - 1
SumNum = SumNum + Val(FrmRKD.Grid.TextMatrix(I, 5))
SumJE = SumJE + Val(FrmRKD.Grid.TextMatrix(I, 7))
Next
FrmRKD.lblSL.Caption = SumNum
FrmRKD.lblJE.Caption = Format(CStr(SumJE), "0.00")
Move2:
OpenSPRs.Close
Set OpenSPRs = Nothing
End If
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -