I made before :
Function Test
Local aEntrate :={}
Local aEnt :={}
Local aData :={}
Local aCanE :={ { "Gen", 0 }, { "Feb", 0 }, { "Mar", 0 }, { "Apr", 0 }, ;
{ "Mag", 0 }, { "Giu", 0 }, { "Lug", 0 }, { "Ago", 0 }, ;
{ "Set", 0 }, { "Oct", 0 }, { "Nov", 0 }, { "Dic", 0 } }
USE ENTRATE ALIAS EN
EN->(DbGoTop())
//Save all names all categories if empty add a new category noname
DO WHILE ! EN->(Eof())
Aadd(aEntrate, IIF (EMPTY(EN->DESCR),"Noname",EN->DESCR) )
EN->(DbSkip())
ENDDO
// add on array for mounth the imptotal if Apcatingr is = aEntrate
USE MOVIMENTI ALIAS MV
MV->( DBEVAL( { || aCanE[ Month( FIELD->APFECHA ) ][ 2 ]+= IIF( FIELD->APCATINGR=aEntrate, MV->APIMPTOTAL,0) } ) )
How I can make to found FIELD->APCATINGR= for each aEntrate description and insert it on dbeval ?
I tried with
Code: Select all
#include "fivewin.ch"
#include "xbrowse.ch"
Function Test
Local aEntrate :={}
Local aEnt :={}
Local aData :={}
Local aCanE :={ { "Gen", 0 }, { "Feb", 0 }, { "Mar", 0 }, { "Apr", 0 }, ;
{ "Mag", 0 }, { "Giu", 0 }, { "Lug", 0 }, { "Ago", 0 }, ;
{ "Set", 0 }, { "Oct", 0 }, { "Nov", 0 }, { "Dic", 0 } }
USE ENTRATE ALIAS EN
EN->(DbGoTop())
//Save all names all categories if empty add a new category noname
DO WHILE ! EN->(Eof())
Aadd(aEntrate, IIF (EMPTY(EN->DESCR),"Categoria senza nome",EN->DESCR) )
EN->(DbSkip())
ENDDO
// add on array for mounth the imptotal if Apcatingr is = aEntrate
USE MOVIMENTI ALIAS MV
For n=1 to len( aEntrate)
MV->( DBEVAL( { || aCanE[ Month( FIELD->APFECHA ) ][ 2 ]+= IIF( FIELD->APCATINGR=aEntrate[n], MV->APIMPTOTAL,0) } ) )
next
For n=1 to len( aEntrate)
AAdd( aData, {aEntrate[n], aCanE[1][2],aCanE[2][2],aCanE[3][2],aCanE[4][2] ,aCanE[5][2] ,aCanE[6][2] ,aCanE[7][2],aCanE[8][2],;
aCanE[9][2] ,aCanE[10][2] ,aCanE[11][2] ,aCanE[12][2],"D" } )
next
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 700,300 PIXEL FONT oFont
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
HEADERS 'Voci', 'Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic','Grafico';
ARRAY aData AUTOCOLS
WITH OBJECT oBrw
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
the dialog is good but perhaps the dbeval is wrong because I not have the totals I show on xbrowse
Making a total with the hand I have ( on my archive) another totals :
Ingresos extraordinarios on mounth of May only 266,80
Nómina on mouth of May only 1000,00 and on mounth of Nov only 1000,00
Venta no totals