QPrint1

 FUNCTION QPrint1(aPHeads,block,bFooter,bSayHead,bKeyHead,aGroup)
   //--------------------------------------------------------------------------//
   PLOCAL nCo,cFi,cAlias,cFile:=TEMPFILE( GlobalTmpPath )
   PLOCAL nRecNo:=RECNO()
   PLOCAL AFIELDS:={}
   PLOCAL cFormat:='│'
   PLOCAL cHead,cField,cPict,cPict0,nField
   PLOCAL cHead0:='-',cHead1:='│',cHead2:='+'
   PLOCAL aBlockKey:=SaveKey()
   PLOCAL aTot:={}
   IF (EOF().OR.LASTREC()=0)
     RestKey(aBlockKey)
     RETURN (1)
   ENDIF
   FOR nCo:=2 TO LEN(aPHeads)
     cField:=IF(VALTYPE(aPHeads[nCo])=='A',aPHeads[nCo,2],FIELD(nCo-1))
     //AADD(aFields,FiName(cField))
     AADD(AFIELDS,cField)
     IF VALTYPE(cField)=="B"
       cPict0:=REPLICATE('X',LEN(aPHeads[nCo,1]))
     ELSE
       nField:=FiNum(cField)
       cAlias:=FiAlias(cField)
       IF ((cAlias)->(FIELDTYPE(nField))=='N')
         cPict0:=REPLICATE('9',(cAlias)->(FIELDSIZE(nField)))
         cPict0:=STUFF(cPict0,LEN(cPict0)-(cAlias)->(FIELDDECI(nField)),1,'.')
       ELSE
         cPict0:=REPLICATE('X',(cAlias)->(FIELDSIZE(nField)))
       ENDIF
     ENDIF
     cPict:=IF((VALTYPE(aPHeads[nCo])=='A'.AND.LEN(aPHeads[nCo])>2).AND.aPHeads[nCo,3]!=NIL,;
               aPHeads[nCo,3],cPict0)
     cFormat+=cPict+'│'
     IF VALTYPE(aPHeads[nCo])=='A'.AND.LEN(aPHeads[nCo])>3.AND.aPHeads[nCo,4]!=NIL;
        .AND.aPHeads[nCo,4]
       AADD(aTot,nCo-1)
     ENDIF
     cHead:=IF(VALTYPE(aPHeads[nCo])=='A',IF(VALTYPE(aPHeads[nCo,1]) = "C",aPHeads[nCo,1],EVAL(aPHeads[nCo,1])),aPHeads[nCo])
     cHead0+=REPLICATE('-',LEN(cPict))+'-'
     cHead1+=CENTER(cHead,LEN(cPict),.T.)+' '
     cHead2+=REPLICATE('-',LEN(cPict))+'-'
   NEXT
   cHead0:=LEFT(cHead0,LEN(cHead0)-1)+'-'
   cHead2:=LEFT(cHead2,LEN(cHead2)-1)+'-'
   GO TOP
   IF TotRep({PADC(IF(VALTYPE(aPHeads[1])=="B", EVAL(aPHeads[1]), aPHeads[1]),LEN(cFormat))},AFIELDS,{cHead0,cHead1,cHead2},;
      cFormat,aTot,aGroup,bFooter,cFile,,.T.,.T.,LASTREC(),,,,block,;
      ,,,,,,,bSayHead,bKeyHead)>0
     View(cFile,LASTREC(),LEN(cFormat))
   ENDIF
   GO nRecNo
   RestKey(aBlockKey)
   RETURN (1)