Shuming Wang
unread,Jul 13, 2010, 10:56:57 PM7/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to FastReport for [x]Harbour and for Alaska Xbase++
function prnpur01(lpreview)
local odbprn0,odbprn1,odbprn2,odbprn3,FrPrn
if lpreview==nil.or.LEN(ALLTRIM(oserver:querydata("select id from
fr3 where id='pur01'")))>0
odbprn0:=oserver:query("select
ccompany,ecompany,addra,addrb,addrc,tel,fax,zip,email from company
limit 1,1")
// 2nd row
odbprn1:=oserver:query("select invono,date,poin1.vendorid";
+",vendor,addra,addrb,addrc,tel,fax,contact";
+",poin1.currency currency";
+",concat(rtrim(checkout.descrip),checkout.payterm) checkout";
+",dlvdate,poin1.mem mem,poin1.memb
memb,poin1.memc memc";
+" from poin1";
+" left join vendor1 on
vendor1.vendorid=poin1.vendorid";
+" left join checkout on
checkout.checkoutid=poin1.checkoutid";
+" where poin1.invono='"+invono1+"'";
)
odbprn2:=oserver:Query("select poin2.itemid itemid,
ifnull(sort,'') sort ,descrip,unit ,ifnull(sum(poin2.qty),0) qty,
ifnull(poin2.unitpri,0) unitpri,ifnull(sum(poin2.qtyb),0) qtyb,unitb,
ifnull(poin2.unitprib,0) unitprib,poin2.dlvdate dlvdate,poin2.mem mem
";
+" from poin2";
+" left join goods2 on goods2.itemid=poin2.itemid ";
+" left outer join sort on sortid=substring(poin2.itemid,
1,"+cvaltochar(nsortlen)+")" ;
+" left outer join unit on unit.itemid=poin2.itemid and
unit.unitid=poin2.unitid";
+" where invono='"+invono1+"' ";
+" group by itemid,unit,dlvdate")
FrPrn := frReportManager():new()
FrPrn:LoadLangRes("chinese.xml")
FrPrn:SetUserDataSet("ourcompany",mysqlfields(odbprn0),;
{|| odbprn0:GoTop()} ,;
{|| odbprn0:SKIP(1)},;
{|| odbprn0:SKIP(-1) },;
{|| odbprn0:EOF() },;
{|aField|odbprn0:FIELDGET(afield)})
FrPrn:SetUserDataSet("title",mysqlfields(odbprn1),;
{|| odbprn1:GoTop()} ,;
{|| odbprn1:SKIP(1)},;
{|| odbprn1:SKIP(-1) },;
{|| odbprn1:EOF() },;
{|aField|odbprn1:FIELDGET(afield)})
FrPrn:SetUserDataSet("masterdata",mysqlfields(odbprn2),;
{|| odbprn2:GoTop()} ,;
{|| odbprn2:SKIP(1)},;
{|| odbprn2:SKIP(-1) },;
{|| odbprn2:EOF() },;
{|aField|odbprn2:FIELDGET(afield)})
odbprn3:=oserver:query("select cvalue from fr3 where
id='pur01'")
FrPrn:LoadFromString(odbprn3:cvalue)
odbprn3:end()
do case
case lpreview==nil
FrPrn:designReport()
if msgyesno("Save forum changes")
if LEN(ALLTRIM(oserver:querydata("select id
from fr3 where id='pur01'")))==0
oserver:query("insert into fr3 (id,cvalue)
values ('pur01',' ')")
end
oserver:query("update fr3 set
cvalue='"+mysqleascape(frprn:SaveToString())+"' where id='pur01'")
end
case lpreview==.t.
FrPrn:showReport()
case lpreview==.f.
FrPrn:print(.t.)
end
FrPrn:DestroyFR()
return
end
return
FUNCTION mysqleascape(cstr1)
cstr1:=STRTRAN(cstr1,"\\","\\\\")
cstr1:=STRTRAN(cstr1,"\0","\\0")
cstr1:=STRTRAN(cstr1,"\n","\\n")
cstr1:=STRTRAN(cstr1,"\r","\\r")
cstr1:=STRTRAN(cstr1,"\x1a","\Z")
cstr1:=STRTRAN(cstr1,"'","\'")
cstr1:=STRTRAN(cstr1,'"','\"')
return cstr1
FUNCTION mysqlfields(odb1)
local cstr1:=odb1:FIELDNAME(1)
for i:=2 TO odb1:FCOUNT()
cstr1+=";"+odb1:FIELDNAME(i)
next
return cstr1