dav_asp
01-05-2007, 02:58 PM
I'm collecting turnovers for various companies from a db and each of the companies has a county code. e.g. Yorkshire is defined as number 2.
I need to group the companies together by county and need to display a totals line for those members only and then on the following lines I want the next county and its companies and so on.
what i need is the totals line like this:
Acct Name Jan Feb Mar Reps-Code
p12d Private £1000 £2510 £5203 2
r72t Retail £5965 £7512 £1316 2
TOTALS £6965 £10012 £6519
s87e Albion £2395 £1000 £500 19
ayt4 Range £950 £7512 £1316 19
TOTALS £3345 £8512 £1816
So basically i need it after all companies grouped by the Reps-code. So all companies with reps-code 2 have their own totals, then the ones with the code 19 and so on.
However i cant get it to display like that and i get the following instead:
Acct Name Jan Feb Mar Reps-Code
p12d Private £1000 £2510 £5203 2
TOTALS £1000 £2510 £5203
r72t Retail £5965 £7512 £1316 2
TOTALS £5965 £7512 £1316
I am grouping the companies by the Reps-code and that works as the companies are grouped but the problem is with the totals line.
I'm using a do while loop to check that the records are present in the db and the totals line is inside that loop. I tried putting the totals after the loop but that only displays 1 Totals line for ALL companies.
Im sure its pretty simple to do but i cant seem to get around what im doing wrong.
I need to group the companies together by county and need to display a totals line for those members only and then on the following lines I want the next county and its companies and so on.
what i need is the totals line like this:
Acct Name Jan Feb Mar Reps-Code
p12d Private £1000 £2510 £5203 2
r72t Retail £5965 £7512 £1316 2
TOTALS £6965 £10012 £6519
s87e Albion £2395 £1000 £500 19
ayt4 Range £950 £7512 £1316 19
TOTALS £3345 £8512 £1816
So basically i need it after all companies grouped by the Reps-code. So all companies with reps-code 2 have their own totals, then the ones with the code 19 and so on.
However i cant get it to display like that and i get the following instead:
Acct Name Jan Feb Mar Reps-Code
p12d Private £1000 £2510 £5203 2
TOTALS £1000 £2510 £5203
r72t Retail £5965 £7512 £1316 2
TOTALS £5965 £7512 £1316
I am grouping the companies by the Reps-code and that works as the companies are grouped but the problem is with the totals line.
I'm using a do while loop to check that the records are present in the db and the totals line is inside that loop. I tried putting the totals after the loop but that only displays 1 Totals line for ALL companies.
Im sure its pretty simple to do but i cant seem to get around what im doing wrong.