Help : xBrowse oBrw:Report() column total, PageTot,GrandTot

Help : xBrowse oBrw:Report() column total, PageTot,GrandTot

Postby anserkk » Tue Oct 21, 2008 6: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:
Code: Select all  Expand view
-----------------------------------
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



Code: Select all  Expand view
#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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby James Bott » Tue Oct 21, 2008 6:47 am

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

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby anserkk » Tue Oct 21, 2008 6: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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Tue Oct 21, 2008 6: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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Tue Oct 21, 2008 8:20 am

I got the solutions to my problem no.1 and 2 also


Code: Select all  Expand view
  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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 86 guests