用vfp @ say 语句写的超市、服装店小票机打印(不需用报表打印,速度最快)
这里只写了打印8样物品的例子,如果更多可增加:
*打印出小票
SET DEVICE TO print &&设定从打印机输出
*小票格式
@1,1 say "谢谢光临!" font '微软雅黑',9 color RGB(0,0,0)
@3,3 say "浪漫一身服装店" font '微软雅黑',15 color RGB(0,0,0)
@7,1 say "日期:"font '微软雅黑',9 color RGB(0,0,0)
@7,7 say DATETIME() font '微软雅黑',9 color RGB(0,0,0)
@8,1 say "- - - - - - - - - - - - - - - - "
@9,1 say "序号 货 号 数量 单价" font '微软雅黑',9 color RGB(0,0,0)
xdy=12
xhj=1
*打印第一件
@10,1 say "1 " font '微软雅黑',9 color RGB(0,0,0)
@10,5 say thisform.text10.Value font '微软雅黑',9 color RGB(0,0,0)
@10,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@10,20 say thisform.text18.Value font "微软雅黑",9 color RGB(0,0,0)
*打印第二件
IF NOT EMPTY(thisform.text11.Value ) then
@11,1 say "2 " font '微软雅黑',9 color RGB(0,0,0)
@11,5 say thisform.text11.Value font '微软雅黑',9 color RGB(0,0,0)
@11,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@11,20 say thisform.text19.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第三件
IF NOT EMPTY(thisform.text12.Value ) then
@12,1 say "3 " font '微软雅黑',9 color RGB(0,0,0)
@12,5 say thisform.text12.Value font '微软雅黑',9 color RGB(0,0,0)
@12,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@12,20 say thisform.text20.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第四件
IF NOT EMPTY(thisform.text13.Value ) then
@13,1 say "4 " font '微软雅黑',9 color RGB(0,0,0)
@13,5 say thisform.text13.Value font '微软雅黑',9 color RGB(0,0,0)
@13,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@13,20 say thisform.text21.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第五件
IF NOT EMPTY(thisform.text14.Value ) then
@14,1 say "5 " font '微软雅黑',9 color RGB(0,0,0)
@14,5 say thisform.text14.Value font '微软雅黑',9 color RGB(0,0,0)
@14,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@14,20 say thisform.text22.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第六件
IF NOT EMPTY(thisform.text15.Value ) then
@15,1 say "6 " font '微软雅黑',9 color RGB(0,0,0)
@15,5 say thisform.text15.Value font '微软雅黑',9 color RGB(0,0,0)
@15,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@15,20 say thisform.text23.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第七件
IF NOT EMPTY(thisform.text16.Value ) then
@16,1 say "7 " font '微软雅黑',9 color RGB(0,0,0)
@16,5 say thisform.text16.Value font '微软雅黑',9 color RGB(0,0,0)
@16,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@16,20 say thisform.text24.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
*打印第八件
IF NOT EMPTY(thisform.text17.Value ) then
@17,1 say "8 " font '微软雅黑',9 color RGB(0,0,0)
@17,5 say thisform.text17.Value font '微软雅黑',9 color RGB(0,0,0)
@17,18 say "1" font '微软雅黑',9 color RGB(0,0,0)
@17,20 say thisform.text25.Value font "微软雅黑",9 color RGB(0,0,0)
xdy=xdy+1
xhj=xhj+1
ENDIF
@xdy,1 say "- - - - - - - - - - - - - - - - "
@xdy+1,1 say "合 计:" font "微软雅黑",10 color RGB(0,0,0)
@xdy+1,8 say STR(xhj,1,0) font '微软雅黑',10 color RGB(0,0,0)
@xdy+1,11 say "件" font "微软雅黑",10 color RGB(0,0,0)
@xdy+1,15 say "总额:" font "微软雅黑",10 color RGB(0,0,0)
@xdy+1,21 say thisform.label31.Caption font "微软雅黑",10 color RGB(0,0,0)
@xdy+1,27 say "元" font "微软雅黑",10 color RGB(0,0,0)
@xdy+3,1 say "- - - - - - - - - - - - - - - - "
Set printer to