TReport samples

Re: TReport samples

Postby ADutheil » Sun Apr 28, 2013 2:37 pm

Code: Select all  Expand view  RUN
#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
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TReport samples

Postby mosh1 » Mon Apr 29, 2013 1:22 pm

ADutheil wrote:The test I wrote seems OK:

It seems depend on the device - different printers give me different results. Perhaps TReport is performing some internal calculation which is wrong.
mosh1
 
Posts: 129
Joined: Sun Oct 09, 2011 3:50 pm

Re: TReport samples

Postby Antonio Linares » Mon Apr 29, 2013 2:11 pm

Mosh, André,

When fonts are going to be created for different printers, we should do:

DEFINE FONT oFon1 NAME "ARIAL" SIZE 0,-8 OF oPrinter

Where oPrinter is a PRINTER object previously created:

PRINTER oPrinter ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TReport samples

Postby ADutheil » Mon Apr 29, 2013 2:54 pm

Try this way:

Code: Select all  Expand view  RUN
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 GRID
        COLUMN TITLE "QTD"                  DATA disv->REPA TOTAL GRID
        COLUMN TITLE "DETAILS"              DATA "" SIZE 40 GRID
    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:separator() }
        //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 )
oRepo:separator()
FOR nI := 1 TO 4
    oRepo:StartLine()
    oRepo:Say( 3, "Detail " + str( nI ) )
    oRepo:EndLine()
NEXT
oRepo:Newline()
RETURN NIL
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TReport samples

Postby HunterEC » Mon Apr 29, 2013 3:14 pm

André:

Can you show a sample of your report's output so we can learn of all the thing the code is doing ?

Thank you very much, muito obrigado.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: TReport samples

Postby ADutheil » Mon Apr 29, 2013 3:42 pm

With the 2 way. First one was already uploaded.

Image

Uploaded with ImageShack.us
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TReport samples

Postby mosh1 » Mon Apr 29, 2013 5:32 pm

Antonio Linares wrote:Mosh, André,

When fonts are going to be created for different printers, we should do:

DEFINE FONT oFon1 NAME "ARIAL" SIZE 0,-8 OF oPrinter

Where oPrinter is a PRINTER object previously created:

PRINTER oPrinter ...


This produce huge font size and there is no place for report on a page.
mosh1
 
Posts: 129
Joined: Sun Oct 09, 2011 3:50 pm

Re: TReport samples

Postby Antonio Linares » Mon Apr 29, 2013 5:51 pm

Mosh,

Have you tried to use a smaller font size ? i.e.:

DEFINE FONT oFon1 NAME "ARIAL" SIZE 0,-4 OF oPrinter
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TReport samples

Postby ADutheil » Mon Apr 29, 2013 7:30 pm

Antônio, I did try but had to go down to -1.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TReport samples

Postby Antonio Linares » Mon Apr 29, 2013 7:54 pm

André,

Ok, but did it properly shown on different printers ? thanks for the tests :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TReport samples

Postby ADutheil » Mon Apr 29, 2013 8:57 pm

I just instaled another printer (Epson Stylus 85) and it did not work.

Actualy using oRepo:bStartRecord := { || oRepo:separator() } ( test version 2 ) it works. 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 ) } works with cutepdf writer but not with Epson. I probably messed something in the box params.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TReport samples

Postby mosh1 » Mon Apr 29, 2013 9:22 pm

ADutheil wrote:I just instaled another printer (Epson Stylus 85) and it did not work.

Actualy using oRepo:bStartRecord := { || oRepo:separator() } ( test version 2 ) it works. 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 ) } works with cutepdf writer but not with Epson. I probably messed something in the box params.


I reduced font size to -1

Now the results of testing :

In CutePDF and Foxit Reader PDf Printer master data fits perfectly in the box. Microsoft Office Document Image Writer works too.

On preview

HP LaserJet 1300 data is not in the box. Dell Photo Printer 720 only half of the data row is in the box.

On printout

HP LaserJet 1300 only data upper part (like upper bar of of F) is in the box. Dell Photo Printer 720 only most of the data row is in the box.
mosh1
 
Posts: 129
Joined: Sun Oct 09, 2011 3:50 pm

Re: TReport samples

Postby Antonio Linares » Mon Apr 29, 2013 9:33 pm

Mosh,

Do the boxes look fine or the lines ?

If the lines are fine, then the box function may be wrong
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TReport samples

Postby mosh1 » Mon Apr 29, 2013 10:36 pm

Antonio Linares wrote:Mosh,

Do the boxes look fine or the lines ?

If the lines are fine, then the box function may be wrong


I am using box, will try lines later.
mosh1
 
Posts: 129
Joined: Sun Oct 09, 2011 3:50 pm

Re: TReport samples

Postby Antonio Linares » Tue Apr 30, 2013 6:12 am

I meant the text lines ? Do they look fine ?

Ib that case, we need to modify the Method Box()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42100
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests