FOR i := 1 TO LEN(oQry:aStructure)
AADD(aEst,{.f.,oQry:FieldName(i)})
NEXT i
DEFINE DIALOG oDlg1 TITLE "Listado" FROM 03,15 TO 35,90
@ 10, 10 SAY "Campos a incluir" OF oDlg1 PIXEL
@ 25, 10 XBROWSE oBrw SIZE 105,80 pixel OF oDlg1 ARRAY aEst ;
HEADERS "Muestra", "Campo";
COLUMNS 1, 2 ;
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
:nEdittYPEs := 1
:aCols[ 1 ]:SetCheck()
:CreateFromCode()
END
@ 45,10 BUTTON oBot1 PROMPT "&Imprimir" OF oDlg1 SIZE 30,10 ACTION ((mrta := .t.), oDlg1:End() ) PIXEL
@ 45,20 BUTTON oBot2 PROMPT "&Cancelar" OF oDlg1 SIZE 30,10 ACTION ((mrta := .f.), oDlg1:End() ) PIXEL
ACTIVATE DIALOG oDlg1 CENTER
IF !mrta
RETURN NIL
ENDIF
REPORT oRep TITLE "Listado" FONT oFont1,oFont2,oFont3 HEADER "Encabezado" RIGHT;
FOOTER "Hoja:" + STR(oRep:npage,3) + SPACE(40)+"Fecha:"+DTOC(DATE()) PREVIEW
FOR i := 1 TO LEN(aEst)
IF aEst[i,1]
oCol := MakeRepCol( oRep, i, oQry )
ENDIF
NEXT i
oRep:oTitle:aFont[1] := {|| 3 }
oRep:bInit := {|| oQry:GoTop() }
oRep:bSkip := {|| oQry:Skip() }
END REPORT
ACTIVATE REPORT oRep WHILE !oQry:EOF() ON STARTPAGE oRep:SayBitmap(.1,.1,"LOGO.BMP",.5,.5)
oQry:End()
RETURN NIL
static function MakeRepCol( oRep, i , oQry)
local oCol, bData, cPic, nSize
local cAlign
bData := { || oQry:FieldGet(i) }
nSize := oQry:FieldLen(i)
cPic := IF(oQry:FieldType(i)=="N",;
REPLICATE("9",oQry:FieldLen( i ))+"."+REPLICATE("9",oQry:FieldDec( i )),NIL)
cPic := IF(RIGHT(cPic,1)=".",LEFT(cPic,LEN(cPic)-1),cPic)
if bData != nil
cAlign := If( oQry:FieldType(i) == "C", "LEFT", "RIGHT" )
oCol := RptAddColumn( { { || oQry:FieldName(i) } }, nil ,;
{ bData }, nSize, { cPic } ,;
nil, .f., nil ,;
cAlign, .F., .F., nil, ;
.f.,.f., ;
nil, nil, nil, nil )
endif
return oCol