Calculate total pages

Re: Calculate total pages

Postby nageswaragunupudi » Mon Nov 27, 2023 5:29 pm

Mr. Silvio

Please make only this one change in the report.prg:
In the Method Activate(), locate these lines:
Code: Select all  Expand view
     if !::lHaru .and. Empty( ::oDevice:cFile ) .and. !PrintQueue()
         Eval( ::bPreview, ::oDevice )
      else
         PrintEnd()
      endif


Delete all these lines and substitute only one line:
Code: Select all  Expand view
  PrintEnd()


Then test your code.

I tested with this code and it is working fine:
You may also try this code first as it is and then use it in your programs
Code: Select all  Expand view
function TestReport()

   local oRep, oFont
   local nLine := 0

   USE CUSTOMER NEW SHARED
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-12

   REPORT oRep FONT oFont PREVIEW  ;
      TITLE "CUSTOMER" ;
      FOOTER FWString( "Page" ) + " : " + cValToChar( oRep:oDevice:nPage ) + "/" + ;
      oRep:oDevice:cLastPage ;
      CENTER

   COLUMN TITLE "LINE"   DATA nLine          FONT 1 SIZE 4
   COLUMN TITLE "NAME"   DATA FIELD->FIRST   FONT 1 SIZE 15
   COLUMN TITLE "SURNAME" DATA FIELD->LAST   FONT 1 RIGHT SIZE 15
   COLUMN TITLE "CITY"   DATA FIELD->CITY    FONT 1 CENTER SIZE 15
   COLUMN TITLE "STATE"  DATA FIELD->STATE   FONT 1 CENTER
   COLUMN TITLE "SALARY" DATA FIELD->SALARY  PICTURE "$ 9,999,999.99";
      FONT 1 TOTAL  SIZE 14

   ENDREPORT

   oRep:bInit        := { || nLine := 0 }
   oRep:bStartRecord := { || nLine++ }

   ACTIVATE REPORT oRep

   RELEASE FONT oFont

return nil
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10642
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Calculate total pages

Postby nageswaragunupudi » Mon Nov 27, 2023 5:32 pm

In XBrowse.prg
Please make this change in METHOD Report(...)
Replace these lines
Code: Select all  Expand view
  REPORT oRep TITLE cTitle ;
          FOOTER FWString( "Page" ) + " : " + cValToChar( oRep:nPage ) CENTER ;
          FONT oFont,oBold ;
          TO DEVICE oPrn
 


with

Code: Select all  Expand view
  REPORT oRep TITLE cTitle ;
          FOOTER FWString( "Page" ) + " : " + cValToChar( oPrn:nPage ) ;
               + "/" + oPrn:cLastPage CENTER ;
          FONT oFont,oBold ;
          TO DEVICE oPrn
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10642
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Calculate total pages

Postby Silvio.Falconi » Tue Nov 28, 2023 8:39 am

thanks Rao
Would this also work if I use the browse setup?

example

oBrw:Report( cTitle, , , ;
{ |oRep, oBrw| MySetUp( oRep, oBrw, oDbf,aGroup,nGroup,lEject,aCampi ) } )

static function MySetUp( oRep, oBrw, oDbf,aGroup,nGroup,lEject,afields )
local cFooter := "Progetto Magazzino - "
local cTitle1 := "title row 1"
local cTitle2 := "title row 2"

local nTotalpages:= oRep:oDevice:cLastPage


oRep:oTitle := TrLine():New( {{|| cf(date())+"- Pagina : "+Str(oRep:nPage,3)+"/"+(nTotalpages)} }, oRep, 2 )



I tried and run ok

thanks Rao
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests