用vfp @ say 语句写的超市、服装店小票机打印(不需用报表打印,速度最快)

qq_26224105 2018-07-21 10:16:07
这里只写了打印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
...全文
925 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cn960 2018-08-27
  • 打赏
  • 举报
回复
foxpro对foxbase下的命令几乎都兼容的,用纯代码方式是要快些。
zhaihs 2018-08-06
  • 打赏
  • 举报
回复
猫不看黑白 语法不看年代 好用就行 补充一下这个古老的命令,有时也会用到: @ <行,列> [SAY <表达式>] [PICTURE <格式符>] [COLOR <颜色对>] 功能:在屏幕指定坐标位置上输出显示结果。 PICTURE描述码和意义 A:只允许字母 L:只允许逻辑数据 N:只允许字母和数字 X:允许任意字符 Y:只允许Y、N、y、n,而且y,n分别被转化为Y,N 9:对字符数据只允许数字,对数值数据只允许数字和正负号 #:允许数字、空格、正负号 !:转换小写字母转化为大写字符 $:显示货币号 *:显示在数字值的前面 .:指出小数点的位置 ,:放在小数点的左边,用于数字的分隔 @<行,列> SAY <位图文件名> BITMAP <通用型字段名> [ISOMETRIC | STRETCH] [ SIZE <数值表达式1>,<数值表 达式2>] [NOWAIT] 功能:将位图文件或通用字段显示在指定行、列的位置 说明:1)[ISOMETRIC]表示缩放图片,使其比例适应指定区域的大小 2)[STRETCH]表示在水平垂直两个方向缩放图片。 3)[SIZE <数值表达式 1>, <数值表达式 2>]用来指定图片的大小, <数值表达式 1>为高度,<数值表达式2>为宽度 4)[NOWAIT]表示在执行时不等待
liups 2018-07-26
  • 打赏
  • 举报
回复
引用 1 楼 yrt888 的回复:
这些语法,好像是FOXBASE+那个年代的!

什么好象,本来就是!
yrt888 2018-07-24
  • 打赏
  • 举报
回复
这些语法,好像是FOXBASE+那个年代的!

2,735

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧