📄 frm_ystats.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frm_YStats
BorderStyle = 1 'Fixed Single
Caption = "出入库现金年统计"
ClientHeight = 1710
ClientLeft = 45
ClientTop = 330
ClientWidth = 3075
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1710
ScaleWidth = 3075
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 90
Top = 2460
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 105
Top = 2055
Width = 2040
_ExtentX = 3598
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin TabDlg.SSTab SSTab1
Height = 1620
Left = 45
TabIndex = 0
Top = 75
Width = 2985
_ExtentX = 5265
_ExtentY = 2858
_Version = 393216
Style = 1
Tabs = 2
Tab = 1
TabHeight = 520
TabCaption(0) = "入库现金年统计"
TabPicture(0) = "frm_YStats.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "Frame1"
Tab(0).Control(1)= "Command1"
Tab(0).Control(2)= "Command2"
Tab(0).ControlCount= 3
TabCaption(1) = "出库现金年统计"
TabPicture(1) = "frm_YStats.frx":001C
Tab(1).ControlEnabled= -1 'True
Tab(1).Control(0)= "Frame2"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "Command3"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).Control(2)= "Command4"
Tab(1).Control(2).Enabled= 0 'False
Tab(1).ControlCount= 3
Begin VB.CommandButton Command4
Caption = "取消"
Height = 350
Left = 2070
TabIndex = 10
Top = 1110
Width = 825
End
Begin VB.CommandButton Command3
Caption = "确定"
Height = 350
Left = 1200
TabIndex = 9
Top = 1110
Width = 825
End
Begin VB.Frame Frame2
Height = 645
Left = 90
TabIndex = 6
Top = 405
Width = 2805
Begin VB.ComboBox Combo2
Height = 300
ItemData = "frm_YStats.frx":0038
Left = 1800
List = "frm_YStats.frx":005D
TabIndex = 8
Top = 195
Width = 945
End
Begin VB.Label Label2
Caption = "选择或输入统计年限"
Height = 255
Left = 105
TabIndex = 7
Top = 285
Width = 1650
End
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 350
Left = -72930
TabIndex = 5
Top = 1110
Width = 825
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 350
Left = -73800
TabIndex = 4
Top = 1110
Width = 825
End
Begin VB.Frame Frame1
Height = 645
Left = -74910
TabIndex = 1
Top = 405
Width = 2805
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frm_YStats.frx":00A3
Left = 1800
List = "frm_YStats.frx":00C8
TabIndex = 3
Top = 195
Width = 945
End
Begin VB.Label Label1
Caption = "选择或输入统计年限"
Height = 225
Left = 105
TabIndex = 2
Top = 285
Width = 1800
End
End
End
End
Attribute VB_Name = "frm_YStats"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现取消窗体置前的功能
Adodc1.RecordSource = "select IN_Money,IN_Date from tb_in where in_year='" + Combo1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Call INxxxs '调用显示入库年统计现金信息的过程
Frm_YStat.MSChart1.Title = Combo1.Text & " 年货品入库现金信息年统计" '图表名称
Frm_YStat.Show
Unload Me
Else
MsgBox "当前数据库中没有符合条件的统计数据", 64, "提示信息"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '取消窗体在前
Adodc1.RecordSource = "select OUT_Money,OUT_Date from tb_out where out_year='" + Combo2.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Call Outxxxs
Frm_YStat.MSChart1.Title = Combo2.Text & " 年货品出库现金信息年统计" '图表名称
Frm_YStat.Show
Unload Me
Else
MsgBox "当前数据库中没有符合条件的统计数据", 64, "提示信息"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '使窗体置前
Combo1.Text = Mid(Date, 1, 4)
Combo2.Text = Mid(Date, 1, 4)
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_YMoney"
Adodc1.Refresh
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Adodc2.RecordSource = "select * from tb_YMoney"
Adodc2.Refresh
End Sub
'*** 自定义显示入库年统计现金信息的过程 ***
Private Sub INxxxs()
Dim Nums As Integer
Dim YM As String
Call tbTemp '调用删除临时表中数据的过程
Call main
Adodc1.Recordset.MoveFirst
For i = 1 To 12
Adodc2.RecordSource = "select sum(IN_Money) from tb_in where in_year='" + Combo1.Text + "' and IN_Month='" + Trim(Str(i)) + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
If Adodc2.Recordset.Fields(0) <> "" Then
Nums = Nums + 1
If Len(i) = 1 Then
YM = Combo1.Text & "0" & i
ElseIf Len(i) = 2 Then
YM = Combo1.Text & i
End If
'保存年统计信息
Set adoRs = adoCon.Execute("insert into tb_YMoney values(" & Nums & ",'" & Trim(Str(Adodc2.Recordset.Fields(0))) & "','" & YM & "')")
Else
Nums = Nums + 1
If Len(i) = 1 Then
YM = Combo1.Text & "0" & i
ElseIf Len(i) = 2 Then
YM = Combo1.Text & i
End If
Set adoRs = adoCon.Execute("insert into tb_YMoney values(" & Nums & ",'0','" & YM & "')")
End If
End If
Next
adoCon.Close
End Sub
'*** 自定义显示出库年统计现金信息的过程 ***
Private Sub Outxxxs()
Dim Nums As Integer
Dim YM As String
Call tbTemp '调用删除临时表中数据的过程
Call main
Adodc1.Recordset.MoveFirst
For i = 1 To 12
Adodc2.RecordSource = "select sum(out_Money) from tb_out where out_year='" + Combo1.Text + "' and out_Month='" + Trim(Str(i)) + "'"
Adodc2.Refresh
' MsgBox Adodc2.RecordSource
If Adodc2.Recordset.RecordCount > 0 Then
If Adodc2.Recordset.Fields(0) <> "" Then
Nums = Nums + 1
If Len(i) = 1 Then
YM = Combo1.Text & "0" & i
ElseIf Len(i) = 2 Then
YM = Combo1.Text & i
End If
Set adoRs = adoCon.Execute("insert into tb_YMoney values(" & Nums & ",'" & Trim(Str(Adodc2.Recordset.Fields(0))) & "','" & YM & "')")
Else
Nums = Nums + 1
If Len(i) = 1 Then
YM = Combo1.Text & "0" & i
ElseIf Len(i) = 2 Then
YM = Combo1.Text & i
End If
Set adoRs = adoCon.Execute("insert into tb_YMoney values(" & Nums & ",'0','" & YM & "')")
End If
End If
Next
adoCon.Close
End Sub
'*** 自定义删除临时表中数据的过程 ***
Private Sub tbTemp()
On Error Resume Next
Adodc2.RecordSource = "select * from tb_YMoney"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Loop
Else
End If
Adodc2.RecordSource = "select * from tb_YMoney"
Adodc2.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -