⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 print.bas

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 BAS
📖 第 1 页 / 共 2 页
字号:
If Trim(sQian) = "" Then sQian = "零"

sTemp = "000000" & sJinE
sBai = cIntToChar(CLng(Mid(sTemp, Len(sTemp) - 4, 1)))
sShi = cIntToChar(CLng(Mid(sTemp, Len(sTemp) - 3, 1)))
sYuan = cIntToChar(CLng(Mid(sTemp, Len(sTemp) - 2, 1)))
sJiao = cIntToChar(CLng(Mid(sTemp, Len(sTemp) - 1, 1)))
sFen = cIntToChar(CLng(Mid(sTemp, Len(sTemp) - 0, 1)))

'sYinHangDM = "11111111"
sNian = CStr(Year(Now()))
sYue = Right("00" & CStr(Month(Now())), 2)
sRi = Right("00" & CStr(Day(Now())), 2)
'sShouFeiY = ""
    
    
   Printer.CurrentX = 0
   Printer.CurrentY = 0
   'Printer.Print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbb"
   Printer.CurrentX = gCol1
   Printer.CurrentY = gRow1
   Printer.Print sYueFen
   
   Printer.CurrentX = gCol2
   Printer.CurrentY = gRow2
   Printer.Print sHuHao;
   
   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 sHuMing;
   
   Printer.CurrentX = gCol3 + 41
   Printer.CurrentY = gRow3
   Printer.Print sDiZhi
   
   Printer.CurrentX = gCol4
   Printer.CurrentY = gRow4
   Printer.Print sBenQi;
   
   Printer.CurrentX = gCol4 + 12
   Printer.CurrentY = gRow4
   Printer.Print sShangQi;
   
   Printer.CurrentX = gCol4 + 23
   Printer.CurrentY = gRow4
   Printer.Print sBiaoSun;
   
   Printer.CurrentX = gCol4 + 31
   Printer.CurrentY = gRow4
   Printer.Print sDianLiang;
   
   Printer.CurrentX = gCol4 + 39
   Printer.CurrentY = gRow4
   Printer.Print sDanJia;
   
   Printer.CurrentX = gCol4 + 48
   Printer.CurrentY = gRow4
   Printer.Print Format(sJinE / 100#, "0.00")
   
   Printer.CurrentX = gCol4 + 59
   Printer.CurrentY = gRow4
   Printer.Print "退补:" & sBeiZhu   '改成多行打印
   
   Printer.CurrentX = gCol5 - 2 * Len(sQian)
   Printer.CurrentY = gRow5
   Printer.Print sQian;
   
   Printer.CurrentX = gCol5 + 4
   Printer.CurrentY = gRow5
   Printer.Print sBai;
   
   Printer.CurrentX = gCol5 + 10
   Printer.CurrentY = gRow5
   Printer.Print sShi;
   
   Printer.CurrentX = gCol5 + 18
   Printer.CurrentY = gRow5
   Printer.Print sYuan;
   
   Printer.CurrentX = gCol5 + 24
   Printer.CurrentY = gRow5
   Printer.Print sJiao;
   
   Printer.CurrentX = gCol5 + 32
   Printer.CurrentY = gRow5
   Printer.Print sFen;
   
   Printer.CurrentX = gCol5 + 52
   Printer.CurrentY = gRow5
   Printer.Print sYinHangDM
   
   Printer.CurrentX = gCol6
   Printer.CurrentY = gRow6
   Printer.Print sNian;
   
   Printer.CurrentX = gCol6 + 9
   Printer.CurrentY = gRow6
   Printer.Print sYue;
   
   Printer.CurrentX = gCol6 + 17
   Printer.CurrentY = gRow6
   Printer.Print sRi;
   
   Printer.CurrentX = gCol6 + 40
   Printer.CurrentY = gRow6
   Printer.Print sShouFeiY
   
   PrintFp = True
   Printer.NewPage
   
End Function

'发票打印
Public Function PrinterInit() As Boolean

'/////////////////////////////  打印机初始化  ///////////////////////////////////////
    'On Error GoTo hander
    
    Printer.ColorMode = 1                           '用单色打印
   ' Printer.Copies = 1                             '打印的打印份数
    Printer.CurrentX = 0
    Printer.CurrentY = 0                            '打印机的初始位置
    Printer.Duplex = 1                              '单面打印
    Printer.Font.Bold = True                        '打印按黑体
    Printer.Font.Italic = False                     '打印斜体
    Printer.Font.Name = "宋体"                      '打印的字体
    Printer.Font.Size = 11                          '打印字体的大小
    Printer.Font.Underline = False                  '不打印下划线
    Printer.Font.Weight = 9                         '字体的重量
    Printer.FontTransparent = True                  '打印字体的透明
    
    Printer.ScaleMode = 3                           '按像素计算打印机纸张的大小
    Printer.Height = gHeight                             '打印页面的大小
    Printer.Width = gWidth
   
    Printer.ScaleMode = 0
    Printer.ScaleTop = 0                            '设置坐标的起始位置的最上边
    Printer.ScaleLeft = 0                           '设置坐标的起始位置的最左边
    Printer.ScaleHeight = 100                       '设置坐标的全部高度
    Printer.ScaleWidth = 100                        '设置坐标的全部长度
    
    
    Printer.Orientation = 1                         '横向打印
   ' Printer.PaperSize                               '自定义打印大小
    
    'Printer.PrintQuality = -4                       '按高分辨率打印
    
    
    'Printer.TrackDefault = True                     '以系统默认的打印机打印,不能有,好像有问题
'   Exit Function
    
    '/////////////////////////////   打印机初始化结束 ////////////////////////////////////
End Function



'/////////////////////////////////// 将单个数值转换成单个字符串全局函数  ///////////////////////////
Public Function cIntToChar(ParaNumber As Integer) As String
  Select Case ParaNumber
    Case 0:
        cIntToChar = "零"
    Case 1:
        cIntToChar = "壹"
    Case 2:
        cIntToChar = "贰"
    Case 3:
        cIntToChar = "参"
    Case 4:
        cIntToChar = "肆"
    Case 5:
        cIntToChar = "伍"
    Case 6:
        cIntToChar = "陆"
    Case 7:
        cIntToChar = "柒"
    Case 8:
        cIntToChar = "捌"
    Case 9:
        cIntToChar = "玖"
  End Select
End Function

'/////////////////////////////////// 将大于千的数值转换成字符串全局函数  ///////////////////////////

Public Function cMoneyToString(ByVal money As Integer) As String
    Dim StrLen As Integer          '字符串的长度
    Dim sMoney As String           '字符串表示的数量
    Dim sResult As String          '存放结果字符串
    Dim iTemp  As Integer
    Dim cTemp As String            '存放单个字符
    sResult = ""
    sMoney = CStr(money)
    StrLen = Len(sMoney)
    For iTemp = 1 To StrLen Step 1
        cTemp = Mid(sMoney, iTemp, 1)
        sResult = sResult & cIntToChar(CInt(cTemp))
        Select Case StrLen - iTemp + 1
            Case 1:
                sResult = sResult & ""
            Case 2:
                sResult = sResult & "十"
            Case 3:
                sResult = sResult & "百"
            Case 4:
                sResult = sResult & "千"
            Case 5:
                sResult = sResult & "万"
            Case 6:
                sResult = sResult & "十"
            Case 7:
                sResult = sResult & "百"
            Case 8:
                sResult = sResult & "千"
        End Select
    Next
    cMoneyToString = sResult
End Function

Public Function PrinterEnd()
    MsgBox "所需项目打印完毕", vbInformation
    Printer.EndDoc
End Function

Public Function printer_string(c_currrentx As Long, c_currenty As Long, c_string As String)
    Printer.CurrentX = c_currentx
    Printer.CurrentY = c_currenty
    Printer.Print c_string
    Printer.CurrentX = 0
End Function


Public Function convert_str(mystring As String) As Integer
Dim i As Integer
Dim temp As String
Dim count_hz As Integer
    temp = ""
    count_hz = 0
    For i = 0 To Len(mystring) - 1
       If Asc(Mid(mystring, i + 1, 1)) < 0 Then
             count_hz = count_hz + 1
       End If
    Next
    convert_str = count_hz
End Function

Public Function printer_record(userid As String, usercode As String, username As String, curmon As String, lastmon As String, lost As String, makeup As String, zhinajin As String, times As String, quantity As String, price As String, fee As String, zone As String)
        Dim c_currenty As Long
        
        On Error Resume Next
        
        c_currenty = Printer.CurrentY
        Printer.CurrentX = 0
        Printer.CurrentY = c_currenty
        Printer.Print userid
        
        Printer.CurrentX = 10
        Printer.CurrentY = c_currenty
        Printer.Print usercode
        
        Printer.CurrentX = 16
        Printer.CurrentY = c_currenty
        Printer.Print username
        
        Printer.CurrentX = 31
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(8) & curmon, 8)
        
        Printer.CurrentX = 42
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(8) & lastmon, 8)
        
        Printer.CurrentX = 50
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(5) & lost, 4)
        
        Printer.CurrentX = 57
        Printer.CurrentY = c_currenty
        Printer.Print makeup
        
        Printer.CurrentX = 61
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(4) & times, 3)
        
        Printer.CurrentX = 73
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(8) & quantity, 8)
        
        Printer.CurrentX = 82
        Printer.CurrentY = c_currenty
        Printer.Print Format(price, "0.0000")
        
        Printer.CurrentX = 90
        Printer.CurrentY = c_currenty
        Printer.Print Right(Space(10) & Format(fee, "0.00"), 10)
        
        Printer.CurrentX = 101
        Printer.CurrentY = c_currenty
        Printer.Print zone
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -