AdBlanco,
la forma mas sencilla que encontre es generar un arreglo con la informacion a imprimir, haces la busqueda, metes el resultado en una arreglo y sobre ese imprimes.
static function VtaReporte1()
cFecha1 := Fecha2Sql( dIni )
cFecha2 := Fecha2Sql( dFin )
oMovs := oMysql:Query( "SELECT * FROM movtos where codigo = '" + cCod +;
"' AND fecha BETWEEN '" + cFecha1 + "'" + " AND '" + cFecha2 + "' ORDER BY fecha")
oMovs:gotop()
do while !oMovs:eof()
aadd( aRegistros, { oMovs:fieldget('ubicacion'),;
oMovs:fieldget('cliente'),;
oMovs:fieldget('fecha'),;
oMovs:fieldget('codigo'),;
oMovs:fieldget('cantidad'),;
oMovs:fieldget('precio'),;
oMovs:fieldget('importe')})
oMovs:Skip()
enddo
if len( aRegistros ) > 0
Reporte2(dIni, dFin, cCod, aRegistros)
else
msginfo('NO SE ENCONTRARON COINCIDENCIAS', cProgram)
return nil
endif
oMovs:end()
oMovs := NIL
return nil
static function Reporte3(dIni, dFin, cCodigo, nRuta, aRegistros)
local oFont1, oFont2, oReport, nRegistro := 1
local cTexto := '" "
local cTexto2 := " "
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
REPORT oReport TITLE 'Prueba ;
FOOTER Pág :"+strzero(oReport:nPage,3) FONT oFont1, oFont2 PREVIEW
COLUMN TITLE "Cte" DATA aRegistros[nRegistro,2] PICTURE '9999' RIGHT
COLUMN TITLE "Cliente" DATA substr(NombreCliente(aRegistros[nRegistro,2]),1,25)
COLUMN TITLE "Fecha" DATA aRegistros[nRegistro,3]
COLUMN TITLE "Cant" DATA aRegistros[nRegistro,5] PICTURE '999' RIGHT TOTAL
COLUMN TITLE "Precio" DATA aRegistros[nRegistro,6] PICTURE '99,999.99' RIGHT
COLUMN TITLE "Importe" DATA aRegistros[nRegistro,7] PICTURE '999,999.99' RIGHT TOTAL
oReport:bSkip := {|| nRegistro++}
END REPORT
IF oReport:lCreated
oReport:aFont[1] := {|| 2 }
oReport:aFont[4] := {|| 2 }
oReport:aFont[5] := {|| 2 }
ENDIF
ACTIVATE REPORT oReport WHILE nRegistro <= len(aRegistros)
oFont1:end()
oFont2:end()
oReport:end()
return NIL
a lo mejor estoy matando pulgas a balazos pero eso fue lo que me funciono.
saludos,
Mauricio
