Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to find Opening Balance of Ac Post Reply Post New Topic
Author Message
RoniDxb
Newbie
Newbie
Avatar

Joined: 02 Sep 2008
Location: United Arab Emirates
Online Status: Offline
Posts: 6
Quote RoniDxb Replybullet Topic: How to find Opening Balance of Ac
     Posted: 13 Aug 2015 at 9:23am
I have following table named table1 with following data

Ac#     Date            Debit     Credit
1     1-Jan-15                    100
1     1-Jan-15                    100
1     2-Jan-15          200     
1     2-Jan-15          300     
1     3-Jan-15                    200
1     3-Jan-15                    100

Now User gives parameter date range as following
Date >= 2-Jan-15 and Date<= 3-Jan-15
Now the data will be display in report as following

Ac#     Date            Debit     Credit
1     2-Jan-15          200     
1     2-Jan-15          300     
1     3-Jan-15                    200
1     3-Jan-15                    100



My problem is how can i find the opening balance.

for example in this case opening balance will be
sum (Debit) - Sum(Credit) where Date < 2-Jan-15

Opening balance= -200

Please guide me how to calculate opening balance
i hope you will understand my problem.

please help me.







Edited by RoniDxb - 13 Aug 2015 at 9:25am
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 14 Aug 2015 at 1:31am
I assume your opening balance is not "sum (Debit) - Sum(Credit) where Date < 2-Jan-15" because this doesn't take the 3rd Jan into account.

Assuming you want the the opening balance of "sum (Debit) - sum (Credit)" from the whole report you need to create this in the report Footer (or the Group Footer if  you have a group).

You can do this by creating a Running Total - DebitRT (evaluate on each record) and sum on the Debit field and CreditRT (evaluate on each record) and sum on the Credit field.

Then in your report/group footer create a formulate (Opening Balance):

DebitRT - CreditRT

Hope this helps...
IP IP Logged
RoniDxb
Newbie
Newbie
Avatar

Joined: 02 Sep 2008
Location: United Arab Emirates
Online Status: Offline
Posts: 6
Quote RoniDxb Replybullet Posted: 14 Aug 2015 at 9:59am
My question is very clear.
if you just see a ledger , you give date range and an account no. so what does happen

you get the ledger of give date range of a give account no and you get the opening balance which is actually

< you start date and is sum of debit and credit
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