Page 1 of 1

Group TReport no funciona con array

Posted: Tue Sep 13, 2016 4:03 pm
by daniel_halon
Buen dia amigos, preciso de una ayuda, estoy haciendo mis reportes con arrays para que sea mas rapido en red, pero no consigo agrupar por la fecha del facturamiento, sera que alguien me puede dar una ayudita, gracias Daniel

Code: Select all

 TELE0060->(DbSetOrder(3))
  TELE0060->(dbSeek(vDataini))
  
   DO WHILE TELE0060->(!eof()) .AND. TELE0060->A_DTPED_60 >= vDataini .and. TELE0060->A_DTPED_60 <= vDataFin
     IF TELE0060->A_STATUS60 == 'C'
       TELE0060->(dbSkip())
       Loop
     ENDIF
     
     aadd(a_show,{TELE0060->A_TOTAL_60, TELE0060->A_DESC__60, TELE0060->A_DESBAL60, TELE0060->A_VLRPRO60, TELE0060->A_TXENT_60,;
                    TELE0060->A_DTPED_60, TELE0060->DESC_DINHE})
     
  
     TELE0060->(dbSkip())
   ENDDO
   
   I:= 1 ; nHasta := LEN( a_show)  

 
   REPORT oReport ;
        TITLE OemToAnsi("*** RELATORIO DE VENDAS ***"),"Relatorio Interno","Referente a " + Dtoc(vDataIni) + space(1) +;
              OemToAnsi("ate") + space(1) + Dtoc(vDataFin),"","" CENTERED;
        FONT oFont1, oFont2, oFont3 ;
        HEADER "Data: " + Dtoc(date()) + "  " + time() CENTERED ;
        FOOTER OemToAnsi("Pagina: ")+str(oReport:nPage,3) CENTERED;
        PREVIEW
        
        
   
   COLUMN TITLE OemToAnsi("Num") ;
        DATA transform(I,'@E 999');
        SIZE 3

   COLUMN TITLE OemToAnsi("Data") ;
        DATA a_show[I,6]; 
        SIZE 10
       
            
   COLUMN TITLE "Faturamento" ;
        DATA  a_show[I,1]; 
        TOTAL
 
        
   COLUMN TITLE "Descontos" ;
        DATA  a_show[I,2]; 
        TOTAL
        
   COLUMN TITLE "Desc. Balcao" ;
        DATA  a_show[I,3]; 
        TOTAL
        
   COLUMN TITLE "Desc. Promo" ;
        DATA  a_show[I,4]; 
        TOTAL      
         
   COLUMN TITLE "Desc. Dinh." ;
        DATA  a_show[I,7]; 
        TOTAL      

   COLUMN TITLE "Taxa de Entrega" ;
        DATA  a_show[I,5]; 
        TOTAL;
        GRID
 
  
       
   GROUP ON a_show[6]; //esta es la fecha
          HEADER oReport:aGroups[1]:cValue;
          FOOTER "Pedidos: " + "[" + Alltrim(str(oReport:aGroups[1]:nCounter)) + "]"
   
 
 
 
   END REPORT 
  
  
   
   oReport:CellView()     //FORMA AS LINHAS VERTICAIS E HORIZ DAS CELDAS 
   oReport:bWhile      := { || I <= nHasta }
   oReport:bSkip       := { | | I++} 
   oReport:cGrandTotal := "Grand Total..."
   oReport:cPageTotal  := "Page Total..."
   
   oReport:oTitle:aFont[2] := {|| 2 } //1ra linha do titulo 
 

Re: Group TReport no funciona con array

Posted: Wed Sep 14, 2016 8:20 am
by nageswaragunupudi
GROUP ON a_show[ 6 ] or a_show[I,6] ?

Re: Group TReport no funciona con array

Posted: Wed Sep 14, 2016 2:16 pm
by daniel_halon
a_show[I,6] error
a_show[6] = column date

Re: Group TReport no funciona con array

Posted: Wed Sep 14, 2016 2:18 pm
by daniel_halon
Sera que alguien tiene alguna idea de como conseguir agrupar por fecha com array?

Re: Group TReport no funciona con array

Posted: Wed Sep 14, 2016 2:58 pm
by nageswaragunupudi
Sample:

Code: Select all

function GroupedRepArray

   local aData, oRep, i, d

   aData    := { ;
      { Date() - 30, "Line-1", 1000 }, ;
      { Date() - 30, "Line-2", 1500 }, ;
      { Date(),      "Line-3", 2000 }, ;
      { Date(),      "Line-4", 2500 }  }

   i := 1

   REPORT oRep PREVIEW

   COLUMN TITLE "Date"   DATA aData[ i, 1 ]
   COLUMN TITLE "Text"   DATA aData[ i, 2 ]
   COLUMN TITLE "Amount" DATA aData[ i, 3 ] PICTURE "99,999.99" TOTAL

   GROUP ON aData[ i, 1 ] HEADER "Transactions : " + DTOC( d := aData[ i, 1 ] ) ;
      FOOTER "Totals for " + DTOC( d )

   END REPORT

   WITH OBJECT oRep
      :bWhile        := { || i <= Len( aData ) }
      :bSkip         := { || i++ }
   END

   ACTIVATE REPORT oRep

return nil
 
Image

Re: Group TReport no funciona con array

Posted: Fri Sep 16, 2016 2:19 pm
by daniel_halon
Good morning, compiled his example exactly the same and the following error,
does not accept group on ADATA [ i, 1 ], where 'll be my mistake ?
Application
===========
Path and name: E:\Sistemas\Portobakers\Porto.EXE (32 bits)
Size: 4,651,008 bytes
Time from start: 0 hours 0 mins 10 secs
Error occurred at: 16/09/2016, 11:12:05
Error description: Error BASE/1132 Erro de limite: acesso de array
Args:
[ 1] = A { ... }
[ 2] = N 5

Stack Calls
===========
Called from: PRGS\Relatorios.prg => (b)GROUPEDREPARRAY(2373)
Called from: .\source\classes\RGROUP.PRG => (b)TRGROUP:TRGROUP(0)
Called from: => TRGROUP:CHECK(0)
Called from: .\source\classes\REPORT.PRG => TREPORT:PLAY(0)
Called from: .\source\classes\REPORT.PRG => (b)TREPORT:ACTIVATE(0)
Called from: .\source\classes\DIALOG.PRG => (b)TDIALOG:TDIALOG(0)
Called from: => TDIALOG:DISPLAY(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: => DIALOGBOX(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from: .\source\classes\REPORT.PRG => TREPORT:ACTIVATE(0)
Called from: PRGS\Relatorios.prg => GROUPEDREPARRAY(2382)
Called from: PRGS\Porto.PRG => (b)MENUMAIN(596)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: PRGS\Porto.PRG => MAIN(376)

Re: Group TReport no funciona con array

Posted: Fri Sep 16, 2016 2:29 pm
by daniel_halon
With Group on aData [ 1 ] , is so
[img]
https://www.dropbox.com/s/fe14vr8ce8a98 ... o.jpg?dl=0
[/img]


I'm sorry to be bothering but I'm trying to time and can not , Daniel