stockstat.frm
来自「一个关于电脑管理汽车的软件」· FRM 代码 · 共 545 行 · 第 1/2 页
FRM
545 行
EndProperty
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Name"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Address"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "City, State, Zip"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "Notes"
Object.Width = 2540
EndProperty
End
End
Attribute VB_Name = "StockStat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private SearchGoodsKey As String
Private Sub Combo1_Click()
Select Case Combo1.ListIndex
Case 0
SearchGoodsKey = "goodscoding"
Case 1
SearchGoodsKey = "goodssort"
Case 2
SearchGoodsKey = "goodsstandard"
Case 3
SearchGoodsKey = "producehere"
Case 4
SearchGoodsKey = "provide"
Case 5
SearchGoodsKey = "stockdate"
Case 6
SearchGoodsKey = "billnum"
Case 7
SearchGoodsKey = "invoicetype"
Case 8
SearchGoodsKey = "payway"
End Select
LoadGData
LoadData SearchGoodsKey, Combo1.ListIndex
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
Combo1.Text = ""
End Sub
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
Combo1.Text = ""
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 4
LoadGData
LoadData SearchGoodsKey, Combo1.ListIndex
Case 5
End Select
End Sub
Private Sub Form_Load()
Dim i As Integer
VarInitData.InitBSE BSE1, 0
For i = 0 To 1
DTPicker1(i) = Date
Next i
Combo1.AddItem "货品编码"
Combo1.AddItem "货品分类"
Combo1.AddItem "品牌商标"
Combo1.AddItem "货品产地"
Combo1.AddItem "供应单位"
Combo1.AddItem "进货日期"
Combo1.AddItem "进货单"
Combo1.AddItem "发票类型"
Combo1.AddItem "支付方式"
SearchGoodsKey = "goodscoding"
InitListView
Combo1.ListIndex = 0
' LoadGData
' LoadData SearchGoodsKey, Combo1.ListIndex
End Sub
Private Sub Form_Resize()
If Me.ScaleHeight > 0 And Me.ScaleWidth > 0 Then
frameInfo(0).Width = Me.ScaleWidth
lstBillDocu.top = frameInfo(0).top + frameInfo(0).Height + 50
lstBillDocu.left = 100
lstBillDocu.Width = Me.ScaleWidth - 200
lstBillDocu.Height = Me.ScaleHeight - frameInfo(0).Height - frameInfo(1).Height
frameInfo(1).top = lstBillDocu.top + lstBillDocu.Height
frameInfo(1).Width = Me.ScaleWidth
End If
End Sub
Private Sub InitListView()
lstBillDocu.ColumnHeaders.Clear
With lstBillDocu.ColumnHeaders
.Add , , "统计对象"
.Add , , "货物数量"
.Add , , "成本额"
.Add , , "比率(%)"
End With
End Sub
Private Sub LoadData(ByVal SearchGoodsKey As String, ByVal VarIndex As Integer)
Dim TempSQL As String
Dim TempRS As MYSQL_RS, TempStr() As Variant, TempBillStr() As String
Dim TempRS2 As MYSQL_RS
Dim i As Long, TempCount As Long, TempMoney As Double, j As Long, K As Long, m As Long, TempCount2 As Long, TempMoney2 As Double
Dim TempIndex As Long
Dim TempSQLTable As Integer, TempKey As String, TempKey2 As String
Dim VarFind As Long, FindGoodsBS As Boolean
Dim TempText As String
If VarIndex <= 3 Then
TempSQLTable = 14
TempKey = "goodscount"
TempKey2 = "money"
Else
TempSQLTable = 13
TempKey = "gcount"
TempKey2 = "gmoney"
End If
TempSQL = VarInitData.DisplaySQLVal(13) & "Where stockdate >= " & Quote(DTPicker1(0).Value) & " and stockdate <= " & Quote(DTPicker1(1).Value)
Set TempRS = New MYSQL_RS
TempRS.OpenRs TempSQL, gCnn
With TempRS
If .RecordCount > 0 Then
ReDim TempStr(1 To .RecordCount)
ReDim TempBillStr(1 To .RecordCount)
End If
i = 0
K = 0
Do Until .EOF
If VarIndex > 3 Then
If VarFunction.FindSameVariant(.Fields(SearchGoodsKey), TempStr, .RecordCount) = False Then
i = i + 1
TempStr(i) = .Fields(SearchGoodsKey)
End If
End If
K = K + 1
TempBillStr(K) = .Fields("billnum")
.MoveNext
Loop
.CloseRecordset
.ReleaseMemory
End With
Set TempRS = Nothing
If K > 0 Then
If VarIndex <= 3 Then
TempSQL = VarInitData.DisplaySQLVal(14) '& "Where stockdate >= " & Quote(DTPicker1(0).Value) & " and stockdate <= " & Quote(DTPicker1(1).Value)
Set TempRS = New MYSQL_RS
TempRS.OpenRs TempSQL, gCnn
With TempRS
If .RecordCount > 0 Then
ReDim TempStr(1 To .RecordCount)
End If
i = 0
Do Until .EOF
If VarFunction.FindSameVariant(.Fields(SearchGoodsKey), TempStr, .RecordCount) = False Then
i = i + 1
TempStr(i) = .Fields(SearchGoodsKey)
End If
.MoveNext
Loop
.CloseRecordset
.ReleaseMemory
End With
Set TempRS = Nothing
End If
End If
If i > 0 And K > 0 Then
For j = 1 To i
TempSQL = VarInitData.DisplaySQLVal(TempSQLTable) & " Where " & SearchGoodsKey & " = " & Quote(TempStr(j)) '& " and stockdate >= " & Quote(DTPicker1(0).Value) & " and stockdate <= " & Quote(DTPicker1(1).Value)
Set TempRS = New MYSQL_RS
TempRS.OpenRs TempSQL, gCnn
With TempRS
TempText = .Fields(SearchGoodsKey)
TempCount = 0
TempMoney = 0
FindGoodsBS = False
For m = 1 To K
.MoveFirst
.MovePrevious
Do Until .EOF
VarFind = .FindNext("billnum", TempBillStr(m))
If VarFind > -1 Then
TempCount2 = .Fields(TempKey)
TempMoney2 = .Fields(TempKey2)
If Mid(TempBillStr(m), 2, 1) = "T" Then
TempCount2 = -TempCount2
TempMoney2 = -TempMoney2
End If
TempCount = TempCount + TempCount2
TempMoney = TempMoney + TempMoney2
FindGoodsBS = True
Else
Exit Do
End If
Loop
Next m
.CloseRecordset
.ReleaseMemory
End With
Set TempRS = Nothing
If FindGoodsBS = True Then
lstBillDocu.ListItems.Add
TempIndex = lstBillDocu.ListItems.Count
With lstBillDocu.ListItems(TempIndex)
.Text = TempText
.SubItems(1) = TempCount
.SubItems(2) = TempMoney
If Val(Label1(1)) <> 0 Then
.SubItems(3) = Format((TempMoney / Val(Label1(1))) * 100, VarInitData.MoneyFormat)
Else
.SubItems(3) = VarInitData.MoneyFormat
End If
End With
End If
Next j
End If
VarInitData.lstSort lstBillDocu
End Sub
Private Sub LoadGData()
Dim TempRS As MYSQL_RS
Dim TempCount As Long, TempMoney As Double, TempCount2 As Long, TempMoney2 As Double
Dim TempSQL As String
lstBillDocu.ListItems.Clear
TempCount = 0
TempMoney = 0
Set TempRS = New MYSQL_RS
TempSQL = VarInitData.DisplaySQLVal(13) & "Where stockdate >= " & Quote(DTPicker1(0).Value) & " and stockdate <= " & Quote(DTPicker1(1).Value)
TempRS.OpenRs TempSQL, gCnn
With TempRS
Do Until .EOF
TempCount2 = .Fields("gcount")
TempMoney2 = .Fields("gmoney")
If Mid(.Fields("billnum"), 2, 1) = "T" Then
TempCount2 = -TempCount2
TempMoney2 = -TempMoney2
End If
TempCount = TempCount + TempCount2
TempMoney = TempMoney + TempMoney2
.MoveNext
Loop
.CloseRecordset
.ReleaseMemory
End With
Set TempRS = Nothing
Label1(0) = TempCount
Label1(1) = TempMoney
End Sub
Private Sub Form_Unload(Cancel As Integer)
If BSE1.EngineStarted Then BSE1.EndSubClassing
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?