How do I code this report ?

Post Reply
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

How do I code this report ?

Post by HunterEC »

Guys:

I'm printing a statement of account type report where I need to print at the top of each page the customer's name, address, etc. BEFORE listing the actual transactions. How can I do this ? Thank you.
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: How do I code this report ?

Post by Colin Haig »

Hi

Do a loop and call a header routine in the loop

local nPage := 0,nPrRow := 0

do while whatever
fnHead(@nPage,@nPrRow)
print transaction details
skip()
enddo


function fnHead(nPage,nPrRow)
if nPage == 0 .or. nPrProw > 60
nPage++
Print header details
nPrRow := 28
endif
return(nil)

Colin
User avatar
sambomb
Posts: 385
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil
Contact:

Re: How do I code this report ?

Post by sambomb »

Search FastReport in the forum, It will do the job easily
Email: SamirSSabreu@gmail.com
MSN: SamirAbreu@hotmail.com
Skype: SamirAbreu
xHarbour 1.1.0 + FwXh 8.02
xHarbour 1.2.1 + Fwhh 10.6
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: How do I code this report ?

Post by James Bott »

There is a clause ON STARTPAGE:

ACTIVATE REPORT oRpt ON STARTPAGE bStartpage...

James
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How do I code this report ?

Post by HunterEC »

James, Samir & Colin:

Thank you very much for your help. I think that I posted the question not clear enough. What command(s) do I have to use / are available on all the suggested scenarios, specially the ON START PAGE to accomplish this. @ r,c SAY ...
I know about Fast Report but I'm running against time, so I don't have the time to learn & use it. Any example will be greatly appreciated. Thank you very much guys !!!!
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: How do I code this report ?

Post by FranciscoA »

Please, try to adapt this piece of code.
//ej sobre un formato pre-impreso

Code: Select all

      CabeceraENTR(oPrn,nRowStep,nColStep,nLinNumDoc,nColNumdoc,nLinFecha,nColFecha,nLinProvee,nColProvee,nLinPedido,nColPedido,nLinRemisio, nColRemisio,oFont,oFont2,nPag,dFecha)

      nRow:= nLinItems   //linea donde comienzan los items
      nLineas:=1
     While (cAlias)->(!Eof())
        oPrn:Say( nRow, nCol1, Transform(field->Canti,"@Z 99,999,999.99"), oFont1,,,,PAD_RIGHT )
        oPrn:Say( nRow, nCol2, field->Und, oFont1,,,,PAD_LEFT )
        oPrn:Say( nRow, nCol3, str(Field->codigo)+" "+ALLTRIM(field->DESCRIPCIO), oFont1,,,,PAD_LEFT )
        oPrn:Say( nRow, nCol4, Transform(field->pUnit,"@Z 999,999.9999"), oFont1,,,,PAD_RIGHT )
        oPrn:Say( nRow, nCol5, Transform(field->SubTotal,"@Z 99,999,999.99"), oFont1,,,,PAD_RIGHT )
        (cAlias)->(dbSkip())
        nRow+= nRowStep
        nLineas+=1

        if nLineas > nLineasMax   //lineas maximas a imprimir en cada hoja
           ENDPAGE
              MsgInfo("Introduzca una nueva hoja para continuar, y presione enter")
           PAGE
           nPag+=1
           nRow:= nLinItems  //linea donde comienzan los items
           nLineas:=1
           CabeceraENTR(oPrn,nRowStep,nColStep,nLinNumDoc,nColNumdoc,nLinFecha,nColFecha,nLinProvee,nColProvee,nLinPedido,nColPedido,nLinRemisio, nColRemisio,oFont,oFont2,nPag,dFecha)
        endif
     Enddo
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
HunterEC
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How do I code this report ?

Post by HunterEC »

Francisco:

Muchas gracias !!!!
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: How do I code this report ?

Post by James Bott »

Here is an example from an invoice class. Note that I am just using the HEADER and TITLE clauses with linefeeds (denoted with commas). Also note that the HEADER and FOOTER clauses are really page headers and footers, not report headers and footers (as one might think).

James

Code: Select all

     REPORT oReport;
         HEADER ;
           "Invoice: "+trim(::invno), "Page: "+;
           ltrim(str(oReport:nPage,3)) RIGHT;
         TITLE ::oSysdata:company, ;
           ::oSysdata:address,;
           trim(::oSysdata:city)+", "+trim(::oSysdata:state)+" "+::oSysdata:zip,;
           " "," ",;
           "Ship to:", ; 
           " ",;
           ::oCustomer:Contact,;
           ::oCustomer:company,;
           trim(::oCustomer:address1)+if(!empty(::oCustomer:address2),", "+::oCustomer:address2,""),;
           trim(::oCustomer:city)+", "+trim(::oCustomer:state)+" "+::oCustomer:zip,;
           ::oCustomer:phone," "," ",;
           "PO No: "+::oInvmast:PONum+"  Invoice date: "+dtoc(::oInvmast:invdte)+;
           "  Terms: "+::oInvmast:pterms LEFT;
         FONT oFont;
         TO DEVICE oDevice
 
Post Reply