FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posted: Tue Oct 21, 2008 06:32 AM
The following is the code posted by Mr.Nageshwara Rao, regarding the customised printing of the xBrowse Report method.

I would like to know :-

1) Whether Column totals can be implemented and how?. As per the following example code, Column total of Salary

2)Can column total be implemented for Salary as Page total on every page's bottom line and also at the end of the report.

3) Is it possible to have an additional column "Sr.No" (which is not from the DBF ) ie at each line first column contains count of report line as 1, 2, 3 etc

For Example:
-----------------------------------
Sr.No  Name               Salary
-----------------------------------
    1   Mr.xxxxx          10,000
    2   Mr.yyyyy            8,000
    3   Mr.zzzzzz          10,000
    4   Mr.aaaaa            5,000
----------------------------------
                     Total     33,000



#include 'fivewin.ch'
#include 'xbrowse.ch'
#include 'report.ch'

REQUEST DBFCDX

function Main()

   local oWnd, oBrw, oBar, oPrnFont

   USE CUSTOMER NEW ALIAS CUST SHARED VIA 'DBFCDX'

   DEFINE WINDOW oWnd

   @ 0,0 XBROWSE oBrw OF oWnd

   oBrw:CreateFromCode()
   oWnd:oClient   := oBrw

   DEFINE BUTTONBAR oBar OF oWnd SIZE 80,32 2007
   DEFINE BUTTON OF oBar PROMPT 'Print' ;
      ACTION oBrw:Report( 'TestReport', , , ;
      { |oRep, oBrw, oFont| MySetUp( oRep, oBrw, @oPrnFont ) } )

   ACTIVATE WINDOW oWnd
   RELEASE FONT oPrnFont

return nil

static function MySetUp( oRep, oBrw, oFont )

   DEFINE FONT oFont NAME 'ARIAL NARROW' SIZE 0,-9 OF oRep:oDevice

   oRep:aFont[ 1 ]   := oFont

   COLUMN DATA CUST->First,CUST->Last,'' ;
         TITLE 'Name','','' SIZE 20

   COLUMN DATA CUST->STREET,CUST->ZIP ;
         TITLE 'Address','' SIZE 30

   COLUMN DATA CUST->City,CUST->State,'' ;
         TITLE 'City','State','' SIZE 20

   COLUMN DATA CUST->HIREDATE, ;
               If( CUST->Married, 'Married','Single' ) ;
          TITLE 'HireDate','Status' ;
          SIZE 10

   COLUMN DATA CUST->Salary, CUST->Age ;
         PICTURE '999,999,999' ;
         TOTAL ;
         TITLE 'Salary','Age'

return .t.


Thanks & Regards

Anser
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posted: Tue Oct 21, 2008 06:47 AM

Why don't you just use the TReport class. There are lots of samples in FW\samples\report.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posted: Tue Oct 21, 2008 06:47 AM

I got the solution to my problem no.3 in my above post, it was too simple

Local n:=0
COLUMN DATA { || n++ } ;
TITLE 'Sr#' SIZE 20

Hunting to solve problems 1 and 2

Regards

Anser

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posted: Tue Oct 21, 2008 06:49 AM
Dear Mr.James,

I am just exploring whether the above said requirements can be accomplished using xBrowse.

There are lots of samples in FW\samples\report.


I found very little samples regarding Print which throws some light into some advanced tips & tricks of the TPrinter Class

Regards

Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : xBrowse oBrw:Report() column total, PageTot,GrandTot
Posted: Tue Oct 21, 2008 08:20 AM
I got the solutions to my problem no.1 and 2 also


  Select AcMaster_ACM
   nRecNo:=RecNo()
   bTest1:=dbEval( { || nTmpTotal += AcMaster_ACM->OPENINGBAL } )
   bTest2:={ || bTest1}
   Select AcMaster_ACM
   Goto nRecNo

   COLUMN DATA { || i++ } ;
   		 TITLE 'Sr#' SIZE 8

   COLUMN DATA AcMaster_ACM->OPENINGBAL,'','' ;
         TITLE 'Opening','Balalnce','' SIZE 20 ;
         TOTAL bTest2


I don't know whether the way I have implemented the code block for total is the perfect one or not. Anyway able to meet the requirement.

Regards

Anser

Continue the discussion