📄 printinvoice.frm
字号:
End If
If Not IsNull(PriReco!电价) Then
itm.SubItems(7) = Format(PriReco!电价, "0.00")
End If
If Not IsNull(PriReco!合计电费) Then
itm.SubItems(8) = Format(PriReco!合计电费, "0.0")
End If
DisPDL = DisPDL + PriReco.Fields!本次电量
DispDF = DispDF + PriReco.Fields!本次电费
HjFee = HjFee + PriReco.Fields!合计电费
HjElec = HjElec + PriReco.Fields!合计电量
Scye = PriReco.Fields!上期余额
End If
PriReco.MoveNext
Next
If PriReco.RecordCount > 1 Then
Label2.Visible = True
Label2.Caption = ChMoneyY(Format(HjFee, "0.0"))
Set itm = ListView1.ListItems.Add(, , "合计:")
itm.SubItems(2) = DisPDL
itm.SubItems(8) = Format(HjFee, "0.0")
itm.SubItems(6) = HjElec
Set itm = ListView1.ListItems.Add(, , "")
If Val(Right(Format(HjFee, "0.00"), 1)) > 4 Then '±
itm.SubItems(7) = "余额:+"
itm.SubItems(8) = Format(Val(Format(HjFee, "0.0")) - HjFee, "0.00")
Else
If Val(Right(Format(HjFee, "0.00"), 1)) <> 0 Then
itm.SubItems(7) = "余额:-"
itm.SubItems(8) = "0.0" & Format(Val(Format(HjFee, "0.0")) - HjFee, "0.00")
End If
End If
'Scye = PriReco.Fields!上期余额
If Left(Scye, 1) = "-" Then
itm.SubItems(5) = "上次:"
itm.SubItems(6) = "+" & Format(Right(Scye, 3), "0.00")
Else
itm.SubItems(5) = "上次:"
itm.SubItems(6) = "-" & Format(Scye, "0.00")
End If
Else
Label2.Visible = True
Label2.Caption = ChMoneyY(Format(HjFee, "0.0"))
Set itm = ListView1.ListItems.Add(, , "")
If Val(Right(Format(HjFee, "0.00"), 1)) > 4 Then '±
itm.SubItems(7) = "余额:+"
itm.SubItems(8) = Format(Val(Format(HjFee, "0.0")) - HjFee, "0.00")
Else
If Val(Right(Format(HjFee, "0.00"), 1)) <> 0 Then
itm.SubItems(7) = "余额:-"
itm.SubItems(8) = Format(HjFee - Val(Format(HjFee, "0.0")), "0.00")
End If
End If
If Left(Scye, 1) = "-" Then
itm.SubItems(5) = "上次:"
itm.SubItems(6) = "+" & Format(Right(Scye, 3), "0.00")
Else
itm.SubItems(5) = "上次:"
itm.SubItems(6) = "-" & Format(Scye, "0.00")
End If
End If
Label1(9).Caption = GzNian
Label1(10).Caption = Format(Month(Date), "00") 'GzYue
Label1(11).Caption = Format(Day(Date), "0#")
Label1(6).Caption = Operator
Set fpMDB = NdMd.OpenRecordset("SELECT * FROM fpNumber")
If fpMDB.RecordCount <> 0 Then
fpMDB.MoveLast
fpMDB.MoveFirst
If fpMDB.RecordCount = 999999 Then
NdMd.Execute "DELETE * FROM FpNumber"
End If
End If
With fpMDB
.AddNew
.Fields(0) = Format(.RecordCount + 1, "000000")
dispSer = Format(.RecordCount + 1, "000000")
.Update
End With
Label11.Caption = dispSer
fpMDB.Close
End Sub
Sub StartPrint()
Dim I As Integer
Set Hrecd = NdMd.OpenRecordset("fp")
With Hrecd
.MoveLast
.MoveFirst
Printer.CurrentY = 0
Printer.FontSize = 11
For I = 1 To .RecordCount
Printer.CurrentX = 6
Printer.Print IIf(IsNull(.Fields(1)) = True, "", .Fields(1))
.MoveNext
Next
End With
End Sub
Sub PrintP()
Dim I As Integer, pp As Integer, n As Integer
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.CurrentX = 17 '间距
Printer.CurrentY = gRow1 + n '行距
Printer.Print Label13.Caption;
Printer.CurrentX = 64
Printer.CurrentY = gRow1 + n
Printer.Print Label13.Caption; '题头
Printer.CurrentX = 35
Printer.CurrentY = gRow2 + n '5
Printer.Print "№." & Label11.Caption;
Printer.CurrentX = 82
Printer.CurrentY = gRow2 + n '5
Printer.Print "№." & Label11.Caption; '发票号
Printer.CurrentX = 4
Printer.CurrentY = gRow3 + n
Printer.Print Label1(0).Caption;
Printer.CurrentX = 52
Printer.CurrentY = gRow3 + n
Printer.Print Label1(0).Caption; '台区
Printer.CurrentX = 17
Printer.CurrentY = gRow3 + n
Printer.Print Label1(1).Caption;
Printer.CurrentX = 65
Printer.CurrentY = gRow3 + n
Printer.Print Label1(1).Caption; '户号
Printer.CurrentX = 30
Printer.CurrentY = gRow3 + n
Printer.Print Label1(2).Caption;
Printer.CurrentX = 77
Printer.CurrentY = gRow3 + n
Printer.Print Label1(2).Caption; '户名
For I = 1 To ListView1.ListItems.Count '电费
Set ListView1.SelectedItem = ListView1.ListItems(I)
Select Case I
Case 1
pp = gRow4 + n
Case 2
pp = gRow5 + n
Case 3
pp = gRow6 + n
Case 4
pp = gRow7 + n
End Select
Printer.CurrentX = 1
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem; '上期
Printer.CurrentX = 48
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem; '上期
Printer.CurrentX = 6
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(1); '本期
Printer.CurrentX = 53
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(1); '本期
Printer.CurrentX = 11.5
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(2); '本次电量
Printer.CurrentX = 57
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(2); '本次电量
Printer.CurrentX = 15
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(3); '倍率
Printer.CurrentX = 63
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(3); '倍率
Printer.CurrentX = 19
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(4); '表损
Printer.CurrentX = 66
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(4); '表损
Printer.CurrentX = 23
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(5); '退补
Printer.CurrentX = 71
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(5); '退补
Printer.CurrentX = 28
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(6); '合计电量
Printer.CurrentX = 75
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(6); '合计电量
Printer.CurrentX = 33
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(7); '电价
Printer.CurrentX = 80
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(7); '电价'
Printer.CurrentX = 38
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(8); '金额
Printer.CurrentX = 85
Printer.CurrentY = pp
Printer.Print ListView1.SelectedItem.SubItems(8); '金额
Next
Printer.CurrentX = 5
Printer.CurrentY = gRow8 + n '74
Printer.Print Label2.Caption;
Printer.CurrentX = 53
Printer.CurrentY = gRow8 + n
Printer.Print Label2.Caption; '大写
Printer.CurrentX = 4
Printer.CurrentY = IIf(gRow9 + n > 90, 90, gRow9 + n)
Printer.Print Label1(6).Caption; '开票
Printer.CurrentX = 52
Printer.CurrentY = IIf(gRow9 + n > 90, 90, gRow9 + n) '82
Printer.Print Label1(6).Caption; '开票
Printer.CurrentX = 28
Printer.CurrentY = IIf(gRow9 + n > 90, 90, gRow9 + n)
Printer.Print Label1(9).Caption & Space(4) & Label1(10).Caption & Space(3) & Label1(11).Caption;
Printer.CurrentX = 75
Printer.CurrentY = IIf(gRow9 + n > 90, 90, gRow9 + n)
Printer.Print Label1(9).Caption & Space(4) & Label1(10).Caption & Space(4) & Label1(11).Caption;
End Sub
Sub ProcView(userid As Integer, PrintItem As String)
Dim strQ As String
strQ = "SELECT fp.ID, fp.fp From fp where id=" & userid
Set Hrecd = NdMd.OpenRecordset(strQ)
Hrecd.Edit
Hrecd.Fields(1) = PrintItem ''" & UserSeek & Trim(Text3) & "'"
Hrecd.Update
End Sub
Function PrinXY(Sid As Integer) As String
Select Case Sid
Case 1 '标题
PrinXY = Space(19) & Left(Trim(Label13.Caption) & Space(20), 20 - convert_str(Trim(Label13.Caption))) & Space(37) & Left(Trim(Label13.Caption) & Space(20), 20 - convert_str(Trim(Label13.Caption)))
Case 2 '发票序号
PrinXY = Space(40) & "№." & Label11.Caption & Space(48) & "№." & Label11.Caption
Case 3 '台区,户号,户名
PrinXY = Space(2) & Left(Trim(Label1(0).Caption) & Space(16), 16 - convert_str(Trim(Label1(0).Caption))) & Space(1) & Left(Label1(1).Caption & Space(12), 4) & Space(11) & Left(Trim(Label1(2).Caption) & Space(16), 16 - convert_str(Trim(Label1(2).Caption))) & Space(10) & Left(Trim(Label1(0).Caption) & Space(16), 16 - convert_str(Trim(Label1(0).Caption))) & Space(1) & Left(Label1(1).Caption & Space(12), 4) & Space(11) & Left(Trim(Label1(2).Caption) & Space(16), 16 - convert_str(Trim(Label1(2).Caption)))
Case 4 '大写
PrinXY = Space(4) & Left(Trim(Label2.Caption) & Space(20), 20 - convert_str(Trim(Label2.Caption))) & Space(38) & Left(Trim(Label2.Caption) & Space(20), 20 - convert_str(Trim(Label2.Caption)))
Case 5 '审核,年月日
PrinXY = Space(3) & Left(Trim(Trim(Label1(6).Caption)) & Space(12), 12 - convert_str(Trim(Label1(6).Caption))) & Space(18) & Label1(9).Caption & Space(3) & Label1(10).Caption & Space(3) & Label1(11).Caption & Space(13) & Left(Trim(Trim(Label1(6).Caption)) & Space(12), 12 - convert_str(Trim(Label1(6).Caption))) & Space(18) & Label1(9).Caption & Space(3) & Label1(10).Caption & Space(3) & Label1(11).Caption
Case 6 '用户明细
If ListView1.SelectedItem = "合计:" Then
PrinXY = Left(Trim(ListView1.SelectedItem) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(1)) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(2)) & Space(5), 5) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(3)) & Space(3), 3) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(4)) & Space(1), 1) & Space(5) _
& Left(Trim(ListView1.SelectedItem.SubItems(5)) & Space(4), 4) _
& Left(Trim(ListView1.SelectedItem.SubItems(6)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(7)) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(8)) & Space(6), 6) _
& Space(5) _
& Left(Trim(ListView1.SelectedItem) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(1)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(2)) & Space(5), 5) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(3)) & Space(3), 3) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(4)) & Space(1), 1) & Space(5) _
& Left(Trim(ListView1.SelectedItem.SubItems(5)) & Space(4), 4) _
& Left(Trim(ListView1.SelectedItem.SubItems(6)) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(7)) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(8)) & Space(6), 6)
Else
PrinXY = Left(Trim(ListView1.SelectedItem) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(1)) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(2)) & Space(5), 5) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(3)) & Space(3), 3) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(4)) & Space(1), 1) & Space(5) _
& Left(Trim(ListView1.SelectedItem.SubItems(5)) & Space(4), 4) _
& Left(Trim(ListView1.SelectedItem.SubItems(6)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(7)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(8)) & Space(6), 6) _
& Space(6) _
& Left(Trim(ListView1.SelectedItem) & Space(5), 5) _
& Left(Trim(ListView1.SelectedItem.SubItems(1)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(2)) & Space(5), 5) & Space(1) _
& Left(Trim(ListView1.SelectedItem.SubItems(3)) & Space(3), 3) & Space(2) _
& Left(Trim(ListView1.SelectedItem.SubItems(4)) & Space(1), 1) & Space(5) _
& Left(Trim(ListView1.SelectedItem.SubItems(5)) & Space(4), 4) _
& Left(Trim(ListView1.SelectedItem.SubItems(6)) & Space(5), 5) & Space(2) _
& Left(Trim(ListView1.Selecte
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -