Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperate Month Totals

Status
Not open for further replies.

rmiller11

MIS
Jan 20, 2003
43
US
I want to Have headers with separate months but am not sure how to do it. ie

if {PJPROJ.end_date} = "current year and Jan 1 thru 31" then {vr_RVI_ProfitByJob.eac_Revenue} else 0

I am not sure how to set up the variables and how to use them. I would like to set up 12 months in columns and then for the 13th column have everything beyond the current calendar year. I can do this statically but I want it dymanic so I don't have to edit the report every year. I did it this way statically :

if {PJPROJ.end_date} >= Date (2003,01,01) and {PJPROJ.end_date} <= Date (2003,01,31) then {vr_RVI_ProfitByJob.eac_Revenue} else 0
 
If Month({DateField}) = 1 Then {Amount} Else 0

If you want to have each month carried around in variables - which is most likely a better option if you want to manipulate the amounts into various subtotals, then go:

WhilePrintingRecords;
NumberVar JanTotal;
NumberVar FebTotal;
...etc...

If Month({DateField}) = 1 Then JanTotal := JanTotal + {Amount}
Else
If Month({DateField}) = 2 Then FebTotal := FebTotal + {Amount}
Else...

Then, where you want the monthly totals to show up, put:

WhilePrintingRecords;
NumberVar JanTotal;

Naith
 
Ok, this is what I did:

WhilePrintingRecords;
NumberVar JanTotal;
NumberVar FebTotal;

If Month({PJPROJ.end_date}) = 1 and year ({PJPROJ.end_date}) = year (CurrentDate)
Then JanTotal := JanTotal + {vr_RVI_ProfitByJob.eac_Revenue}
Else
If Month({PJPROJ.end_date}) = 2 and year ({PJPROJ.end_date}) = year (CurrentDate)
Then FebTotal := FebTotal + {vr_RVI_ProfitByJob.eac_Revenue}

WhilePrintingRecords;
NumberVar JanTotal;

This is making a running total and I am not able to have Sub and Grand Totals on Groups. How do I adjust it to have detail per line item by month column and have the ability to do sub and grand totals?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top