I create report . i want to show the sum of payble amount within 6 month.
I have values like 1 ,2,3.... in Month field in the table.
So I create veiable smonth and emonth for starting date and ending date respectively. and syear and eyear for starting year and ending year.
when I run the report for date 01-
04-07 to 01-
09-07. it will calculate amount from another year also as I write setrange for month and in 07 and 08 both years have 4th month.
So I write setrange for year also.
But now when I insert dates like 01-09-07 to 01-03-08 it will not calculate the amount as there is setrange for year.
On Pre data Item
payemppaydet.SETFILTER("Pay Element Code",'ESI');
smon := DATE2DMY(startdate,2) ;
emon := DATE2DMY(enddate,2) ;
syear := DATE2DMY(startdate,3) ;
eyear := DATE2DMY(enddate,3) ;
payemppaydet.SETRANGE(payemppaydet.Month,smon,emon);
payemppaydet.SETRANGE(payemppaydet.year,syear,eyear);
Employee - OnAfterGetRecord()
payemppaydet.SETRANGE(payemppaydet."Employee No","No.");
payemppaydet.CALCSUMS("Payable Amount");
esiamt := payemppaydet."Payable Amount";
What can i do to solve this problem??
please suggest..
Answers
payemppaydet.SETRANGE(payemppaydet.PostingDate,startdate,calcdate('+6M-1D',startdate));
Consultant-Developper
http://www.CreaChain.com
Thanks for solution.