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
mostrar número de fila en Report
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: mostrar número de fila en Report
Prueba así:
local nFila := 1
...
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila++ ) )
local nFila := 1
...
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila++ ) )
-
- Posts: 93
- Joined: Mon Apr 30, 2012 9:10 am
Re: mostrar número de fila en Report
Gracias, pero no va, la serie son números pares: 2, 4, 6, etc.
Ejemplo:
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: mostrar número de fila en Report
Prueba con:
local nFila := -1
y
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila += 0.5 ) )
local nFila := -1
y
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila += 0.5 ) )
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: mostrar número de fila en Report
Otra forma de hacerlo:
local nFila := -1
...
oReport:bEndLine = { || nFila += 0.5 }
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila ) )
local nFila := -1
...
oReport:bEndLine = { || nFila += 0.5 }
COLUMN TITLE "Fila" DATA AllTrim( Str( nFila ) )
Re: mostrar número de fila en Report
Very good Master!
Regards, saludos.
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
João Santos - São Paulo - Brasil
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: mostrar número de fila en Report
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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: mostrar número de fila en Report
Very good master!!
Regards, saludos.
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
João Santos - São Paulo - Brasil