📄 printsum.frm
字号:
Width = 900
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "电 费"
Height = 180
Left = 5460
TabIndex = 13
Top = 540
Width = 540
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "电 量"
Height = 180
Left = 4560
TabIndex = 12
Top = 540
Width = 540
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "机关照明"
Height = 180
Left = 4980
TabIndex = 11
Top = 180
Width = 720
End
Begin VB.Line Line10
X1 = 4440
X2 = 4440
Y1 = 120
Y2 = 2220
End
Begin VB.Line Line9
X1 = 3420
X2 = 3420
Y1 = 420
Y2 = 2220
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "电 费"
Height = 180
Left = 3660
TabIndex = 10
Top = 540
Width = 540
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "电 量"
Height = 180
Left = 2700
TabIndex = 9
Top = 540
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "生活照明"
Height = 180
Left = 3060
TabIndex = 8
Top = 180
Width = 720
End
Begin VB.Line Line8
X1 = 2580
X2 = 2580
Y1 = 120
Y2 = 2220
End
Begin VB.Line Line7
X1 = 1620
X2 = 1620
Y1 = 420
Y2 = 2220
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "电 费"
Height = 180
Left = 1800
TabIndex = 6
Top = 540
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "电 量"
Height = 180
Left = 900
TabIndex = 5
Top = 540
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "动 力"
Height = 180
Left = 1320
TabIndex = 4
Top = 180
Width = 630
End
Begin VB.Line Line6
X1 = 60
X2 = 8940
Y1 = 840
Y2 = 840
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "小 计"
Height = 180
Left = 120
TabIndex = 3
Top = 1980
Width = 540
End
Begin VB.Label Label2
Caption = "专用变"
Height = 255
Left = 120
TabIndex = 2
Top = 1440
Width = 555
End
Begin VB.Line Line4
X1 = 0
X2 = 8940
Y1 = 1800
Y2 = 1800
End
Begin VB.Line Line3
X1 = -180
X2 = 8940
Y1 = 1320
Y2 = 1320
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "公用变"
Height = 180
Left = 120
TabIndex = 1
Top = 1020
Width = 540
End
Begin VB.Line Line2
X1 = 780
X2 = 780
Y1 = 120
Y2 = 2220
End
Begin VB.Line Line1
X1 = 780
X2 = 8940
Y1 = 420
Y2 = 420
End
End
End
Attribute VB_Name = "PrintSum"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim QtRec As Recordset
'Set MdbR = NdMd.OpenRecordset("select * from 用户电费 where 镇村代码='" & UserSeek & "'")
On Error Resume Next
Set MdbR = NdMd.OpenRecordset("select * from 公变月报 where tm='" & XzName & XcName & "'")
'If MdbR.RecordCount = 0 Then
' MsgBox XcName & "用户为空!请先建档!", vbInformation
' Exit Sub
'End If
Set QtRec = NdMd.OpenRecordset("select sum(用户电费.三峡) as Sxdf,sum(用户电费.电建) AS Djdf from 用户电费 where 用户电费.镇村代码='" & UserSeek & "'")
With MdbR
Text1(0) = .Fields!dldl
Text1(1) = .Fields!dldf
Text1(2) = .Fields!zmdl
Text1(3) = .Fields!zmdf
Text1(4) = .Fields!fjdl
Text1(5) = .Fields!fjdf
Text1(6) = .Fields!sydl
Text1(7) = .Fields!sydf
Text1(16) = CStr(Val(Text1(0)) + Val(Text1(8)))
Text1(17) = CStr(Val(Text1(1)) + Val(Text1(9)))
Text1(18) = CStr(Val(Text1(2)) + Val(Text1(10)))
Text1(19) = CStr(Val(Text1(3)) + Val(Text1(11)))
Text1(20) = CStr(Val(Text1(4)) + Val(Text1(12)))
Text1(21) = CStr(Val(Text1(5)) + Val(Text1(13)))
Text1(22) = CStr(Val(Text1(6)) + Val(Text1(14)))
Text1(24) = Format(QtRec.Fields!sxdf, "0.00")
Text1(26) = Format(QtRec.Fields!djdf, "0.00")
Text2(2) = CStr(Val(Text2(0)) + Val(Text2(1)))
Text1(23) = CStr(Val(Text1(7)) + Val(Text1(15)))
Text1(34) = CStr(Val(Text1(24)) + Val(Text1(29)))
Text1(35) = CStr(Val(Text1(25)) + Val(Text1(30)))
Text1(36) = CStr(Val(Text1(26)) + Val(Text1(31)))
Text1(27) = CStr(Val(Text1(0)) + Val(Text1(2)) + Val(Text1(4)) + Val(Text1(6)))
Text1(32) = CStr(Val(Text1(8)) + Val(Text1(10)) + Val(Text1(12)) + Val(Text1(14)))
Text1(28) = CStr(Val(Text1(1)) + Val(Text1(3)) + Val(Text1(5)) + Val(Text1(7)) + Val(Text2(0)) + Val(Text2(3)) + Val(Text2(4)) + Val(Text1(24)) + Val(Text1(25)) + Val(Text1(26)))
Text1(33) = CStr(Val(Text1(9)) + Val(Text1(11)) + Val(Text1(13)) + Val(Text1(15)) + Val(Text2(1)) + Val(Text2(5)) + Val(Text2(6)) + Val(Text1(29)) + Val(Text1(30)) + Val(Text1(31)))
Text1(37) = CStr(Val(Text1(27)) + Val(Text1(32)))
Text1(38) = CStr(Val(Text1(28)) + Val(Text1(33)))
End With
End Sub
Private Sub Command2_Click()
On Error GoTo hander
Printer.ColorMode = 1 '用单色打印
Printer.CurrentX = 0
Printer.CurrentY = 0 '打印机的初始位置
Printer.Duplex = 1 '单面打印
Printer.Font.Bold = True '打印按黑体
Printer.Font.Italic = False '打印斜体
Printer.Font.Size = 11 '打印字体的大小
Printer.Font.Underline = False '不打印下划线
Printer.Font.Weight = 9 '字体的重量
Printer.ScaleMode = 3 '按像素计算打印机纸张的大小
Printer.ScaleTop = 0 '设置坐标的起始位置的最上边
Printer.ScaleLeft = 0 '设置坐标的起始位置的最左边
Printer.ScaleHeight = 100 '67 '设置坐标的全部高度
Printer.ScaleWidth = 100 '设置坐标的全部长度
'Printer.Width = 16840
'Printer.Height = 23814
Printer.Orientation = 2
'─││┆┈┄┆┊┌┐└┘├┤┬┴┼╱╲「」┨┓┏┃┗ ┯ ━ ┛┷┠┣┫
Printer.CurrentY = 0
Printer.CurrentX = 0
Open "d:\test1.txt" For Append As #1
Printer.Font.Name = "黑体"
Printer.FontSize = 16
Printer.Print Space(24) & "台区电力销售收入汇总月报表"
Printer.Font.Name = "宋体"
Printer.FontSize = 11
Printer.Print Space(12) & "台区:" & XcName & Space(20) & Trim(Year(Date)) & "年" & Trim(Month(Date)) & "月" & Space(20) & "单位:千瓦时(用电表二)"
Printer.Print Space(3) & "┏━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━┓"
Printer.Print Space(3) & "┃ \ │ 动 力 │ 生 活 照 明 │ 机 关 照 明 │ 营业性照明力 │ 力率调整 ┃"
Printer.Print Space(3) & "┃ \项目├───┬─────┼───┬─────┼───┬─────┼───┬─────┼─────┨"
Printer.Print Space(3) & "┃配变\ │电 量│ 电 费 │电 量│ 电 费 │电 量│ 电 费 │电 量│ 电 费 │ 电 费 ┃ "
Printer.Print Space(3) & "┠────┼───┼─────┼───┼─────┼───┼─────┼───┼─────┼─────┨"
Printer.Print Space(3) & "┃公 用 变│" & Right(Space(6) & Trim(Text1(0)), 6) & "│" & Right(Space(10) & Trim(Text1(1)), 10) & "│" & Right(Space(6) & Trim(Text1(2)), 6) & "│" & Right(Space(10) & Trim(Text1(3)), 10) & "│" _
& Right(Space(6) & Trim(Text1(4)), 6) & "│" & Right(Space(10) & Trim(Text1(5)), 10) & "│" & Right(Space(6) & Trim(Text1(6)), 6) & "│" & Right(Space(10) & Trim(Text1(7)), 10) & "│" & Right(Space(10) & Trim(Text2(0)), 10) & "┃"
Printer.Print Space(3) & "┠────┼───┼─────┼───┼─────┼───┼─────┼───┼─────┼─────┨"
Printer.Print Space(3) & "┃专 用 变│" & Right(Space(6) & Trim(Text1(8)), 6) & "│" & Right(Space(10) & Trim(Text1(9)), 10) & "│" & Right(Space(6) & Trim(Text1(10)), 6) & "│" & Right(Space(10) & Trim(Text1(11)), 10) & "│" _
& Right(Space(6) & Trim(Text1(12)), 6) & "│" & Right(Space(10) & Trim(Text1(13)), 10) & "│" & Right(Space(6) & Trim(Text1(14)), 6) & "│" & Right(Space(10) & Trim(Text1(15)), 10) & "│" & Right(Space(10) & Trim(Text2(1)), 10) & "┃"
Printer.Print Space(3) & "┠────┼───┼─────┼───┼─────┼───┼─────┼───┼─────┼─────┨"
Printer.Print Space(3) & "┃小 计│" & Right(Space(6) & Trim(Text1(16)), 6) & "│" & Right(Space(10) & Trim(Text1(17)), 10) & "│" & Right(Space(6) & Trim(Text1(2)), 6) & "│" & Right(Space(10) & Trim(Text1(3)), 10) & "│" _
& Right(Space(6) & Trim(Text1(20)), 6) & "│" & Right(Space(10) & Trim(Text1(21)), 10) & "│" & Right(Space(6) & Trim(Text1(22)), 6) & "│" & Right(Space(10) & Trim(Text1(23)), 10) & "│" & Right(Space(10) & Trim(Text2(2)), 10) & "┃"
Printer.Print Space(3) & "┣━━━━┷━━━┷━━━━━┷━━━┷━━━━━┷━━━┷━━━━━┷━━━┷━━━━━┷━━━━━┫"
Printer.Print Space(3) & "┣━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━━┯━━━━━━━━┫"
Printer.Print Space(3) & "┃ 议价电 │ 超 用 电 │ 电 建 │ 农 调 │ 三 峡 │ 合 计 │ 合 计 │ ┃"
Printer.Print Space(3) & "┃ 差 价 │ 加 价 │ 基 金 │ 基 金 │ 基 金 │ 电 量 │ 电 费 │ 说 明 ┃"
Printer.Print Space(3) & "┠────┼─────┼─────┼─────┼─────┼─────┼──────┼────────┨"
Printer.Print Space(3) & "┃" & Right(Space(8) & Trim(Text2(3)), 8) & "│" & Right(Space(10) & Trim(Text2(4)), 10) & "│" & Right(Space(10) & Trim(Text1(24)), 10) & "│" & Right(Space(10) & Trim(Text1(25)), 10) & "│" _
& Right(Space(10) & Trim(Text1(26)), 10) & "│" & Right(Space(10) & Trim(Text1(27)), 10) & "│" & Right(Space(12) & Trim(Text1(28)), 12) & "│" & " 公用变按综合电┃"
Printer.Print Space(3) & "┠────┼─────┼─────┼─────┼─────┼─────┼──────┤价计算 ┃"
Printer.Print Space(3) & "┃" & Right(Space(8) & Trim(Text2(5)), 8) & "│" & Right(Space(10) & Trim(Text2(6)), 10) & "│" & Right(Space(10) & Trim(Text1(29)), 10) & "│" & Right(Space(10) & Trim(Text1(30)), 10) & "│" _
& Right(Space(10) & Trim(Text1(31)), 10) & "│" & Right(Space(10) & Trim(Text1(32)), 10) & "│" & Right(Space(12) & Trim(Text1(33)), 12) & "│" & Space(16); "┃"
Printer.Print Space(3) & "┠────┼─────┼─────┼─────┼─────┼─────┼──────┤ 专用变按分类电┃"
Printer.Print Space(3) & "┃ 小 计│"; Space(10) & "│" & Right(Space(10) & Trim(Text1(34)), 10) & "│" & Right(Space(10) & Trim(Text1(35)), 10) & "│" _
& Right(Space(10) & Trim(Text1(36)), 10) & "│" & Right(Space(10) & Trim(Text1(37)), 10) & "│" & Right(Space(12) & Trim(Text1(38)), 12) & "│" & "价计算 ┃"
Printer.Print Space(3) & "┠────┼─────┴─────┴─────┴─────┴─────┴──────┤ ┃"
Printer.Print Space(3) & "┃ 备 │ │ ┃"
Printer.Print Space(3) & "┃ 注 │ │ ┃"
Printer.Print Space(3) & "┗━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┛"
Printer.Print Space(3) & " 站长: 电管员:"
Printer.Print ""
Printer.EndDoc
Exit Sub
hander:
Select Case Err.Number
Case 482:
MsgBox "打印机错误!", vbCritical
Exit Sub
Case Else
Resume Next
End Select
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
OpenMdb
For i = 0 To 38
Text1(i).Alignment = 1
Text1(i).Enabled = False
Text1(i) = "0"
Next
For i = 0 To 6
Text2(i).Alignment = 1
' Text2(i).Enabled = False
Text2(i) = "0"
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -