Code: Select all
#include "fivewin.ch"
#include "report.ch"
FUNCTION PrnDisVav
LOCAL dData := date() + 1
LOCAL oRepo
LOCAL oFon1
LOCAL oFon2
IF SeleDatRep( @dData )
disv->( ordSetFocus( "DNOM" ), ordScope( 0, dToS( dData ) ), ordScope( 1, dToS( dData ) ), dbGoTop() )
DEFINE FONT oFon1 NAME "ARIAL" SIZE 0,-8
DEFINE FONT oFon2 NAME "ARIAL" SIZE 0,-10 BOLD
REPORT oRepo TITLE "ENTREGA DE VENDA AVULSA DE " + dToC( dData ), "JORNAL DO COMÉRCIO DE PETROLINA" ;
FOOTER "PrnDisVav Emissão:" + dToC( date() ) + " " + time() + " PAG:("+ allTrim( str( oRepo:nPage, 4 ) ) + ")", "" RIGHT CAPTION "RELATÓRIO PrnDisVav" FONT oFon1, oFon2 PREVIEW
COLUMN TITLE "PONTO DE VENDA" DATA disv->NOME
COLUMN TITLE "QTD" DATA disv->REPA TOTAL
COLUMN TITLE "DETAILS" DATA "" SIZE 40
END REPORT
IF oRepo:lCreated()
oRepo:oTitle:aFont[ 1 ]:= { || 2 }
oRepo:oTitle:aFont[ 2 ]:= { || 2 }
oRepo:oHeader:aFont[ 1 ] := { || 2 }
oRepo:Margin( .1, RPT_RIGHT )
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 ) }
ENDIF
ACTIVATE REPORT oRepo ON CHANGE SayDetails( oRepo )
oFon1:End()
oFon2:End()
disv->( ordScope( 0, NIL ), ordScope( 1, NIL ), dbSkip( 0 ) )
ENDIF
RETURN ( NIL )
FUNCTION RightMargin( oRepo )
LOCAL nRight := oRepo:nMargin
AEval( oRepo:aColumns, { | v | nRight += v:nWidth } )
nRight += ( ( Len( oRepo:aColumns )- 1 ) * oRepo:nSeparator )
RETURN nRight
FUNCTION SayDetails( oRepo )
LOCAL nI
oRepo:BackLine( 1 ) // remove this line if you want details to begin the line after master
FOR nI := 1 TO 4
oRepo:StartLine()
oRepo:Say( 3, "Detail " + str( nI ) )
oRepo:EndLine()
NEXT
oRepo:Newline()
RETURN NIL