Jump to content
Fivewin Brasil

TDolphin com FastrReport - Resolvido


aferra

Recommended Posts

Alessandro vc vai ter que fazer com array

existe duas formas de fazer

     aCab:={'data','hora','codigo','qtd','saldo','saldoant','tipo','debecre','terminal','usuario','descricao','usu'}
     mTitulo:="Controle de estoque alterado manualmente "+dProduto
     Spool(mTitulo,@wArq,@wGera,'1',"kardex2.fr3",nNivel)
     tipoo:=1
     if cInterno
        if !MSGNOYES("voce deseja imprimir <Sim>  ou alterar <Nao>...")
           tipoo:=2
        endif
     endif
     ccabec:=''
     ciff:=''
     NOMEMP:= nomfil
     oFrPrn := frReportManager():new()
     oFrPrn:SetIcon(1)                                
     oFrPrn:SetTitle( 'Relatorio' )       
     oFrPrn:LoadLangRes( 'brazil.xml')                
     for nI:=1 To Len(aCab)
         cCabec+=aCab[nI]+IF(nI==Len(aCab),'',';')
         cIFF  +="IIF( aField == '"+aCab[nI]+"',"+str(nI)+","+IF(nI<>Len(aCab),"",REPLICATE(')', Len(aCab) ) )
     next
     oFrPrn:SetUserDataSet( "kardex2",cCabec,;
                      {||nI := 1}, ;                //--> bGoTop
                      {||nI := nI + 1}, ;           //--> bSkipPlus
                      {||nI := nI - 1}, ;           //--> bSkipMinus
                      {||nI > Len(aSql)}, ;         //--> bCheckEOF
                      {|aField|nCol := &cIFF,;
                      aSql[nI, nCol] } )
     oFrPrn:LoadFromFile(cRela1) 
     if mZoom='2'
        oFrPrn:PreviewOptions:SetZoomMode(2)
     endif
     oFrPrn:PreviewOptions:SetAllowEdit( .f. )
     if tipoo= 2
        oFrPrn:DesignReport()          
     else
        if !wGera
           oFrPrn:ShowReport()    
        else   
           Aguarde1("Aguarde..."+CRLF+"Gerando Relatorio...")
           oFrPrn:PrepareReport()
           oDlgg:End()
        endif	           
     endif
     oFrPrn:SaveToFPFile("&wArq")  
     oFrPrn:ClearDataSets()
     oFrPrn:DestroyFR()

a outra seria assim

     oFrPrn := frReportManager():new()
     oFrPrn:SetIcon(1)                                
     oFrPrn:SetTitle( 'Relatorio' )       
     oFrPrn:LoadLangRes( 'brazil.xml')                
     oFrPrn:SetUserDataSet("bFluxo", "codigo;descricao;saida;entrada", ; 
                {||x := 1}, ;          
 	  	 			 {||x := x + 1}, ;     
                {||x := x - 1}, ;      
	  	 			 {||x > Len(aFluxo)}, ; 
                {|aField| nCol := IIF( aField == "codigo", ;
         			   1, ;
	  	 			 IIF( aField == "descricao", ;
	  	 			   2, ;
	  	 			 IIF( aField == "saida", ;
	  	 			   3, ;
	  	 			 IIF( aField == "entrada", ;
	  	 			   4, 5 )))), aFluxo[x, nCol] } )
     oFrPrn:LoadFromFile(cRela1) 
     if mZoom='2'
        oFrPrn:PreviewOptions:SetZoomMode(2)
     endif
     oFrPrn:PreviewOptions:SetAllowEdit( .f. )
     if tipoo= 2
        oFrPrn:DesignReport()          
     else
        if !wGera
           oFrPrn:ShowReport()    
        else   
           Aguarde1("Aguarde..."+CRLF+"Gerando Relatorio...")
           oFrPrn:PrepareReport()
           oDlgg:End()
        endif	           
     endif
     oFrPrn:SaveToFPFile("&wArq")  
     oFrPrn:ClearDataSets()
     oFrPrn:DestroyFR()

Link to comment
Share on other sites

estava com medo disso, terei que trocar todos os relatórios, isso vai demandar um tempo, terei que pensar melhor.

obrigado Luiz

uma pergunta:, isso seria com qualquer SQL ( sqllib, sqlrdd, TMySql, etc ... )

Link to comment
Share on other sites

Resolvido da seguinte maneira.

Já tenho criado o SELECT

// os campos que quero para o relatório

cCampos := "COD;NOM;APE;FON;CGC;INS;MUN;VEN;END;NUM;COM;CEP;BAI;EST;CON;EMA;ETQ"

oFrPrn:SetUserDataSet( "oTmpImp", cCampos,;

{|| oTmpImp:GoTop() },;

{|| oTmpImp:Skip(1) },;

{|| oTmpImp:Skip(-1) },;

{|| oTmpImp:EoF() },;

{|nField| oTmpImp:FieldGet( nField ) })

desta maneira mudo somente essas duas linhas e mais nada.

Agradecimentos a Carles do forum Inter.

o conceito é o mesmo do array, mas ai teria que mudar os browses, consultas, indices enfim muita mudança, desta maneira mudei somente trez itens do relatório e estou com o SQL.

Obrigado Luiz, João e Marcelo(via skype)

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...