Jump to content
Fivewin Brasil

Imprimir array com report


rubensma

Recommended Posts

Procedure Prt_Ficha()
   *
   aCampos  := { }
   *
AADD(aCampos, {"Propriedade"     , D_PROPRIED })
AADD(aCampos, {"numero"          , StrZero(D_NUMERO,5) })
AADD(aCampos, {"cliente"       , D_NOME })
AADD(aCampos, {"nascimento"    , D_NASCIMEN })
AADD(aCampos, {"cpf"           , D_CPF })
AADD(aCampos, {"rg"            , D_RG })
AADD(aCampos, {"email"         , D_EMAIL  })
AADD(aCampos, {"telefone"      , D_TELEFONE })
AADD(aCampos, {"celular"       , D_CELULAR })
AADD(aCampos, {"endereco"   , D_ENDERECO })
AADD(aCampos, {"bairro"        , D_BAIRRO } )
AADD(aCampos, {"cidade"        , D_CIDADE })
AADD(aCampos, {"cep"           , D_CEP })
AADD(aCampos, {"filiação"        , D_FILIACAO })
AADD(aCampos, {"conjuge"       , D_CONJUGE })
AADD(aCampos, {"DtConjuge" , D_DTCONJUG })
AADD(aCampos, {"DtCasamento" , D_DTCASAME })
AADD(aCampos, {"uf"            , D_ESTADO })
AADD(aCampos, {"cadastro"      , D_CADASTRO })
AADD(aCampos, {"sexo"   , D_SEXO})
AADD(aCampos, {"Naturalidade" , D_NATURALI })
AADD(aCampos, {"Inscr.Estadual" , D_IE  })
AADD(aCampos, {"NIRF" , D_NIRF  })
AADD(aCampos, {"CEI/CNPJ" , D_CEI_CNPJ })
AADD(aCampos, {"NFuncionario" , D_NFUNCION })
AADD(aCampos, {"Foto" , "FOTOS\C_"+StrZero(D_NUMERO,5)+".BMP" })
AADD(aCampos, {"TpAssociado" , D_TPSOCIO })
*
nCopia := 1
*
cCabecalho  := ""
   aCabeca  := {}
   aDados   := {}
   For n1:=1 To Len(aCampos)
     AADD(aCabeca, aCampos[n1,1] )
     AADD(aDados , aCampos[n1,2])
     cCabecalho  += aCampos[n1,1]+";"
  Next n1
   *
   cCabecalho  := SubStr(cCabecalho,1,Len(cCabecalho)-1)
*
nCopia := 1
*
cDirFr := CurDrive() +":\"+ CurDir() + '\Formulario\'       //Variável para Localizar o Arquivo
*
FrPrn := frReportManager():New()   //Abertura do FastReports
FrPrn:SetIcon(1)                                         //Escolha do Ícone  
FrPrn:SetTitle("Ficha Cliente")                   //Titulo da Dialog no FastReports
*******************************************************************
FrPrn:LoadLangRes( cDirFr+"BRAZIL.XML")
*******************************************************************
   //--> 
   FrPrn:SetUserDataSet("aDados",cCabecalho, ;
                        {||a1 := 1}, ;  //--> bGoTop
{||a1 := a1 + 1}, ;  //--> bSkipPlus
                        {||a1 := a1 - 1}, ;  //--> bSkipMinus
{||a1 > Len(aDados)}, ;  //--> bCheckEOF
                        {|aField1| cPesq1 := aField1, nCol := ASCAN(aCabeca,{|p1| p1 = cPesq1}),;
aDados[nCol] } )
*
   FrPrn:PreviewOptions:SetAllowEdit( .F. )
   FrPrn:PreviewOptions:SetZoomMode(1)
   FrPrn:PreviewOptions:SetOutlineExpand(.f.)
   *
*FrPrn:PreviewOptions:SetMaximized(.f.)
*
DoFrAction("Ficha.fr3",,.T.,.f.)
*
FrPrn:ClearDataSets()                                    //Inutiliza Todas as Informações de DataBase no FastReports
*                     
FrPrn:DestroyFR()                                        //Fecha (ou 'Destroi') o Objeto do FastReports
*
Return nil
 
Link to comment
Share on other sites

Veja se resolve.

nclude "FiveWin.ch"
#include "report.ch"
#include "dbstruct.ch"
STATIC oReport, nField
Function Rep15()
LOCAL aStructure := DbStruct("Test.dbf")
IF len(aStructure) == 0
MsgStop("Could not read Test.dbf structure")
RETU NIL
ENDIF
nField := 1
REPORT oReport TITLE "*** TEST.DBF STRUCTURE ***","" PREVIEW
COLUMN TITLE "Name" DATA aStructure[nField][DBS_NAME] SIZE 15
COLUMN TITLE "Type" DATA aStructure[nField][DBS_TYPE] SIZE 6
COLUMN TITLE "Len" DATA aStructure[nField][DBS_LEN] SIZE 3 TOTAL
COLUMN TITLE "Decimals" DATA aStructure[nField][DBS_DEC] SIZE 8
END REPORT
/*
Just the following
*/
oReport:bSkip := {|| nField++}
ACTIVATE REPORT oReport WHILE nField <= len(aStructure)
RETURN NIL
Este exemplo do fivewin, pasta Samples\Report\rep15.prg
Link to comment
Share on other sites

Assim:

While(!Eof())

SysRefresh(); CursorWait()

aadd(aImp, {Tabela->Codigo, Tabela->Nome, Tabela->Amb, Transform(Tabela->Ch * nValor,"@E 999,999.99")})

dbSkip()

if (Tabela->Tabela != Pbusca)
exit
endif

End

nConta := 1

Asort(aImp, , , {|x, y| x[1] < y[1]})

Define Font oFont1 Name "Courier New" Size 0, -12

if vPrevia
REPORT oReport ;
Title Trim(lLab)+" - "+Trim(lDesc),;
"TABELA: "+Trim(Left(Pconvenio,37))+" - Pág: "+Str(oReport:nPage,3,0);
Caption "Rel. Tabela" Font oFont1 PreView
vArquivo := .F.
endif

if Varquivo
REPORT oReport ;
Title Trim(lLab)+" - "+Trim(lDesc),;
"TABELA: "+Trim(Left(Pconvenio,37))+" - Pág: "+Str(oReport:nPage,3,0);
Caption "Rel. Tabela" Font oFont1 To File (cDirDoc)+"Tabela.Txt"
endif

if (! vArquivo .and. ! vPrevia)
REPORT oReport ;
Title Trim(lLab)+" - "+Trim(lDesc),;
"TABELA: "+Trim(Left(Pconvenio,37))+" - Pág: "+Str(oReport:nPage,3,0);
Caption "Rel. Tabela" Font oFont1
endif

if vArquivo
oReport:nTitleUpLine := 0
oReport:nTitleDnLine := 0
endif

Column Title "CÓDIGO" DATA aImp[nConta,1] Size 06
Column Title "DESCRIÇÃO" DATA aImp[nConta,2] Size 55
Column Title " A.M.B." DATA aImp[nConta,3] Size 14
Column Title "VALOR" DATA aImp[nConta,4] Right Size 12

End Report

if ! vArquivo
oReport:CellView()
endif

oReport:bSkip := {|| nConta ++}

Activate Report oReport While nConta <= len(aImp)
oFont1:End()

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...