Group Totals in Accounting.
This may sound funny but I was able to do this in Clipper in those olden
days, I wish this can be achieved in RB too. The problem is:
1 Assets
-
-
-
--------------------------------Just a blank line, no total
11 Fixed Assets
-
-
-
Total of 11
12 Current Assets
-
-
-
Total of 12
Total of 1 [ this includes total 11 + 12 + all entries belonging to 1]
Also the theory is 1's sublevel is 11,12,13,14,15 etc, similarly 11's
sublevel is 111,112,113 etc.
Thanks in Advance.
Moorthy
~~~~~
days, I wish this can be achieved in RB too. The problem is:
1 Assets
-
-
-
--------------------------------Just a blank line, no total
11 Fixed Assets
-
-
-
Total of 11
12 Current Assets
-
-
-
Total of 12
Total of 1 [ this includes total 11 + 12 + all entries belonging to 1]
Also the theory is 1's sublevel is 11,12,13,14,15 etc, similarly 11's
sublevel is 111,112,113 etc.
Thanks in Advance.
Moorthy
~~~~~
This discussion has been closed.
Comments
I am probably not understanding this question. Looks like to me you have
some group based totals (i.e. Total of 11, Total of 12). And then you have a
grand total.
Perhaps this example will give you some ideas:
Create a TppVariable and use the Variable.OnCalc event to code the logic to
accumlate the result:
procedure varTotalOf1OnCalc(Sender: TObject; var Value: Variant);
var
lsAccountNo: String;
begin
lsAccountNo := plAssets['AccountNo'] ;
if lsAccountNo[1] = '1' then
Value := Value + plAssets['Amount'];
end;
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Actually I already have tried the way you have suggested it is close enough,
let me explain the problem in detail, let say I have two fields, ID and
Amount. When sorted on the ID the the records present as follows;
1
1
1
1
1
11
11
111
111
112
112
1121
12
12
122
122
1221
.
.
2
2
21
21
211
2111
22
.
.
etc.
All the records which has '1' as the first digit will be a whole group
similarly '2' is another main group. This needs a Total and thats easy to
find.
Each of the main groups can have sublevels i.e 11,12 etc.
Each of the sublevels can have sub-sub level 112,113 etc again they to can
have sub-sub-sub level 1121,1122 ...and 1131,1132...etc.
All the sub levels should have totals and that is also easy to figure out.
But the problem is each of sub-sub level total should be added to the one
above that level. Example total of 112s should be added into total of 11 and
again total of 11s should be added into total of 1. So the picture above
will become:
1
1
1
1
1
11
11
111
111
.......................... Total 111
112
112
1121
......................... Total 1121
......................... Total 112 [ Total of 1121 + 112 ]
......................... Total 11 [ Total of 11 + 112 + 111]
12
12
122
122
1221
......................... Total 1221
......................... Total 122 [ Total of 1221 + 122 ]
......................... Total 12 [ Total of 122 + 12]
.......................... Total 1 [ Total of 1 + 11 + 12 ]
Actually each digit in the ID is counted as a seperate level with the above
way of weightage.
Thats it, Hope this will help to understand my problem. Thanks in Advance.
your running group totals sums in each group footer as it generates, then
you could add a group based on a custom value. This way you can control the
group break for the groups such as Total 112 [ Total of 1121 + 112 ]. Define
a new group between the others for this total. Base it on a TppVariable or
TppLabel and use its OnGetText event to set its text to be the current group
break value. The group will check the text property causing the GetText
event to fire. All other calculations with variables should use the OnCalc
event. Otherwise, if you don't want to create extra custom groups to create
the totals, then use a TppVariable in the current group footer bands, and
don't have them auto reset based on a group. Instead, perform the reset
manually in the OnCalc event handler by setting the Value back to zero at
the start of the first calulation of the next set of records. If the data
is sequential, then you should be able to check if
(Report.Datapipeline['aFieldName'] = FNextGroupIntegerValue) then...
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com