How do I code this report ?

How do I code this report ?

Postby HunterEC » Mon May 25, 2015 6:54 am

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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How do I code this report ?

Postby Colin Haig » Mon May 25, 2015 7:58 am

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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: How do I code this report ?

Postby sambomb » Mon May 25, 2015 6:47 pm

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
sambomb
 
Posts: 385
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Re: How do I code this report ?

Postby James Bott » Wed May 27, 2015 2:38 pm

There is a clause ON STARTPAGE:

ACTIVATE REPORT oRpt ON STARTPAGE bStartpage...

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

Re: How do I code this report ?

Postby HunterEC » Wed May 27, 2015 11:17 pm

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 !!!!
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How do I code this report ?

Postby FranciscoA » Thu May 28, 2015 12:22 am

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
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2134
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: How do I code this report ?

Postby HunterEC » Thu May 28, 2015 3:00 am

Francisco:

Muchas gracias !!!!
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How do I code this report ?

Postby James Bott » Thu May 28, 2015 6:23 am

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
 
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

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

cron