FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Need examples of FW Report Engine with TDolphine -MySQL
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Need examples of FW Report Engine with TDolphine -MySQL
Posted: Sat Apr 20, 2013 04:32 AM

Hi All,

I am using TDolphin in my application and I almost finished data entry screen. Now I have to develop report section.
We have much amount of examples of FW Report with DBF engine. Could you please let me know how I can use FW Report with TDolphin (without exporting to DBF) ?
Thanks in advance..!

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Need examples of FW Report Engine with TDolphine -MySQL
Posted: Sat Apr 20, 2013 04:51 AM

Create the Report as usual.
For column definitions, in the DATA clause use oQry:fieldName instead of <alias>->fieldname.

Before activating report
oReport:bSkip := { || oQry:Skip( 1 ) }

and while activating

oQry:GoTop()
ACTIVATE REPORT oReport <your clauses> WHILE !oQry:Eof()

Regards



G. N. Rao.

Hyderabad, India
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: Need examples of FW Report Engine with TDolphine -MySQL
Posted: Sat Apr 20, 2013 07:16 AM

Dear Rao ,

Thanks a lot for your support. I will implement this.

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Re: Need examples of FW Report Engine with TDolphine -MySQL
Posted: Sat Apr 20, 2013 07:59 AM

1.FUNCTION fr3prn0(cid1,lpreview,obl1)
local cid2,ctable1,ctable2,i
local odbprn1,odbprn2,odb1,odb2
private myvar

if obl1<>nil
if __objhasdata(obl1,"odb1")
odb1:=obl1:odb1
odb2:=obl1:odb2
else
odb1:=obl1
odb2:=obl1
end

end

   do case
   case cid2==&quot;sal02&quot;

        odbprn1:=oserver:Query(odb1:cquery)

        odbprn2:=oserver:Query(odb2:cquery)  
    ...

end case

  if odbprn1&lt;&gt;nil.or.odbprn2&lt;&gt;nil                         
   fr3prn(odbprn1,odbprn2,cid1,lpreview)

   if odbprn1&lt;&gt;nil
      odbprn1:end()
   end

   if odbprn2&lt;&gt;nil
      odbprn2:end()          
   end
  end

return

  1. FUNCTION fr3prn(odbprn1,odbprn2,cid1,lpreview)
    local FrPrn,odbprn0,odbprn13
    local cid2,acompany1:={},n1:=1

FrPrn := frReportManager():new()
FrPrn:LoadLangRes("chinese.xml")
odbprn0:=oserver:query("select rtrim(ccompany) ccompany,rtrim(ecompany) ecompany,rtrim(addra) addra,rtrim(addrb) addrb,addrc,tel,fax,zip,email from company ")

    odbprn0:SKIP()
   if lpreview&lt;&gt;nil.and.(LEFT(cid1,3)==&quot;sal&quot;.or.left(cid1,5)==&quot;sub08&quot;.or.left(cid1,5)==&quot;sub09&quot; )
     if odbprn0:LASTREC()&gt;2
         while !odbprn0:EOF()
              AADD(acompany1,ALLTRIM(odbprn0:ccompany))
              odbprn0:SKIP()
         end     
         n1:= alert(&quot;请选择&quot;,acompany1,&quot;选择打印公司抬头&quot;)
         if n1==0; n1:=1; end
         odbprn0:gotop()
         odbprn0:SKIP(n1)
         acompany1:=nil
      end  
   end      
   FrPrn:SetUserDataSet(&quot;our&quot;,mysqlfields(odbprn0),;
         {|| odbprn0:GoTop()} ,;
         {|| odbprn0:SKIP(1)},;
         {|| odbprn0:SKIP(-1) },;
         {|| odbprn0:EOF() },;                 
         {|aField|odbprn0:FIELDGET(afield)})

   if odbprn1&lt;&gt;nil      
   FrPrn:SetUserDataSet(&quot;title&quot;,mysqlfields(odbprn1),;
         {|| odbprn1:GoTop()} ,;
         {|| odbprn1:SKIP(1)},;
         {|| odbprn1:SKIP(-1) },;
         {|| odbprn1:EOF() },;                 
         {|aField|odbprn1:FIELDGET(afield)})
   end
   if odbprn2&lt;&gt;nil      
   FrPrn:SetUserDataSet(&quot;masterdata&quot;,mysqlfields(odbprn2),;
         {|| odbprn2:GoTop()} ,;
         {|| odbprn2:SKIP(1)},;
         {|| odbprn2:SKIP(-1) },;
         {|| odbprn2:EOF() },;                
          {|aField|odbprn2:FIELDGET(afield)})    
   end

   odbprn13:=oserver:query(&quot;select cvalue from fr3 where id='&quot;+cid1+&quot;'&quot;)
   for i:=1 TO LEN(cid1)
       if SUBSTR(cid1,i,1)&gt;=&quot;0&quot;.and.substr(cid1,i,1)&lt;=&quot;9&quot;
          exit
       end
   next

   if odbprn13:EOF()         
         odbprn13:cquery:=&quot;select cvalue from fr3 where id like '&quot;+SUBSTR(cid1,1,i-1+2)+if(RIGHT(cid1,3)==&quot;amt&quot;,&quot;amt&quot;,&quot;&quot;)+&quot;%' limit 1&quot;

         odbprn13:refresh()
         if odbprn13:EOF().and.lpreview==nil.and.RIGHT(cid1,3)==&quot;amt&quot;
            odbprn13:cquery:=&quot;select cvalue from fr3 where id='&quot;+SUBSTR(cid1,1,i-1+2)+&quot;'&quot;
            odbprn13:refresh()
         end
   end

   FrPrn:LoadFromString(odbprn13:cvalue)
   odbprn13:end()

   do case
          case  lpreview==nil
                 FrPrn:designReport()
                 if msgyesno(&quot;保存打印设置修改到ERP系统&quot;,&quot;save!&quot;)
                    if LEN(ALLTRIM(oserver:querydata(&quot;select id from fr3 where id='&quot;+cid1+&quot;'&quot;)))==0
                       oserver:query(&quot;insert into fr3 (id,cvalue) values ('&quot;+cid1+&quot;',' ')&quot;)
                    end
                     oserver:query(&quot;update fr3 set cvalue='&quot;+MYSQL_ESCAPE_STRING(frprn:SaveToString())+&quot;' where id='&quot;+cid1+&quot;'&quot;)
                 end      
          case  lpreview==.t.                     
                 FrPrn:showReport()           
          case lpreview==.f.
              // FrPrn:showReport()

               FrPrn:SetProperty(&quot;Report&quot;, &quot;ShowProgress&quot;, .f.)
               FrPrn:PrepareReport()                  
               FrPrn:Print(.f.)
               FrPrn:SetProperty(&quot;Report&quot;, &quot;ShowProgress&quot;, .t.)

   end             
   FrPrn:DestroyFR() 
   odbprn0:end()

return

3.app:
DEFINE BUTTON ;
RESOURCE "printer" ;
top ;
PROMPT "打印" ;
TOOLTIP "F6打印";
of ::obar ;
NOBORDER ;
MENU ::omenu11;
ACTION fr3prn0("sto01",.f.,self)

DEFINE BUTTON ;
    RESOURCE &quot;preview&quot; ;
    top  ;
    PROMPT &quot;预览&quot; ;
    TOOLTIP &quot;打印预览&quot;;
    of ::obar ;
    MENU ::omenu12;
    NOBORDER ;
    ACTION fr3prn0(&quot;sto01&quot;,.t.,self)

  DEFINE BUTTON ;
    RESOURCE &quot;preview&quot; ;
    top  ;
    PROMPT &quot;set&quot; ;
    TOOLTIP &quot;set report form&quot;;
    of ::obar ;
    NOBORDER ;
    ACTION fr3prn0(&quot;sto01&quot;,,self)
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651

Continue the discussion