票据打印问题(30分)

  • 主题发起人 主题发起人 onlyonekgx
  • 开始时间 开始时间
O

onlyonekgx

Unregistered / Unconfirmed
GUEST, unregistred user!
不知有哪位高手能够告诉本人关于票据的套打的实现
 
是不是分太少
 
真的就那么难吗
 
查一下前人留下的贴子。有很多解决方法
就我认为,还是直接用printer.canvas.textout(x,y,dbedit1.text)比较好,
QRP相当不好用。
 
我刚做好一个票据套打,不过我用了cell控件
给你代码参考一下
var
apppath:string;
sql_str:string;
qry:Tquery;
i,j,m:integer;
sfbz:string;
sfje:real;
sfje_str:string;
jiao,fen,tmp:string;
begin

bt_commit.Click;

application.CreateForm(tfrm_qrpzh, frm_qrpzh);
if frm_qrpzh.ShowModal = mrok then

begin

qry:=createqry('db');
qry.Close;
qry.SQL.Clear;
sql_str:='select sftjsk.jksbh,sftjsk.tzrq,sftjsk.jfr_dw,sftjsk.jfr_mc,sftjsk.jkpzhm,sftjsk.sfje as hj,'+
' sftjsmxk.sfje,sftjsmxk.sfxmbh,sftjsmxk.jfsl,'+
' sfxmk.sfxmmc,sfxmk.sfjldw,sfxmk.sfsx,sfxmk.sfxx,'+
' jkfsk.jkfs_name'+
' from sftjsk,sftjsmxk,jkfsk,sfxmk'+
' where sftjsk.zd=sftjsmxk.zd'+
' and sftjsk.id=sftjsmxk.id'+
' and sftjsk.jksbh='''+jksbh.Text+''''+
' and sftjsk.jkfs=jkfsk.jkfs_id'+
' and sfxmk.sfxmbh=sftjsmxk.sfxmbh';





qry.SQL.Add(sql_str);
qry.Open;
apppath:=ExtractFilePath(application.ExeName) + 'pj/';
cel_print.DoLogin('²ÆÕþ²¿¼ÆËãÖÐÐÄ',157,'0cfd6cffc001920498fe6100f309');
cel_print.DoOpenFile(apppath+'lnpy.cll');
// ¶Ôcellµ¥Ôª¸ñ¸³Öµ
with cel_printdo

begin

do
setcelldata(1,2,' '+formatdatetime('yyyy',dtp.date)+' '+formatdatetime('mm',dtp.date)+' '+formatdatetime('dd',dtp.date));
do
SetCellData(5,2,dm_pas.DM.sfdwxxk.FieldByName('sfdwdm').asstring);
do
SetCellData(5,3,dm_pas.DM.sfdwxxk.FieldByName('sfdwmc').asstring);
do
SetCellData(1,4,qry.FieldByName('jfr_dw').asstring);
do
SetCellData(1,5,qry.FieldByName('jfr_mc').asstring);
do
SetCellData(5,4,qry.FieldByName('jkfs_name').asstring);
do
SetCellData(5,5,qry.FieldByName('jkpzhm').asstring);
do
SetCellData(1,14,dx.Caption);
sfje:=qry.fieldbyname('hj').asfloat;
sfje_str:=formatfloat('0.00',sfje);
fen:=RightN(sfje_str,1);
jiao:=copy(RightN(sfje_str,2),1,1);
do
setcelldata(15,14,fen);
do
setcelldata(14,14,jiao);
m:=0;
for j:=length(sfje_str)-3do
wnto 1do

begin

tmp:=copy(sfje_str,1,j);
do
setcelldata(13-m,14,RightN(tmp,1));
m:=m+1;

end;

do
setcelldata(13-m,14,'£¤');
m:=0;
for i:=0 to qry.RecordCount-1do

begin

do
setcelldata(0,8+i,qry.fieldbyname('sfxmbh').asstring);
do
setcelldata(1,8+i,qry.fieldbyname('sfxmmc').asstring);
do
setcelldata(2,8+i,qry.fieldbyname('sfjldw').asstring);
if (qry.fieldbyname('sfxx').asstring <> '') and (qry.fieldbyname('sfsx').asstring <> '') then

sfbz:= qry.fieldbyname('sfxx').asstring + '-' + qry.fieldbyname('sfsx').asstring;

if (qry.fieldbyname('sfxx').asstring <> '') and (qry.fieldbyname('sfsx').asstring = '') then

sfbz := qry.fieldbyname('sfxx').asstring;

if (qry.fieldbyname('sfxx').asstring = '') and (qry.fieldbyname('sfsx').asstring <> '') then

sfbz := qry.fieldbyname('sfsx').asstring;
do
setcelldata(3,8+i,qry.fieldbyname('jfsl').asstring);
sfje:=qry.fieldbyname('sfje').asfloat;
sfje_str:=formatfloat('0.00',sfje);
fen:=RightN(sfje_str,1);
jiao:=copy(RightN(sfje_str,2),1,1);
do
setcelldata(15,8+i,fen);
do
setcelldata(14,8+i,jiao);
for j:=length(sfje_str)-3do
wnto 1do

begin

tmp:=copy(sfje_str,1,j);
do
setcelldata(13-m,8+i,RightN(tmp,1));
m:=m+1;

end;

do
setcelldata(13-m,8+i,'&amp;pound;¤');
do
setcelldata(4,8+i,sfbz);
end;



do
SetCellData(2,3,qry.fields[0].asstring);
do
SetCellData(7,1,jksbh.text);
do
setcelldata(12,16,czy_xm);
// &amp;para;&amp;Ocirc;cell&amp;micro;&amp;yen;&amp;Ocirc;&amp;ordf;&amp;cedil;&amp;ntilde;&amp;cedil;&amp;sup3;&amp;Ouml;&amp;micro;
//begin
print
do
Print (false);
//end print
end;
 
接受答案了.
 
后退
顶部