Page 1 of 1

How do I code this report ?

PostPosted: Mon May 25, 2015 6:54 am
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.

Re: How do I code this report ?

PostPosted: Mon May 25, 2015 7:58 am
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

Re: How do I code this report ?

PostPosted: Mon May 25, 2015 6:47 pm
by sambomb
Search FastReport in the forum, It will do the job easily

Re: How do I code this report ?

PostPosted: Wed May 27, 2015 2:38 pm
by James Bott
There is a clause ON STARTPAGE:

ACTIVATE REPORT oRpt ON STARTPAGE bStartpage...

James

Re: How do I code this report ?

PostPosted: Wed May 27, 2015 11:17 pm
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 !!!!

Re: How do I code this report ?

PostPosted: Thu May 28, 2015 12:22 am
by FranciscoA
Please, try to adapt this piece of code.
//ej sobre un formato pre-impreso

Code: Select all  Expand view
     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
 

Re: How do I code this report ?

PostPosted: Thu May 28, 2015 3:00 am
by HunterEC
Francisco:

Muchas gracias !!!!

Re: How do I code this report ?

PostPosted: Thu May 28, 2015 6:23 am
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  Expand view
    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