📄 打印发票.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
TabIndex = 5
Top = 0
Width = 5775
End
Begin VB.Line Line4
X1 = 360
X2 = 1440
Y1 = 600
Y2 = 600
End
Begin VB.Line Line3
X1 = 360
X2 = 360
Y1 = 120
Y2 = 600
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "月"
Height = 255
Left = 1080
TabIndex = 4
Top = 240
Width = 255
End
Begin VB.Line Line2
X1 = 1440
X2 = 1440
Y1 = 120
Y2 = 600
End
Begin VB.Line Line1
BorderColor = &H00000000&
X1 = 360
X2 = 1440
Y1 = 120
Y2 = 120
End
End
End
Attribute VB_Name = "PrintFp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error Resume Next
If Option1 Then
Call printer_init 'PrinterInit
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.CurrentX = gCol1
Printer.CurrentY = gRow1
Printer.Print Text1 '月份
Printer.CurrentX = gCol2
Printer.CurrentY = gRow2
Printer.Print Text2; '代码
'Printer.CurrentX = gCol2 + 23
'Printer.CurrentY = gRow2
'Printer.Print sQuYeMa;
' Printer.CurrentX = gCol2 + 41
' Printer.CurrentY = gRow2
' Printer.Print sNo
Printer.CurrentX = gCol3
Printer.CurrentY = gRow3
Printer.Print Text8 '户名
Printer.CurrentX = gCol3 + 41
Printer.CurrentY = gRow3
Printer.Print Text9 '地址
Printer.CurrentX = gCol4 + 2
Printer.CurrentY = gRow4
Printer.Print Text14; '本期
Printer.CurrentX = gCol4 + 12
Printer.CurrentY = gRow4
Printer.Print Text17; '上期
Printer.CurrentX = gCol4 + 25
Printer.CurrentY = gRow4
Printer.Print Text20; '表损
Printer.CurrentX = gCol4 + 34
Printer.CurrentY = gRow4
Printer.Print Text23; '电量
Printer.CurrentX = gCol4 + 42
Printer.CurrentY = gRow4
Printer.Print Text26; '电价
Printer.CurrentX = gCol4 + 50
Printer.CurrentY = gRow4
Printer.Print Text29 '金额 Format(sJinE / 100#, "0.00")
' Printer.CurrentX = gCol4 + 59
' Printer.CurrentY = gRow4
' Printer.Print "退补:" & sBeiZhu '加入退补
Printer.CurrentX = gCol5 - 2 * Len(Text35)
Printer.CurrentY = gRow5
Printer.Print Text35; '千
Printer.CurrentX = gCol5 + 4
Printer.CurrentY = gRow5
Printer.Print Text36; '百
Printer.CurrentX = gCol5 + 10
Printer.CurrentY = gRow5
Printer.Print Text37; '十
Printer.CurrentX = gCol5 + 18
Printer.CurrentY = gRow5
Printer.Print Text38; '元
Printer.CurrentX = gCol5 + 24
Printer.CurrentY = gRow5
Printer.Print Text39; '角
Printer.CurrentX = gCol5 + 32
Printer.CurrentY = gRow5
Printer.Print Text40; '分
Printer.CurrentX = gCol5 + 52
Printer.CurrentY = gRow5
Printer.Print Label1.Caption '银行代码
Printer.CurrentX = gCol6
Printer.CurrentY = gRow6
Printer.Print Text11; '年
Printer.CurrentX = gCol6 + 9
Printer.CurrentY = gRow6
Printer.Print Text12; '月
Printer.CurrentX = gCol6 + 17
Printer.CurrentY = gRow6
Printer.Print Text13; '日
Printer.CurrentX = gCol6 + 40
Printer.CurrentY = gRow6
Printer.Print Text10 '收费员
Printer.NewPage
'加入一打印
'mydb.Execute "update fee set handdate='" & Format(Now, "yyyy-mm-dd hh:mm:ss") & "' where fee.userid='" & Trim(Text1(1).Text) & "' and fee.year='" & Year(Date) & "' and fee.month='" & Format(Month(Date), "0#") & "'"
'mydb.Close
Call PrinterEnd
Else '连续打印
'"select * from 用户档案 where village.name='" & Trim(Combo_vill.Text) & "' and town.name='" & Trim(Combo_town.Text) & "'and user.usercode >= '" & start & "' and user.usercode <='" & end_s & "'"
' frm_common_select.Ado_temp.Refresh
' With frm_common_select.Ado_temp.Recordset
' If .RecordCount <> 0 Then
' Call SetPrinterPara
' Call PrinterInit
' Screen.MousePointer = 11
' mydb.Open "DBQ=" & data_basename & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=d^j&d*s!j~;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
' For i = 0 To .RecordCount - 1
' Call PrintFP(month_string, .Fields("用户代码"), " ", " ", .Fields("用户名"), .Fields("地址"), .Fields("本期示数"), .Fields("上期示数"), .Fields("表损"), Format(.Fields("电价"), "0.0000"), .Fields("退补"), .Fields("倍率"), "", .Fields("收费员"))
' mydb.Execute "update fee set handdate='" & Format(Now, "yyyy-mm-dd hh:mm:ss") & "' where fee.userid='" & Trim(.Fields("用户代码")) & "' and fee.year='" & year_string & "' and fee.month='" & month_string & "'"
' If .AbsolutePosition = .RecordCount Then
' .MoveLast
' Else
' .MoveNext
' End If
' Next
' mydb.Close
' Screen.MousePointer = 0
' Call PrinterEnd
' Else
' MsgBox "没有数据要打印!", vbExclamation
' Exit Sub
' End If
' End With
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim SQLA As String
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
Frame4.Enabled = False
Label7.Enabled = False
Label8.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text3.Enabled = False
vfy1.Visible = False
Frame3.Enabled = False
Label36.Enabled = False
Label37.Enabled = False
Label38.Enabled = False
Command1.Enabled = False
AniGIF1.AutoSize = True
AniGIF1.Transparent = True
AniGIF1.ReadGIF (App.Path & "\Bmp\Gif\line.GIF")
AniGIF1.Play
OpenMdb
SQLA = "select * from 用户档案 where 年份='" & Trim(GzNian) & "' and 月份='" & Trim(GzYue) & "' and 镇村代码='" & UserSeek & "'"
Set MdbR = NdMd.OpenRecordset(SQLA)
End Sub
Private Sub Option1_Click()
Label7.Enabled = False
Label8.Enabled = False
vfy1.Visible = False
Picture1.Visible = True
Label36.Enabled = True
Label37.Enabled = True
Label38.Enabled = True
Frame3.Enabled = True
Frame4.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text3.Enabled = True
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
End Sub
Private Sub Option2_Click()
Command1.Enabled = False
Frame3.Enabled = False
Text3.Enabled = False
Label36.Enabled = False
Label37.Enabled = False
Label38.Enabled = False
Picture1.Visible = True
vfy1.Visible = True
Frame4.Enabled = True
Label7.Enabled = True
Label8.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text4.SetFocus
End Sub
Private Sub Text3_Change()
If Len(Trim(Text3)) <> 0 Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Sub Text3_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text3.Text = "" Or Len(Trim(Text3)) > 4 Or Len(Trim(Text3)) < 4 Then
MsgBox "输入用户代码不正确!", vbCritical
Else
Set MdbR = NdMd.OpenRecordset("select * from 用户档案 where 年份='" & Trim(GzNian) & "' and 月份='" & Trim(GzYue) & "' and 组合编码='" & UserSeek & Trim(Text3) & "'")
If MdbR.RecordCount = 0 Then
MsgBox "无此用户,请检查代码的正确性!", vbCritical
Text3.SetFocus
Else
Command1.Enabled = True
' Command1.SetFocus
Label2.Visible = False
Text1 = GzYue
Text2 = UserSeek & Trim(Text3)
Text8 = MdbR.Fields!用户名称 & ""
Text9 = MdbR.Fields!地址
Text14 = MdbR.Fields!本期示数 & ""
Text17 = MdbR.Fields!上期示数 & ""
Text20 = MdbR.Fields!表损 & ""
Text23 = MdbR.Fields!合计电量 & ""
Text26 = Format(MdbR.Fields!电价, "0.000")
Text29 = Format(MdbR.Fields!合计电费, "0.00")
Label1 = MdbR.Fields!账号 & ""
Text11 = Format(Year(Date), "0000")
Text12 = Format(Month(Date), "0#")
Text13 = Format(Day(Date), "0#")
Dim CMY, CYM As String
CMY = ChMoney(Text29)
CYM = Len(CMY)
Select Case CYM
Case 1
Resuf
Text35 = "×"
Text36 = "×"
Text37 = "×"
Text38 = "×"
Text39 = "×"
Text40 = CMY
Case 2
Resuf
Text35 = "×"
Text36 = "×"
Text37 = "×"
Text38 = "×"
Text39 = Mid(CMY, 1, 1)
Text40 = Mid(CMY, 2, 1)
Case 3
Resuf
Text35 = "×"
Text36 = "×"
Text37 = "×"
Text38 = Mid(CMY, 1, 1)
Text39 = Mid(CMY, 2, 1)
Text40 = Mid(CMY, 3, 1)
Case 4
Resuf
Text35 = "×"
Text36 = "×"
Text37 = Mid(CMY, 1, 1)
Text38 = Mid(CMY, 2, 1)
Text39 = Mid(CMY, 3, 1)
Text40 = Mid(CMY, 4, 1)
Case 5
Resuf
Text35 = "×"
Text36 = Mid(CMY, 1, 1)
Text37 = Mid(CMY, 2, 1)
Text38 = Mid(CMY, 3, 1)
Text39 = Mid(CMY, 4, 1)
Text40 = Mid(CMY, 5, 1)
Case 6
Resuf
Text35 = Mid(CMY, 1, 1)
Text36 = Mid(CMY, 2, 1)
Text37 = Mid(CMY, 3, 1)
Text38 = Mid(CMY, 4, 1)
Text39 = Mid(CMY, 5, 1)
Text40 = Mid(CMY, 6, 1)
Case Else
Label23.Visible = False
Label31.Visible = False
Label32.Visible = False
Label33.Visible = False
Label34.Visible = False
Label35.Visible = False
Text35.Visible = False
Text36.Visible = False
Text37.Visible = False
Text38.Visible = False
Text39.Visible = False
Text40.Visible = False
Label2.Visible = True
Label2.Refresh
Label2.Caption = ChMoneyY(Text29)
End Select
Text3.SetFocus
Text6.SetFocus
End If
End If
End If
End Sub
Sub Text4_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text4.Text <> "" Then
Text5.SetFocus
End If
End If
End Sub
Private Sub Text5_Change()
If Len(Trim(Text5)) <> 0 Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Sub Text5_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text5.Text <> "" And Val(Text5) < Val(Text4) Then
MsgBox "数据输入有误!", vbCritical
Text5.SelStart = 0
Text5.SelLength = Len(Text5)
Text5.SetFocus
Else
Data1.DatabaseName = App.Path & "\Data\Eletricity.Mdb"
Data1.RecordSource = "SELECT 用户档案.组合编码, 用户档案.用户表码, 用户档案.年份, 用户档案.月份, 用户档案.用户名称, 用户档案.地址, 用户档案.表损, 用户档案.倍率, 用户档案.电价, 用户档案.上期示数, 用户档案.本期示数, 用户档案.本次电量, 用户档案.调整电量, 用户档案.合计电量, 用户档案.本次电费, 用户档案.合计电费 FROM 用户档案 where 年份='" & Trim(GzNian) & "' and 月份='" & Trim(GzYue) & "' and 镇村代码='" & UserSeek & "' and 用户表码>= '" & IIf(Len(Trim(Text4)) <> 4, Right("0000" + Trim(Text4), 4), Trim(Text4)) & "' and 用户表码 <='" & IIf(Len(Trim(Text5)) <> 4, Right("0000" + Trim(Text5), 4), Trim(Text5)) & "' ORDER BY 组合编码 ASC"
Data1.Refresh
Command1.Enabled = True
Command1.SetFocus
End If
End If
End Sub
Sub Resuf()
Label23.Visible = True
Label31.Visible = True
Label32.Visible = True
Label33.Visible = True
Label34.Visible = True
Label35.Visible = True
Text35.Visible = True
Text36.Visible = True
Text37.Visible = True
Text38.Visible = True
Text39.Visible = True
Text40.Visible = True
Label2.Visible = False
End Sub
Private Sub Text6_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Val(Text6) < Val(Text29) Then
MsgBox "对不起,您付的钞票不对!", vbCritical
Text6.SelStart = 0
Text6.SelLength = Len(Text6)
Text6.SetFocus
Else
Text41 = Format(Val(Text6) - Val(Text29), "0.00")
End If
Else
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -