CSDN里的各位前辈:
我是刚接触VB不久的CSDN晚辈,最近加班加点东拼西凑好不容易做了一个内衣店的POS收银管理系统,前台收银界面是先让顾客购买的商品显示到ListView控件中,单击“结算”按钮进行结算入库,在结算的同时打印如下格式的小票应该如何来写代码:
--- 梦回唐朝特色内衣店 ---收银员:杨玉环
小票号:070814-0001
商品名 单价 数量 金额
----------------------------
黛莉安 28 2 56
娜妮兰 19 1 19
...
...
...----------------------------
合计数量:***件
合计金额:***元
2007年8月14日 16:32
多谢惠顾!诚候再次光临!! 打印机是常见的POS58热敏打印机,小票纸是卷式连续的宽度为58mm的热敏纸,如何用VB中的Print方法来实现打印,每个顾客购买的商品数量不一样,每张小票的长度也不一样,希望能给出一个完整点的例子或代码,谢谢!!!!!! 开机在线等两天!!
我是刚接触VB不久的CSDN晚辈,最近加班加点东拼西凑好不容易做了一个内衣店的POS收银管理系统,前台收银界面是先让顾客购买的商品显示到ListView控件中,单击“结算”按钮进行结算入库,在结算的同时打印如下格式的小票应该如何来写代码:
--- 梦回唐朝特色内衣店 ---收银员:杨玉环
小票号:070814-0001
商品名 单价 数量 金额
----------------------------
黛莉安 28 2 56
娜妮兰 19 1 19
...
...
...----------------------------
合计数量:***件
合计金额:***元
2007年8月14日 16:32
多谢惠顾!诚候再次光临!! 打印机是常见的POS58热敏打印机,小票纸是卷式连续的宽度为58mm的热敏纸,如何用VB中的Print方法来实现打印,每个顾客购买的商品数量不一样,每张小票的长度也不一样,希望能给出一个完整点的例子或代码,谢谢!!!!!! 开机在线等两天!!
解决方案 »
- vb如何操作注册表?
- VB中关于msgbox的问题
- richtextbox的内容水平居中对齐问题,100分相送!
- Excel里怎样读.txt文件?
- 请问一个函数调用问题,急!!!!!!!!
- 怎样让文本框中只能输入数值?
- 不知错误
- MSFlexGrid显示数据,我希望当双击某一行时,能够捕捉是那一行,然后调用另外一个窗体显示出来.因为是我新人,所以凡是回答问题的大哥,我都给分.
- 求教:怎么能读写TXT文件的指定行?(帮个忙,分不多,但肯定给)
- vb如何對sql server里的job等編程,如;設置job的時間,內容等,急急急....
- 急,关于RecordSet的update问题
- VB与数据库连接出错
biaoti = " 港都浴城结帐单"
biaoti2 = " GANGDU BUSINESS GUILD CO.,LTD"
kongling2 = " "
'' pristr (biaoti)
Printer.FontSize = 14
Printer.Print kongling2
Printer.Print biaoti
Printer.FontSize = 5
Printer.Print kongling2
Printer.FontSize = 7
Printer.Print biaoti2
Printer.PaintPicture Picture1.Picture, 100, 300
Printer.FontSize = 9
Printer.Print kongling2
zdh = Trim(Me.Text3.Text)
strlsd2 = "select szsj,kdsj from tbllsd where lsh='" & zdh & "'"
rs.Open strlsd2, conn, adOpenStatic, adLockOptimistic
kdsj2 = " 开单时间:" & rs.Fields("szsj") & " " & rs.Fields("kdsj")
Set rs = Nothing
Printer.Print kdsj2
rq = Format(Date, "yyyy-mm-dd") & " " & Time
rq_lsh = " 出单时间:" & rq
'' pristr (rq_lsh)
Printer.Print rq_lsh
spxl = Mid(Me.List1.List(List1.ListIndex), 10)
sp_oper = " 手牌号:" & spxl
lensp = Len(sp_oper)
Select Case lensp
Case 10 To 28
sp_oper = sp_oper
Case 29 To 60
sp_oper = Mid(sp_oper, 1, 28) & vbCrLf & " " & Mid(sp_oper, 29)
Case 61 To 92
sp_oper = Mid(sp_oper, 1, 28) & vbCrLf & " " & Mid(sp_oper, 29, 32) & vbCrLf & " " & Mid(sp_oper, 61)
Case 93 To 124
sp_oper = Mid(sp_oper, 1, 28) & vbCrLf & " " & Mid(sp_oper, 29, 32) & vbCrLf & " " & Mid(sp_oper, 61, 32) & vbCrLf & " " & Mid(sp_oper, 93)
End Select
'' pristr (sp_oper)
Printer.Print sp_oper
xf_sf = " 应收:" & xfje & "元 实收:" & sfje & "元"
'' pristr (xf_sf)
Printer.Print xf_sf
oper2 = " 操作:" & Sys_Oper
Printer.Print oper2
kongline = " "
Printer.Print kongline
qindan = " 消费清单:" & lsh
'' pristr (qindan)
Printer.Print qindan
Line2 = " -------------------------------"
Printer.Print Line2
lanmu = " 手牌 项目 数量 小计"
'' pristr (lanmu)
Printer.Print lanmu
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
aaaa1 = Adodc1.Recordset.Fields("手牌号")
bbbb1 = Adodc1.Recordset.Fields("消费项目")
cccc1 = Adodc1.Recordset.Fields("数量")
dddd1 = Adodc1.Recordset.Fields("消费金额")
l1 = LenB(bbbb1)
l2 = Len(cccc1)
l3 = Len(dddd1)
xfxl = " " & aaaa1 & " " & bbbb1 & Space(12 - l1) & Space(4 - l2) & cccc1 & Space(8 - l3) & dddd1
'xfxl = aaaa1 & " " & bbbb1 & " " & cccc1 & " " & dddd1
'jezj = jezj + Adodc1.Recordset.Fields("消费金额")
'' pristr (xfxl)
Printer.Print xfxl
Adodc1.Recordset.MoveNext
Wend
zjstr = Space(18) & " 共计" & Space(6 - Len(xfje)) & xfje
Printer.Print kongling2
Printer.Print zjstr
ziyang1 = GetSetting(Appname:="sngl", Section:="USER", Key:="ziyang1")
ziyang2 = GetSetting(Appname:="sngl", Section:="USER", Key:="ziyang2")
ziyang3 = GetSetting(Appname:="sngl", Section:="USER", Key:="ziyang3")
ziyang4 = GetSetting(Appname:="sngl", Section:="USER", Key:="ziyang4")
Printer.Print kongling2
Printer.Print ziyang1
Printer.Print ziyang3
Printer.Print ziyang4 Printer.NewPage
Printer.EndDoc
print2 = print2 + 1
If print2 = 2 Then
GoTo exitprint
End If
If MsgBox("打印第二份吗", 36, "提示") <> 6 Then
GoTo exitprint
Else
GoTo print1
End If
请参考上述网址的讨论.
按照自己的要求写入Txt文件,然后调用Shell"type filename.txt>lpt"应该就好了
顺便你还可以用Rtextbox做个打印预览之类的功能