Page 1 of 1

FastReport

Posted: Sun Aug 23, 2009 8:09 am
by Otto
Hello Marco,

would you be so kind to show how to use FastReport to print a Band with DATA coming from Fivewin similar to:

Code: Select all

PRINTAREA 9 OF ::oVrd ;
         ITEMIDS    { 101, 102 } ;
         ITEMVALUES { cText1, cText2 }
Thank in advance
Otto

Re: FastReport

Posted: Sun Aug 23, 2009 9:19 am
by Otto
Does FastReport support CDX files?
Thanks in advance
Otto

Re: FastReport

Posted: Sun Aug 23, 2009 11:49 am
by Ariel
Otto,

FR yes support cdx, One works normally, you put the order, the filter and launch the report. sorry my inglish.

Regards.
Ariel.

Re: FastReport

Posted: Sun Aug 23, 2009 5:57 pm
by Otto
To FastReport user,
could someone advice me how to create a new datasets.
Thanks in advance
Otto

Image

Re: FastReport

Posted: Sun Aug 23, 2009 11:49 pm
by Dorneles
Hello Otto, you can use the array to make the report.
Dorneles

Code: Select all

STATIC FUNCTION RelMargem()
////////////////////////////////////////////////////////////////////////////////
  LOCAL oMargen , nMargen := 0
  PUBLIC oiForn , iForn := 0
  PUBLIC onForn , nForn := SPACE(40)
  PUBLIC nScan := 0
  PUBLIC      := aDados:={}
  PUBLIC x    := 0
  PUBLIC nCol := 0   
  PUBLIC lImprime        := .F.
  PUBLIC aMES1 :=0
  PUBLIC aMES2 :=0
  PUBLIC aMES3 :=0


  DEFINE DIALOG oDlgM RESOURCE 1165 TITLE "Análise Margen" COLOR nRGB( 0, 0, 0 ), nRGB( 201, 217, 237 ) TRANSPARENT 

   REDEFINE GET oMargen     VAR nMargen ID 4005      OF oDlgM PICTURE "9999.99" UPDATE

    REDEFINE BUTTON       ID 701 OF oDlgM ACTION oDlgM:END()                                              UPDATE CANCEL
   REDEFINE BUTTON       ID 702 OF oDlgM ACTION (lImprime   := .T.,oDlgM:END()) UPDATE CANCEL

ACTIVATE DIALOG oDlgM CENTERED ON MOVE(oDlgM:Center)    

IF lImprime        
    
   SELECT Produto
   SET ORDE TO 4
   GO TOP

   DO WHILE !EOF() 
   
      CursorWait()
      IF Produto->lucro <= nMargen

         nScan := ASCAN(aDados, {|aVal| aVal[1] == Produto->codbarra}) 
      
         IF nScan = 0
            
           AADD(aDados,{Produto->codbarra,Produto->nm_produto,Produto->unidmed,Produto->id_depto,Produto->id_marca,Produto->id_grupo,Produto->codtcupom,Produto->aliquota,Produto->pccusto,Produto->lucro,Produto->pcvenda})
           
         ENDIF  
           
       ENDIF   
       
      SKIP
      SysRefresh()
      
   ENDDO   
 
    ASORT(aDados,,,{|x,y| (x[2]) < (y[2]) })
    
   oFrPrn:=frReportManager():new()
   oFrPrn:SetIcon(1)                     //ícone da janela do FRH
   oFrPrn:SetTitle( "Relatório" )            //título da janela do FRH
 
   oFrPrn:SetUserDataSet("aDados", "codbarra;nm_produto;unidmed;id_depto;id_marca;id_grupo;codtcupom;aliquota;pccusto;margem;pcvenda", ;
                        {||x := 1}, ; //--> bGoTop
                                {||x := x + 1}, ;  //--> bSkipPlus
                        {||x := x - 1}, ;  //--> bSkipMinus
                                {||x > Len(aDados)}, ;  //--> bCheckEOF
                        {|aField|nCol := IIF( aField == "codbarra"  , 1,;
                                                      IIF( aField == "nm_produto", 2,;
                                                      IIF( aField == "unidmed"   , 3,;
                                                      IIF( aField == "id_depto"  , 4,;
                                                      IIF( aField == "id_marca"  , 5,;
                                                      IIF( aField == "id_grupo"  , 6,;
                                                      IIF( aField == "codtcupom" , 7,;
                                                      IIF( aField == "aliquota"  , 8,;
                                                      IIF( aField == "pccusto"   , 9,;
                                                      IIF( aField == "margem"    ,10,;
                                                      IIF( aField == "pcvenda"     ,11,   12 ))))))))))), aDados[x, nCol] } )
   oFrPrn:LoadFromFile( "PMargem.fr3" ) 

   oFrPrn:PreviewOptions:SetAllowEdit( .F. )
   oFrPrn:PreviewOptions:SetZoomMode(2)
   oFrPrn:PreviewOptions:SetOutlineExpand(.F.)

//     oFrPrn:DesignReport()
     oFrPrn:ShowReport() 

   oFrPrn:ClearDataSets()
   oFrPrn:DestroyFR()   
  
ENDIF

SELECT Produto
SET ORDE TO 4
GO TOP

oDlgM:End()
Release All
SysRefresh()

RETURN(.T.)
 

Re: FastReport

Posted: Mon Aug 24, 2009 6:04 am
by Otto
Hello Dorneles,

thank you very much for your help.
I made much progress yesterday building reports with FR.
In practice I am able doing all my standard reports I need.
Now with your help I will try to make some reports using oFrPrn:SetUserDataSet.

I found out that if you use oFr:SetWorkArea("artikel", 1) in calling FR
then you can select from the menu “Report” “Data” the file.
Are you aware if you can use just the TAB “Data” and make a “standalone”
connection to a dBase database?

Thanks again and best regards,
Otto

Re: FastReport

Posted: Mon Aug 24, 2009 7:33 am
by Otto
Hello Dorneles,

thank you so much for your help.
Array is working for me.
Best regards,
Otto

Image