📄 printtqhz.frm
字号:
Left = 75
Top = 810
Width = 10095
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "台区"
Height = 240
Left = 4230
TabIndex = 8
Top = 510
Width = 375
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 3060
TabIndex = 7
Top = 510
Width = 1170
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "村"
Height = 240
Left = 2715
TabIndex = 6
Top = 510
Width = 225
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1545
TabIndex = 5
Top = 510
Width = 1080
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "所"
Height = 240
Left = 1170
TabIndex = 4
Top = 510
Width = 285
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 75
TabIndex = 3
Top = 510
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "农村配备台区到户电量电费汇总表"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 3135
TabIndex = 2
Top = 90
Width = 4815
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 600
Left = 0
TabIndex = 0
Top = 0
Width = 10320
_ExtentX = 18203
_ExtentY = 1058
ButtonWidth = 1984
ButtonHeight = 1005
Style = 1
TextAlignment = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "计算"
Key = "计算"
ImageIndex = 3
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
Key = "打印"
ImageIndex = 1
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "退出"
ImageIndex = 2
EndProperty
EndProperty
BorderStyle = 1
Begin VB.TextBox Text1
Height = 315
Index = 54
Left = 1050
TabIndex = 78
Text = "Text1"
Top = 915
Width = 885
End
End
Begin MSComctlLib.ImageList ImageList1
Left = -15
Top = 5955
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "PrintTqhz.frx":08CA
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "PrintTqhz.frx":11A4
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "PrintTqhz.frx":14BE
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "PrintTqhz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Me.Caption = Me.Caption & "--->" & XzName & XcName
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 1 - 800
OpenMdb
Label2.Caption = pbDw
Label4.Caption = XcName
Label6.Caption = XcName
Label8(25).Caption = Format(Now, "yyyy年mm月dd日")
Label10.Caption = GzNian & "年" & GzYue & "月"
Text1(55) = Operator
Toolbar1.Buttons.Item(3).Enabled = False
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "计算"
Call CaculFee
Case "打印"
Call PrintCell
Case "退出"
Unload Me
End Select
End Sub
Sub CaculFee()
On Error GoTo sPopErr
Set MdbR = NdMd.OpenRecordset("select * from 公变月报 where 镇村代码='" & UserSeek & "'")
If MdbR.RecordCount <> 0 Then
With MdbR
Text1(7) = .Fields!dldl
Text1(20) = Format(.Fields!dldf, "0.00")
Text1(8) = .Fields!zmdl
Text1(21) = Format(.Fields!zmdf, "0.00")
Text1(9) = .Fields!fjdl
Text1(22) = Format(.Fields!fjdf, "0.00")
Text1(10) = .Fields!sydl
Text1(23) = Format(.Fields!sydf, "0.00")
Text1(13) = .Fields!hjdl
Text1(26) = Format(.Fields!hjdf, "0.00")
Text1(4) = .Fields!hjdl
End With
End If
Set MdbR = NdMd.OpenRecordset("select 村档案.[" & CC & "] as 配变抄见电量, 村档案.铁损系数 as 铁损, 村档案.容量 as 铜损,村档案.[" & NN & "] as 损失电量, 村档案.[" & MM & "] as 线损 from 村档案 where 镇村代码='" & UserSeek & "'")
If MdbR.RecordCount <> 0 Then
With MdbR
Text1(0) = .Fields!配变抄见电量 & ""
Text1(1) = .Fields!铁损 & ""
Text1(2) = .Fields!配变抄见电量 * 1.5 & "" '.Fields!铜损 & ""
Text1(5) = .Fields!配变抄见电量 - Val(Text1(4)) & "" '.Fields!损失电量 & ""
Text1(6) = Format((Val(Text1(5)) / .Fields!配变抄见电量) * 100, "0.00") & "%" '.Fields!线损 & "" '需要计算
Text1(3) = Val(Text1(0)) + Val(Text1(1)) + Val(Text1(2))
End With
End If
Set MdbR = NdMd.OpenRecordset("select * from 电价档案 where 标记='当前电价'")
If MdbR.RecordCount <> 0 Then
MdbR.MoveLast
MdbR.MoveFirst
Dim i As Integer
With MdbR
For i = 0 To .RecordCount - 1
If .Fields!电价代码 = "14" Then
Text1(14) = Format(.Fields!当前电价, "0.000")
End If
If .Fields!电价代码 = "11" Then
Text1(15) = Format(.Fields!当前电价, "0.000")
End If
If .Fields!电价代码 = "12" Then
Text1(16) = Format(.Fields!当前电价, "0.000")
End If
If .Fields!电价代码 = "13" Then
Text1(17) = Format(.Fields!当前电价, "0.000")
End If
.MoveNext
Next
End With
End If
Toolbar1.Buttons.Item(3).Enabled = True
Exit Sub
sPopErr:
MsgBox Err.Description, vbCritical
Exit Sub
End Sub
Sub PrintCell()
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 '设置坐标的全部高度
Printer.ScaleWidth = 100 '设置坐标的全部长度
Printer.Orientation = 2
Printer.CurrentY = 0
Printer.CurrentX = 0
Printer.Font.Name = "黑体"
Printer.FontSize = 16
'─││┆┈┄┆┊┌┐└┘├┤┬┴┼╱╲「」
Printer.Print Space(32) & "农村配变台区到户电量、电价、电费汇总表"
Printer.Print Space(32) & "┈┄┈┄┈┄┈┄┈┄┈┄┈┄┈┄┈┄┈"
Printer.Font.Name = "宋体"
Printer.FontSize = 11
Printer.Print Space(16) & "填制单位:" & Left(Trim(Label2.Caption) & Trim(Label4.Caption) & Space(20), 26 - convert_str(Trim(Label2.Caption) & Trim(Label4.Caption))) & Space(28) & Trim(Year(Date)) & "年" & Trim(Month(Date)) & "月份" & Space(30) & "附页"
Printer.Print Space(13) & "┏━━━━━━┯━━━━━━━━┯━━━━━┯━━━━━━━┯━━━┯━━━━━━┯━━━━━┯━━━━━━━━┓"
Printer.Print Space(13) & "┃配变抄见电量│ " & Right(Space(12) & Trim(Text1(0).Text), 12) & " │ 铁 损 │ " & Right(Space(6) & Trim(Text1(1).Text), 6) & " │ 铜损 │ " & Right(Space(6) & Trim(Text1(2).Text), 6) & " │ 合计电量 │ " & Right(Space(12) & Trim(Text1(3).Text), 12) & " ┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼────────┴──┬──┴──┬────┴───┴─┬────┼─────┴────────┨"
Printer.Print Space(13) & "┃到户合计电量│ " & Right(Space(12) & Trim(Text1(4).Text), 12) & " │ 损失电量│ " & Right(Space(6) & Trim(Text1(5).Text), 6) & " │ 损失率 │" & Space(11) & Right(Space(6) & Trim(Text1(6).Text), 6) & Space(11) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┬────┼─────┼──────┬───┴┬───┴─┬────┬───────┨"
Printer.Print Space(13) & "┃用电分类电量│ 计费电量 │ 单 价 │ 金 额 │差价还贷电量│ 单 价 │ 金 额 │用电户数│ 备 注 ┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 动 力 │ " & Right(Space(10) & Trim(Text1(7).Text), 10) & "│" & Right(Space(6) & Trim(Text1(14).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(20).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(27).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(34).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(40).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(47).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 生活照明 │ " & Right(Space(10) & Trim(Text1(8).Text), 10) & "│" & Right(Space(6) & Trim(Text1(15).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(21).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(28).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(35).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(41).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(48).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 机关照明 │ " & Right(Space(10) & Trim(Text1(9).Text), 10) & "│" & Right(Space(6) & Trim(Text1(16).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(22).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(29).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(36).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(42).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(49).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 营业照明 │ " & Right(Space(10) & Trim(Text1(10).Text), 10) & "│" & Right(Space(6) & Trim(Text1(17).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(23).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(30).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(37).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(43).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(50).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 农业生产 │ " & Right(Space(10) & Trim(Text1(11).Text), 10) & "│" & Right(Space(6) & Trim(Text1(18).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(24).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(31).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(38).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(44).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(51).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ 农 排 │ " & Right(Space(10) & Trim(Text1(12).Text), 10) & "│" & Right(Space(6) & Trim(Text1(19).Text), 6) & " │ " & Right(Space(8) & Trim(Text1(25).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(32).Text), 6) & "│ " & Right(Space(6) & Trim(Text1(39).Text), 6) & "│ " & Right(Space(8) & Trim(Text1(45).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(52).Text), 6) & " │" & Space(14) & "┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┠──────┼──────┼────┼─────┼──────┼────┼─────┼────┼───────┨"
Printer.Print Space(13) & "┃ │ │ │ │ │ │ │ │ ┃"
Printer.Print Space(13) & "┃ 合 计 │ " & Right(Space(10) & Trim(Text1(13).Text), 10) & "│ │" & Right(Space(10) & Trim(Text1(26).Text), 10) & "│ " & Right(Space(8) & Trim(Text1(33).Text), 8) & "│ │ " & Right(Space(8) & Trim(Text1(46).Text), 8) & "│ " & Right(Space(6) & Trim(Text1(53).Text), 6) & "│" & Space(14) & "┃"
Printer.Print Space(13) & "┗━━━━━━┷━━━━━━┷━━━━┷━━━━━┷━━━━━━┷━━━━┷━━━━━┷━━━━┷━━━━━━━┛"
Printer.Print " 制表人:" & Left(Trim(Text1(55).Text) & Space(20), 26 - convert_str(Trim(Text1(55).Text))) & Space(22) & "制表日期:" & Label8(25).Caption
Printer.Print ""
Exit Sub
hander:
Select Case Err.Number
Case 482:
MsgBox "打印机错误!", vbCritical
Exit Sub
Case Else
Resume Next
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -