Hi All!
Is it possible to report from more than one database, like each invoice or order with its line items ? All the samples given are for just one.
select invoice
REPORT oRepo TITLE ....
COLUMN TITLE "INVOICE Nº" DATA invoice->invoicenbr
COLUMN TITLE "PRODUCT NAME" DATA YourFunction( order->codproduct)
FUNCTION YourFunction( codproduct )
products->( ordsetfocus( "the right index"), dbseek( codproduct) )
return products->name
products->( ordsetfocus( "the right index") )
invoice->( dbSetRelation("products", { || invoice->codproduct} ))
select invoice
REPORT oRepo TITLE ....
COLUMN TITLE "INVOICE Nº" DATA invoice->invoicenbr
COLUMN TITLE "PRODUCT NAME" DATA products->name
ADutheil wrote:I know 2 ways:
Antonio Linares wrote:Mosh,
In FWH/samples/report/repdemo.prg and rep*.prg there are a lot of very useful an easy TReport examples.
You can built it running go.bat and you should get repdemo.exe
COLUMN TITLE "First Name", "Last Name" ;
DATA Test->First, Test->Last
COLUMN TITLE "Street", "City" ;
DATA Test->Street, Test->City
LOCAL cOrderNumber
LOCAL oRepo
details->( ordSetFocus( "ordered_by_order_number" ) )
REPORT oRepo TITLE "Master/Details" PREVIEW
COLUMN TITLE "NAME" DATA master->NAME
COLUMN TITLE "ADDRESS" DATA master->ADDR
COLUMN TITLE "ORDER" DATA SayOrderNumber( @cOrderNumber )
COLUMN TITLE "PRODUCTS" DATA "" SIZE 50
END REPORT
ACTIVATE REPORT oRepo ON CHANGE SayDetails( oRepo, cOrderNumber )
STATIC FUNCTION SayOrderNumber( cOrderNumber )
cOrderNumber := master->ORDN
RETURN master->ORDN
STATIC Function SayDetails( oRepo, cOrderNumber )
details->( ordScope( 0, cOrderNumber ), ordScope( 1, cOrderNumber ), dbGoTop() )
oRepo:BackLine( 1 )
WHILE details->( !eOF() )
oReport:StartLine()
oReport:Say( 4, details->FIELD_YOU_WANT )
oReport:EndLine()
details->( dbSkip() )
ENDDO
details->( ordScope( 0, NIL ), ordScope( 1, NIL ) )
oRepo:Newline()
RETURN NIL
ADutheil wrote:Mosh,
I think you are looking for something like this:
ADutheil wrote:Try with oRepo:Line( nTop, nLeft, nBottom, nRight, nPen, nScale )
oRepo:bStartRecord := { || oRepo:box( oRepo:nRow / oRepo:oDevice:nLogPixelY, oRepo:nMargin/oRepo:oDevice:nLogPixelX, ( oRepo:nRow + oRepo:nStdLineHeight) / oRepo:oDevice:nLogPixelY, RightMargin( oRepo ) / oRepo:oDevice:nLogPixelX , 1 ) }
FUNCTION RightMargin( oRepo )
LOCAL nRight := oRepo:nMargin
AEval( oRepo:aColumns, { | v | nRight += v:nWidth } )
nRight += ( ( Len( oRepo:aColumns )- 1 ) * oRepo:nSeparator )
RETURN nRight
ADutheil wrote:I you want a box better use box method:
ADutheil wrote:The test I wrote seems OK:
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 27 guests