Page 1 of 1
mostrar número de fila en Report
Posted: Fri Dec 25, 2020 10:02 am
by joseluispalma
Hola a todas y a todos,
Espero que todos os encontréis bien y disfrutéis de una muy feliz navidad tras un año para olvidar.
Necesito en un informe TREPORT que aparezca a la izquierda por ejemplo el número de fila. ¿Sabéis como hacerlo?
====================================
Fila Nombre Apellidos
====================================
1 Luis Sanz
2 Pedro Sánchez
Muchas gracias y saludos
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 10:24 am
by Antonio Linares
Prueba así:
local nFila := 1
...
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila++ ) )
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 10:37 am
by joseluispalma
Gracias, pero no va, la serie son números pares: 2, 4, 6, etc.
Ejemplo:
Code: Select all
// More reports...
#include "FiveWin.ch"
#include "report.ch"
STATIC oReport, oDlg
Function Main()
USE Customer ALIAS Test
myReport()
RETURN NIL
//----------------------------------------------------------------------------//
Function myReport()
LOCAL oFont1, oFont2, oFont3, oBmp, oPen1, oPen2
local nfila := 1
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-10 BOLD ITALIC
DEFINE PEN oPen1 WIDTH 5
DEFINE PEN oPen2 WIDTH 2
GO TOP
REPORT oReport ;
TITLE "*** LISTADO DE PRUEBA ***",;
"",;
OemtoAnsi("FiveTech Software"),;
"" ;
FONT oFont1,;
oFont2,;
oFont3 ;
PEN oPen1,;
oPen2 ;
HEADER "Fecha: "+dtoc(date()),;
"Hora: "+time() ;
RIGHT ;
FOOTER OemtoAnsi("P gina: ")+str(oReport:nPage,3) ;
CENTERED ;
PREVIEW
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila++ ) )
COLUMN TITLE "ST" ;
DATA Test->State ;
FONT 2
COLUMN TITLE "City" ;
DATA Test->City
COLUMN TITLE "First Name","Last Name" ;
DATA Test->First, Test->Last
COLUMN TITLE " Salary" ;
DATA Test->Salary ;
PICTURE "9,999,999" ;
SIZE 9 ;
TOTAL ;
SHADOW ;
GRID 2
END REPORT
ACTIVATE REPORT oReport
RETURN NIL
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 11:05 am
by Antonio Linares
Prueba con:
local nFila := -1
y
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila += 0.5 ) )
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 11:10 am
by Antonio Linares
Otra forma de hacerlo:
local nFila := -1
...
oReport:bEndLine = { || nFila += 0.5 }
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila ) )
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 2:08 pm
by karinha
Very good Master!
Code: Select all
// More reports...
#include "FiveWin.ch"
#include "Report.ch"
STATIC oReport, oDlg
FUNCTION Main()
SET CENTURY ON
SET DATE BRITISH
SET TIME FORMAT TO "HH:MM:SS"
SET EPOCH TO YEAR( DATE() ) - 30
USE Customer ALIAS Test
myReport()
RETURN NIL
FUNCTION myReport()
LOCAL oFont1, oFont2, oFont3, oBmp, oPen1, oPen2
LOCAL nfila := -1
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-10 BOLD ITALIC
DEFINE PEN oPen1 Width 2 COLOR CLR_CYAN
DEFINE PEN oPen2 WIDTH 2 COLOR CLR_GREEN
GO TOP
REPORT oReport ;
TITLE "*** LISTADO DE PRUEBA ***", ;
"", ;
OemtoAnsi("FiveTech Software"), ;
"" ;
FONT oFont1, ;
oFont2, ;
oFont3 ;
PEN oPen1, ;
oPen2 ;
HEADER "Fecha: " +DTOC(DATE()), ;
"Hora..: "+TIME() ;
FOOTER OemtoAnsi("P gina: ")+str(oReport:nPage,3) ;
CENTERED ;
PREVIEW
oReport:oDevice:lPrvModal := .T.
oReport:oDevice:SetPage(9) //-> Formato A4
oReport:lAutoLand := .F. // Vertical // Manuel Mercado.
// PrnPortrait() // vertical o:
// oReport:SetPortrait() // Vertical
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila += 0.5 ) )
COLUMN TITLE "ST" ;
DATA Test->State ;
FONT 2
COLUMN TITLE "City" ;
DATA Test->City
COLUMN TITLE "First Name","Last Name" ;
DATA Test->First, Test->Last
COLUMN TITLE " Salary" ;
DATA Test->Salary ;
PICTURE "9,999,999" ;
SIZE 9 ;
TOTAL ;
SHADOW ;
GRID 2
END REPORT
IF .NOT. oReport:lCreated
RETURN NIL
ELSE
oReport:SetTxtColor( CLR_HBLUE, 1 )
oReport:SetTxtColor( CLR_HRED, 2 )
oReport:SetTxtColor( CLR_HBLUE, 3 )
oReport:SetPenColor( CLR_CYAN )
oReport:SetShdColor( CLR_HCYAN )
ENDIF
oReport:CellView()
ACTIVATE REPORT oReport
oFont1:End()
oFont2:End()
oFont3:End()
oPen1:End()
oPen2:End()
RETURN NIL
Regards, saludos.
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 6:02 pm
by nageswaragunupudi
Another way:
Code: Select all
function TestReport()
local oRep, oFont
local nLine := 0
USE CUSTOMER NEW SHARED
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
REPORT oRep PREVIEW FONT oFont
COLUMN TITLE "LINE" DATA nLine FONT 1
COLUMN TITLE "NAME" DATA FIELD->FIRST FONT 1
COLUMN TITLE "CITY" DATA FIELD->CITY FONT 1
COLUMN TITLE "SALARY" DATA FIELD->SALARY FONT 1
ENDREPORT
oRep:bInit := { || nLine := 0 }
oRep:bStartRecord := { || nLine++ }
ACTIVATE REPORT oRep FOR RECNO() % 5 == 0
RELEASE FONT oFont
return nil
Re: mostrar número de fila en Report
Posted: Fri Dec 25, 2020 11:54 pm
by karinha
Very good master!!
Code: Select all
// More reports...
#include "FiveWin.ch"
#include "Report.ch"
STATIC oReport
FUNCTION TestReport()
LOCAL oFont, oPen1, oPen2
LOCAL nLine := 0
USE CUSTOMER NEW SHARED
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-10 BOLD ITALIC
DEFINE PEN oPen1 WIDTH 1 COLOR CLR_BLACK
DEFINE PEN oPen2 WIDTH 2 COLOR CLR_BLACK
REPORT oReport PREVIEW FONT oFont PEN oPen1, oPen2
COLUMN TITLE "LINE" DATA nLine FONT 1
COLUMN TITLE "NAME" DATA FIELD->FIRST FONT 1
COLUMN TITLE "CITY" DATA FIELD->CITY FONT 1
COLUMN TITLE "SALARY " ;
DATA FIELD->SALARY ;
PICTURE "@E 9,999,999,999.99" ;
FONT 1 ;
SIZE 10 ;
TOTAL ;
SHADOW ;
GRID 2
ENDREPORT
IF .NOT. oReport:lCreated
RETURN NIL
ELSE
oReport:SetTxtColor( CLR_HBLUE, 1 )
oReport:SetTxtColor( CLR_HBLUE, 2 )
oReport:SetTxtColor( CLR_HBLUE, 3 )
oReport:SetPenColor( CLR_BLACK )
oReport:SetShdColor( CLR_CYAN )
ENDIF
oReport:CellView()
oReport:bInit := { || nLine := 0 }
oReport:bStartRecord := { || nLine++ }
ACTIVATE REPORT oReport FOR RECNO() % 5 == 0
RELEASE FONT oFont
RELEASE PEN oPen1, oPen2
RETURN NIL
Regards, saludos.