Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Group-wise calculation Post Reply Post New Topic
Author Message
evilz_gj
Newbie
Newbie
Avatar

Joined: 24 Nov 2008
Location: India
Online Status: Offline
Posts: 3
Quote evilz_gj Replybullet Topic: Group-wise calculation
     Posted: 24 Nov 2008 at 6:58pm
This is my first post in this forum.
 
I want to create the cash register report.
 
I have to create day-wise group and display the total transection of the whole day and calculate them and find the balance .
 
Its format is like . .
 
 
Group 1 (1-9-2008)
 
Previous balance                500 Rs.
---------------------------------------------------------------------------------------------
Account Name                     Credit        Debit
-----------------------------------------------------------------------------------------------
Jhon A/c                              200 Rs.
Dwee A/c                                               300 Rs.
--------------------------------------------------------------------------------------------
Total Amount (1-9-2008)    200 Rs.        300Rs.
--------------------------------------------------------------------------------------------
Balance     (Need)               400 Rs.(Balance = Sum(Cradit) - Sum(Debit))
--------------------------------------------------------------------------------------------
 
 
Group 2 (2-9-2008)
 
Previous balance (Need)     400 Rs.   (Above Balance )
---------------------------------------------------------------------------------------------
Account Name                     Credit        Debit
----------------------------------------------------------------------------------------------
Geet A/c                              100 Rs.
Ramesh A/c                                          250 Rs.
--------------------------------------------------------------------------------------------
Total Amount (1-9-2008)    100 Rs.      250Rs.
--------------------------------------------------------------------------------------------
Balance                               250 Rs.(Balance = Sum(Cradit) - Sum(Debit))
--------------------------------------------------------------------------------------------
 
 
 
 
 
Thanks in advance . .
. . keep coding . .
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Nov 2008 at 6:30am
Well, you need the initial starting balance...
If you are getting the data from a stored proc, have the proc do the calculations.
 
Otherwise, I would set a formula in the group footer(grouping by date it would appear) and I would sum the credit and debit and would update a shared variable with the new balance.  I would then display the new balance in the group header.  The first balance could be initialized from the data or from a parameter if it is not in the data.
 
Hope this helps in some way.
IP IP Logged
evilz_gj
Newbie
Newbie
Avatar

Joined: 24 Nov 2008
Location: India
Online Status: Offline
Posts: 3
Quote evilz_gj Replybullet Posted: 29 Nov 2008 at 3:25am

Thanks for reply. . .

I got the starting initial balance by the stored procedure .

 

But , I don't know how to use the formula field in header and footer part to do so. .

please reply.
. . keep coding . .
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Dec 2008 at 6:13am
Hmm.  Right click on formula, select New, name it.
 
For the detail section, the one that would most of the work, the first line would be shared numbervar x; then you can access this variable with statements that would add to it x := x + {field name}.   I like to end my formula with "" as that will suppress any output that i don't want seen. Finally, drop the formula on the detail line...if you wanted a running balance, leave off the "".
 
In the group header, there would be something like shared numbervar x;
local numbervar lx :=x;
x:=0;
lx....
 
This would display the value.  Drop it on the header group where you want it displayed. 
 
Hope this helps
IP IP Logged
evilz_gj
Newbie
Newbie
Avatar

Joined: 24 Nov 2008
Location: India
Online Status: Offline
Posts: 3
Quote evilz_gj Replybullet Posted: 04 Dec 2008 at 6:41pm
thanks lockwelle . . . .
. . keep coding . .
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum