vb.net winform pos机并口打印机打印以及开钱箱。。。。
代码
'打印功能
public sub MyPrint()
Dim objfs, objprinter
objfs = CreateObject("Scripting.FileSystemObject")
objprinter = objfs.CreateTextFile("LPT1:", True)
objprinter.Writeline(" 俺家大饭店 " + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("编号 名称 单价 数量" + Chr(10))
objprinter.Writeline(" " + Chr(10))
For i = 0 To dt.Rows.Count - 1
objprinter.Writeline(" " & i + 1 & " " & dt.Rows(i).Item(1) & " " & dt.Rows(i).Item(2) & " " & dt.Rows(i).Item(3) & " " + Chr(10))
Next
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("共计:" & frmHmain.Tolmoney & "元|付款:" & txtFK.Text & "元|找零:" & lblzl.Text & " 元" + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("打印日期: " + Date.Now + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("欢迎您再次光临,谢谢。请慢走!" + Chr(10))
objprinter.Writeline(Chr(10))
objprinter.Writeline(Chr(10))
objprinter.Writeline(Chr(10))
objprinter.close()
objprinter = Nothing
objfs = Nothing
End sub
Public Shared Sub OpenBox() '打开钱箱
Dim objfs, objprinter
objfs = CreateObject("Scripting.FileSystemObject")
objprinter = objfs.CreateTextFile("LPT1:", True)
objprinter.Writeline((Chr(27)).ToString() + "p" + (Chr(0)).ToString() + ((Chr(60))).ToString() + ((Chr(255))).ToString())
objprinter.close()
objprinter = Nothing
objfs = Nothing
End Sub
public sub MyPrint()
Dim objfs, objprinter
objfs = CreateObject("Scripting.FileSystemObject")
objprinter = objfs.CreateTextFile("LPT1:", True)
objprinter.Writeline(" 俺家大饭店 " + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("编号 名称 单价 数量" + Chr(10))
objprinter.Writeline(" " + Chr(10))
For i = 0 To dt.Rows.Count - 1
objprinter.Writeline(" " & i + 1 & " " & dt.Rows(i).Item(1) & " " & dt.Rows(i).Item(2) & " " & dt.Rows(i).Item(3) & " " + Chr(10))
Next
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("共计:" & frmHmain.Tolmoney & "元|付款:" & txtFK.Text & "元|找零:" & lblzl.Text & " 元" + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("打印日期: " + Date.Now + Chr(10))
objprinter.Writeline("--------------------------------" + Chr(10))
objprinter.Writeline("欢迎您再次光临,谢谢。请慢走!" + Chr(10))
objprinter.Writeline(Chr(10))
objprinter.Writeline(Chr(10))
objprinter.Writeline(Chr(10))
objprinter.close()
objprinter = Nothing
objfs = Nothing
End sub
Public Shared Sub OpenBox() '打开钱箱
Dim objfs, objprinter
objfs = CreateObject("Scripting.FileSystemObject")
objprinter = objfs.CreateTextFile("LPT1:", True)
objprinter.Writeline((Chr(27)).ToString() + "p" + (Chr(0)).ToString() + ((Chr(60))).ToString() + ((Chr(255))).ToString())
objprinter.close()
objprinter = Nothing
objfs = Nothing
End Sub