by davor0501 » Thu May 16, 2013 6:14 pm
Thanks for your help Mr. FranciskoA, this is a small example of what I wanted to do in my program who now works ok.
Best regards Davor.
#include "FiveWin.ch"
#include "report.ch"
REQUEST DBFFPT,DBFCDX
function rept()
local nBalance:=0,nfor,astruct,oReport
IF FILE("MyTable.DBF")=.F.
ASTRUCT := { ;
{ "AAA" , "N", 5, 0 }, ;
{ "DEBIT" , "N", 5, 0 }, ;
{ "CREDIT" , "N", 5, 0 } ;
}
DBCREATE("MyTable", ASTRUCT, "DBFCDX", , )
endif
USE MyTable NEW
index on str(MyTable->aaa) to aaacdx temporary
dbGoTop()
if eof()=.t.
for nfor=1 to 20
append blank
if nfor<=10
replace MyTable->aaa with 10
else
replace MyTable->aaa with 20
endif
replace MyTable->debit with nfor*2
replace MyTable->credit with nfor
next
endif
REPORT oReport ;
TITLE "Test" ;
HEADER dtoc(date());
FOOTER "Page: "+str(oReport:nPage,3) RIGHT;
PREVIEW
oReport:bInit := { || MyTable->(dbGoTop()), nBalance:= 0 } //FWH 1204
COLUMN TITLE "GROUP " ;
DATA MyTable->AAA ;
PICTURE "@Z 99999999" ;
SIZE 10
COLUMN TITLE "DEBITS " ;
DATA MyTable->Debit ;
PICTURE "@Z 99,999,999.99" ;
SIZE 10 ;
TOTAL
COLUMN TITLE "CREDITS " ;
DATA MyTable->Credit ;
PICTURE "@Z 99,999,999.99" ;
SIZE 10 ;
TOTAL
COLUMN TITLE "BALANCE " ;
DATA nBalance += ( MyTable->Debit - MyTable->Credit ) ;
PICTURE "99,999,999.99" ;
SIZE 10
GROUP ON MyTable->aaa
END REPORT
ACTIVATE REPORT oReport ON ENDGROUP nBalance:= 0
close all
return nil