📄 frm_tongji.frm
字号:
With Adotemp.Recordset
If .RecordCount < 9 Then
For i = 0 To .RecordCount - 1
Select Case .AbsolutePosition
Case 1:
temp0 = Trim(.Fields("electype"))
Case 2:
temp1 = Trim(.Fields("electype"))
Case 3:
temp2 = Trim(.Fields("electype"))
Case 4:
temp3 = Trim(.Fields("electype"))
Case 5:
temp4 = Trim(.Fields("electype"))
Case 6:
temp5 = Trim(.Fields("electype"))
Case 7:
temp6 = Trim(.Fields("electype"))
Case 8:
temp7 = Trim(.Fields("electype"))
End Select
If Not .EOF Then
.MoveNext
End If
Next
ElseIf .RecordCount > 16 Then
MsgBox "电价种类超过16种,无法打印,按 确定 将退出!", vbInformation
Screen.MousePointer = 0
Exit Sub
Else
out_of_rang = True
For i = 0 To .RecordCount - 1
Select Case .AbsolutePosition
Case 1:
temp0 = Trim(.Fields("electype"))
Case 2:
temp1 = Trim(.Fields("electype"))
Case 3:
temp2 = Trim(.Fields("electype"))
Case 4:
temp3 = Trim(.Fields("electype"))
Case 5:
temp4 = Trim(.Fields("electype"))
Case 6:
temp5 = Trim(.Fields("electype"))
Case 7:
temp6 = Trim(.Fields("electype"))
Case 8:
temp7 = Trim(.Fields("electype"))
Case 9:
temp8 = Trim(.Fields("electype"))
Case 10:
temp9 = Trim(.Fields("electype"))
Case 11:
temp10 = Trim(.Fields("electype"))
Case 12:
temp11 = Trim(.Fields("electype"))
Case 13:
temp12 = Trim(.Fields("electype"))
Case 14:
temp13 = Trim(.Fields("electype"))
Case 15:
temp14 = Trim(.Fields("electype"))
Case 16:
temp15 = Trim(.Fields("electype"))
End Select
If Not .EOF Then
.MoveNext
End If
Next
End If
End With
Else
MsgBox "没有数据可打印!", vbCritical
Screen.MousePointer = 0
Exit Sub
End If
'┌┐└ ┘├ ┤┬ ┴ ┼ │┄ ─┊
Adotemp.RecordSource = "select id,name from village where townid='" & Mid(Combo_town.Text & Space(10), 3, 2) & "' order by id asc"
Adotemp.Refresh
If out_of_rang = False Then
With Adotemp.Recordset
If .RecordCount <> 0 Then
Call printer_init1
Printer.FontSize = 15
Printer.Print Space(20) & Trim(Mid(Combo_town.Text & Space(20), 5)) & Space(5) & Trim(Combo_year.Text) & Trim(combo_month.Text) & "用电类别统计报表"
Printer.FontSize = 11
Printer.Print Space(10) & "填制单位:" & "萧山市供电局" & Trim(Mid(Combo_town.Text & Space(20), 5)) & "电管站" & Space(10) & "单位:KWH/元" & Space(20) & "制表日期:" & Format(Date, "Long date")
Printer.Print "┌────┬───────────────────────────────────────────────────────────────────────────────┐"
Printer.Print "│ │ 售 电 量 │"
Printer.Print "│ ├─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┤"
Printer.Print "│ 村 名 │" & Space(2) & Left(temp0 & Space(20), 16 - convert_str(temp0)) & "│" & Space(2) & Left(temp1 & Space(20), 16 - convert_str(temp1)) & "│" & Space(2) & Left(temp2 & Space(20), 16 - convert_str(temp2)) & "│" & Space(2) & Left(temp3 & Space(20), 16 - convert_str(temp3)) & "│" & Space(2) & Left(temp4 & Space(20), 16 - convert_str(temp4)) & "│" & Space(2) & Left(temp5 & Space(20), 16 - convert_str(temp5)) & "│" & Space(2) & Left(temp6 & Space(20), 16 - convert_str(temp6)) & "│" & Space(2) & Left(temp7 & Space(20), 16 - convert_str(temp7)) & "│"
Printer.Print "│ ├────┬────┼────┬────┼────┬────┼────┬────┼────┬────┼────┬────┼────┬────┼────┬────┤"
Printer.Print "│ │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │ 电 量 │ 金 额 │"
Printer.Print "├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤"
'Printer.Print "└────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘"
For i = 1 To .RecordCount
tempado.RecordSource = "select distinct meter.electype,sum(fee.quantity) as dian_liang,sum(fee.fee) as dian_fei from fee inner join meter on fee.userid=meter.userid where [fee].[villid]='" & .Fields("id") & "' group by meter.electype order by meter.electype asc"
tempado.Refresh
With tempado.Recordset
dl0 = 0
dl1 = 0
dl2 = 0
dl3 = 0
dl4 = 0
dl5 = 0
dl6 = 0
dl7 = 0
'电费
df0 = 0#
df1 = 0#
df2 = 0#
df3 = 0#
df4 = 0#
df5 = 0#
df6 = 0#
df7 = 0#
For j = 0 To .RecordCount - 1
Select Case Trim(.Fields("electype"))
Case temp0:
dl0 = .Fields("dian_liang")
df0 = .Fields("dian_fei")
tdl0 = tdl0 + .Fields("dian_liang")
tdf0 = tdf0 + .Fields("dian_fei")
Case temp1:
dl1 = .Fields("dian_liang")
df1 = .Fields("dian_fei")
tdl1 = tdl1 + .Fields("dian_liang")
tdf1 = tdf1 + .Fields("dian_fei")
Case temp2:
dl2 = .Fields("dian_liang")
df2 = .Fields("dian_fei")
tdl2 = tdl2 + .Fields("dian_liang")
tdf2 = tdf2 + .Fields("dian_fei")
Case temp3:
dl3 = .Fields("dian_liang")
df3 = .Fields("dian_fei")
tdl3 = tdl3 + .Fields("dian_liang")
tdf3 = tdf3 + .Fields("dian_fei")
Case temp4:
dl4 = .Fields("dian_liang")
df4 = .Fields("dian_fei")
tdl4 = tdl4 + .Fields("dian_liang")
tdf4 = tdf4 + .Fields("dian_fei")
Case temp5:
dl5 = .Fields("dian_liang")
df5 = .Fields("dian_fei")
tdl5 = tdl5 + .Fields("dian_liang")
tdf5 = tdf5 + .Fields("dian_fei")
Case temp6:
dl6 = .Fields("dian_liang")
df6 = .Fields("dian_fei")
tdl6 = tdl6 + .Fields("dian_liang")
tdf6 = tdf6 + .Fields("dian_fei")
Case temp7:
dl7 = .Fields("dian_liang")
df7 = .Fields("dian_fei")
tdl7 = tdl7 + .Fields("dian_liang")
tdf7 = tdf7 + .Fields("dian_fei")
End Select
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -