| 发表于:2007-08-01 20:27:536楼 得分:0 |
以下是全部语句: private sub printgrid() on error goto err_init dim ssql as string isprinting = true '按每餐桌打印,先点先打 ssql = "select * from ptcust order by site,dtype,id " dim db as connection, ef as recordset dim tmpef as recordset set db = createobject( "adodb.connection ") set ef = createobject( "adodb.recordset ") set tmpef = createobject( "adodb.recordset ") db.open constr if ef.state <> adstateclosed then ef.close ef.open ssql, db, 3, 1, adcmdtext dim sdupsite as string dim xtmptop as long '重复高度 sdupsite = " " set tmpef = ef.clone '克隆一个相同的记录集 if not (tmpef.eof and tmpef.bof) then do while not tmpef.eof() '打印当前的列表 'if printsheet(tmpef( "id ")) = false then '打印不正常时退出。 ' exit do 'end if '相同座位时不重复打印 if sdupsite <> tmpef( "site ") then if sdupsite <> " " then printer.line (xsmallleft, xsmalltop + 18 + xtmptop)-(xsmallleft + 70, xsmalltop + 18 + xtmptop), 2, bf printer.currentx = xsmallleft + 40 printer.currenty = xsmalltop + 20 + xtmptop printer.print "时间: " & time printer.enddoc end if xtmptop = 0 sdupsite = tmpef( "site ") printer.scalemode = 6 '厘米 printer.font = "黑体 " printer.fontbold = true printer.fontsize = "10 " printer.currentx = xsmallleft printer.currenty = xsmalltop printer.print "座位: " & tmpef( "site ") printer.currentx = xsmallleft + 40 printer.currenty = xsmalltop printer.print "操作员: " & tmpef( "doper ") printer.font = "宋体 " printer.fontsize = "9 " printer.currentx = xsmallleft printer.currenty = xsmalltop + 6 printer.print "菜名 " printer.currentx = xsmallleft + 15 printer.currenty = xsmalltop + 6 printer.print "单位 " printer.currentx = xsmallleft + 23 printer.currenty = xsmalltop + 6 printer.print "单价 " printer.currentx = xsmallleft + 32 printer.currenty = xsmalltop + 6 printer.print "数量 " printer.currentx = xsmallleft + 39 printer.currenty = xsmalltop + 6 printer.print "加工 " printer.currentx = xsmallleft + 46 printer.currenty = xsmalltop + 6 printer.print "金额 " printer.currentx = xsmallleft + 55 printer.currenty = xsmalltop + 6 printer.print "菜分类 " end if printer.currentx = xsmallleft printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "name ") printer.currentx = xsmallleft + 18 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "unit ") printer.currentx = xsmallleft + 22 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "price ") printer.currentx = xsmallleft + 32 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "quanty ") printer.currentx = xsmallleft + 40 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "jgf ") printer.currentx = xsmallleft + 44 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "amos ") printer.currentx = xsmallleft + 55 printer.currenty = xsmalltop + 12 + xtmptop printer.print tmpef( "dtype ") '删除当前记录 ' returnrec.cursorlocation = aduseclient tmpef.delete adaffectcurrent tmpef.movenext xtmptop = xtmptop + 6 loop end if if sdupsite <> " " then printer.line (xsmallleft, xsmalltop + 18 + xtmptop)-(xsmallleft + 70, xsmalltop + 18 + xtmptop), 2, bf printer.currentx = xsmallleft + 40 printer.currenty = xsmalltop + 20 + xtmptop printer.print "时间: " & time printer.enddoc end if ef.close tmpef.close set ef = nothing set tmpef = nothing db.close set db = nothing isprinting = false exit sub | | |
|