📄 form10month.frm
字号:
DoEvents
hzzde.Commands("monthtable").Parameters(0).Value = Text2.Text
hzzde.Commands("monthtable").Execute
If hzzde.rsmonthtable.State <> adStateOpen Then
hzzde.rsmonthtable.Open
End If
hzzde.rsmonthtable.Requery '使记录集重新定位
'为tmonth(_)数组赋值
Dim i As Integer
Dim j As Integer
For i = 1 To 12
For j = 1 To 7
If j = 1 Then
tmonth(i, j) = i
Else
tmonth(i, j) = 0
End If
Next j
Next i
If hzzde.rsmonthtable.RecordCount <> 0 Then
hzzde.rsmonthtable.MoveFirst
Do While Not hzzde.rsmonthtable.EOF
Select Case Month(hzzde.rsmonthtable.Fields(0).Value)
Case 1
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(1, 2) = tmonth(1, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(1, 3) = tmonth(1, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(1, 4) = tmonth(1, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(1, 5) = tmonth(1, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(1, 6) = tmonth(1, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(1, 7) = tmonth(1, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 2
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(2, 2) = tmonth(2, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(2, 3) = tmonth(2, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(2, 4) = tmonth(2, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(2, 5) = tmonth(2, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(2, 6) = tmonth(2, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(2, 7) = tmonth(2, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 3
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(3, 2) = tmonth(3, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(3, 3) = tmonth(3, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(3, 4) = tmonth(3, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(3, 5) = tmonth(3, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(3, 6) = tmonth(3, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(3, 7) = tmonth(3, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 4
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(4, 2) = tmonth(4, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(4, 3) = tmonth(4, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(4, 4) = tmonth(4, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(4, 5) = tmonth(4, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(4, 6) = tmonth(4, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(4, 7) = tmonth(4, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 5
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(5, 2) = tmonth(5, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(5, 3) = tmonth(5, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(5, 4) = tmonth(5, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(5, 5) = tmonth(5, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(5, 6) = tmonth(5, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(5, 7) = tmonth(5, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 6
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(6, 2) = tmonth(6, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(6, 3) = tmonth(6, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(6, 4) = tmonth(6, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(6, 5) = tmonth(6, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(6, 6) = tmonth(6, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(6, 7) = tmonth(6, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 7
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(7, 2) = tmonth(7, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(7, 3) = tmonth(7, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(7, 4) = tmonth(7, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(7, 5) = tmonth(7, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(7, 6) = tmonth(7, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(7, 7) = tmonth(7, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 8
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(8, 2) = tmonth(8, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(8, 3) = tmonth(8, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(8, 4) = tmonth(8, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(8, 5) = tmonth(8, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(8, 6) = tmonth(8, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(8, 7) = tmonth(8, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 9
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(9, 2) = tmonth(9, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(9, 3) = tmonth(9, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(9, 4) = tmonth(9, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(9, 5) = tmonth(9, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(9, 6) = tmonth(9, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(9, 7) = tmonth(9, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 10
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(10, 2) = tmonth(10, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(10, 3) = tmonth(10, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(10, 4) = tmonth(10, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(10, 5) = tmonth(10, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(10, 6) = tmonth(10, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(10, 7) = tmonth(10, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 11
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(11, 2) = tmonth(11, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(11, 3) = tmonth(11, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(11, 4) = tmonth(11, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(11, 5) = tmonth(11, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(11, 6) = tmonth(11, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(11, 7) = tmonth(11, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
Case 12
If hzzde.rsmonthtable.Fields(1).Value = "城市户" Then
tmonth(12, 2) = tmonth(12, 2) + hzzde.rsmonthtable.Fields(2).Value
tmonth(12, 3) = tmonth(12, 3) + hzzde.rsmonthtable.Fields(3).Value
tmonth(12, 4) = tmonth(12, 4) + hzzde.rsmonthtable.Fields(4).Value
End If
If hzzde.rsmonthtable.Fields(1).Value = "农村户" Then
tmonth(12, 5) = tmonth(12, 5) + hzzde.rsmonthtable.Fields(2).Value
tmonth(12, 6) = tmonth(12, 6) + hzzde.rsmonthtable.Fields(3).Value
tmonth(12, 7) = tmonth(12, 7) + hzzde.rsmonthtable.Fields(4).Value
End If
End Select
hzzde.rsmonthtable.MoveNext
Loop
End If
Dim lcheng As Long
Dim lnong As Long
Dim lshou As Long
Dim lchu As Long
For i = 1 To 12 '为标题栏赋值
lcheng = lcheng + tmonth(i, 4)
lnong = lnong + tmonth(i, 7)
lshou = lshou + tmonth(i, 2) + tmonth(i, 5)
lchu = lchu + tmonth(i, 3) + tmonth(i, 6)
Next i
Label4 = Str(lcheng + lnong)
Label8 = Str(lcheng)
Label11 = Str(lnong)
Label16 = Str(lshou)
Label17 = Str(lchu)
'为Adodc1赋值以便填充Mshflexgrid1
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
Adodc1.Recordset.Delete adAffectCurrent
Adodc1.Recordset.MoveNext
Loop
End If
Dim k As Integer
For k = 1 To 12
Adodc1.Recordset.AddNew
If k = 1 Then Adodc1.Recordset.Fields(0).Value = "一月"
If k = 2 Then Adodc1.Recordset.Fields(0).Value = "二月"
If k = 3 Then Adodc1.Recordset.Fields(0).Value = "三月"
If k = 4 Then Adodc1.Recordset.Fields(0).Value = "四月"
If k = 5 Then Adodc1.Recordset.Fields(0).Value = "五月"
If k = 6 Then Adodc1.Recordset.Fields(0).Value = "六月"
If k = 7 Then Adodc1.Recordset.Fields(0).Value = "七月"
If k = 8 Then Adodc1.Recordset.Fields(0).Value = "八月"
If k = 9 Then Adodc1.Recordset.Fields(0).Value = "九月"
If k = 10 Then Adodc1.Recordset.Fields(0).Value = "十月"
If k = 11 Then Adodc1.Recordset.Fields(0).Value = "十一月"
If k = 12 Then Adodc1.Recordset.Fields(0).Value = "十二月"
Adodc1.Recordset.Fields(1).Value = "城市户"
Adodc1.Recordset.Fields(2).Value = tmonth(k, 2)
Adodc1.Recordset.Fields(3).Value = tmonth(k, 3)
Adodc1.Recordset.Fields(4).Value = tmonth(k, 4)
Adodc1.Recordset.Update
Adodc1.Recordset.AddNew
If k = 1 Then Adodc1.Recordset.Fields(0).Value = "一月"
If k = 2 Then Adodc1.Recordset.Fields(0).Value = "二月"
If k = 3 Then Adodc1.Recordset.Fields(0).Value = "三月"
If k = 4 Then Adodc1.Recordset.Fields(0).Value = "四月"
If k = 5 Then Adodc1.Recordset.Fields(0).Value = "五月"
If k = 6 Then Adodc1.Recordset.Fields(0).Value = "六月"
If k = 7 Then Adodc1.Recordset.Fields(0).Value = "七月"
If k = 8 Then Adodc1.Recordset.Fields(0).Value = "八月"
If k = 9 Then Adodc1.Recordset.Fields(0).Value = "九月"
If k = 10 Then Adodc1.Recordset.Fields(0).Value = "十月"
If k = 11 Then Adodc1.Recordset.Fields(0).Value = "十一月"
If k = 12 Then Adodc1.Recordset.Fields(0).Value = "十二月"
Adodc1.Recordset.Fields(1).Value = "农村户"
Adodc1.Recordset.Fields(2).Value = tmonth(k, 5)
Adodc1.Recordset.Fields(3).Value = tmonth(k, 6)
Adodc1.Recordset.Fields(4).Value = tmonth(k, 7)
Adodc1.Recordset.Update
Next k
Set MSHFlexGrid1.DataSource = Adodc1
MSHFlexGrid1.Refresh
MSHFlexGrid1.Redraw = True
'绘制图表
Dim l As Integer
For l = 1 To 12
If l = 1 Then mchart(l, 1) = "一月"
If l = 2 Then mchart(l, 1) = "二月"
If l = 3 Then mchart(l, 1) = "三月"
If l = 4 Then mchart(l, 1) = "四月"
If l = 5 Then mchart(l, 1) = "五月"
If l = 6 Then mchart(l, 1) = "六月"
If l = 7 Then mchart(l, 1) = "七月"
If l = 8 Then mchart(l, 1) = "八月"
If l = 9 Then mchart(l, 1) = "九月"
If l = 10 Then mchart(l, 1) = "十月"
If l = 11 Then mchart(l, 1) = "十一月"
If l = 12 Then mchart(l, 1) = "十二月"
mchart(l, 2) = tmonth(l, 4)
mchart(l, 3) = tmonth(l, 7)
Next l
MSChart1.ChartData = mchart
havechart = True '图表已绘出
MSChart1.Column = 1
MSChart1.ColumnLabel = "城市户"
MSChart1.Column = 2
MSChart1.ColumnLabel = "农村户"
With MSChart1
.Plot.Light.LightSources(1).Set 10, 10, 10, 1
End With
Command1.Enabled = False '关闭Command1
Unload frmSplash
End Sub
Private Sub Form_Load()
entrydate = Now()
StatusBar1.SimpleText = "查询条件为:" + Text2.Text + "年各月收费情况"
MSHFlexGrid1.ColWidth(0, 0) = 100
MSHFlexGrid1.ColWidth(1, 0) = 750
MSHFlexGrid1.ColWidth(2, 0) = 750
MSHFlexGrid1.ColWidth(3, 0) = 700
MSHFlexGrid1.ColWidth(4, 0) = 700
MSHFlexGrid1.ColWidth(5, 0) = 700
MSHFlexGrid1.ColWidth(6, 0) = 0
MSHFlexGrid1.RowHeight(0) = 500
MSHFlexGrid1.MergeCol(1) = True
MSHFlexGrid1.BackColorFixed = vbCyan
'MSHFlexGrid1.BackColorSel = &HFF8070
'MSHFlexGrid1.BackColor = &HFF7020
MSHFlexGrid1.ScrollTrack = True
havechart = False
Load Form9tip '装载标记窗口
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form9tip
Call history(staff, entrydate, Me.Caption, Now())
End Sub
Private Sub Text2_Change()
StatusBar1.SimpleText = "查询条件为:" + Text2.Text + "年各月收费情况"
Command1.Enabled = True
End Sub
Private Sub MSChart1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If x <= MSChart1.Width And y <= MSChart1.Height Then
Toolbar1.Visible = True
Toolbar1.Left = x + (9480 - MSChart1.Width)
Toolbar1.Top = y + 800
If MSChart1.ChartType = VtChChartType3dLine Or MSChart1.ChartType = VtChChartType3dBar Then
Toolbar3.Visible = True
Toolbar3.Left = x + (9480 - MSChart1.Width) + 350
Toolbar3.Top = y + 1190
Toolbar2.Visible = True
Toolbar2.Left = x + (9480 - MSChart1.Width)
Toolbar2.Top = y + 1580
Toolbar4.Visible = True
Toolbar4.Left = x + (9480 - MSChart1.Width) + 350
Toolbar4.Top = y + 1970
End If
If MSChart1.ChartType = VtChChartType2dLine Or MSChart1.ChartType = VtChChartType2dBar Then
Toolbar2.Visible = False
Toolbar3.Visible = False
Toolbar4.Visible = False
End If
End If
'为标记窗口位置赋值
sx = x + (9480 - MSChart1.Width)
sy = y + 800
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Toolbar1.Visible = False
Toolbar2.Visible = False
Toolbar3.Visible = False
Toolbar4.Visible = False
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Toolbar1.Visible = False
Toolbar2.Visible = False
Toolbar3.Visible = False
Toolbar4.Visible = False
End Sub
Private Sub MSChart1_PlotSelected(MouseFlags As Integer, Cancel As Integer)
If havechart Then
chen = 0: nong = 0: shou = 0: chu = 0
dyear = Text2.Text
dmonth = ""
dday = ""
qhj = Val(Label4.Caption)
chen = Val(Label8.Caption)
nong = Val(Label11.Caption)
shou = Val(Label16.Caption)
chu = Val(Label17.Caption)
Form9tip.Show
End If
End Sub
Private Sub MSChart1_PointSelected(Series As Integer, DataPoint As Integer, MouseFlags As Integer, Cancel As Integer)
If havechart Then
chen = 0: nong = 0: shou = 0: chu = 0
dyear = Text2.Text
dmonth = Val(DataPoint)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -