Click here to Skip to main content
15,896,437 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a sql server table in this structure

XML
EntryDate               Ledge Name  CashIn      CashOut
2011-04-17 00:35:45.000 Gopal Stores    NULL        15627.00
2011-04-22 00:35:45.000 Gopal Stores    NULL        1134.00
2011-04-25 00:35:45.000 Gopal Stores    NULL        6410.00
2011-06-03 00:35:45.000 Gopal Stores    2000.00     NULL
2011-06-04 00:35:45.000 Gopal Stores    NULL        4370.00
2011-07-01 00:35:45.000 Gopal Stores    10000.00    NULL
2011-07-15 00:35:45.000 Gopal Stores    5000.00     NULL



Now i want to get the last five rows as it is, but previous data as Sum(CashOut)-Sum(CashIn), so the resulting data will be like this in crystal Reports

CSS
EntryDate	        Ledge Name	CashIn	    CashOut
                                      Old Balance : 16761.00
2011-04-25 00:35:45.000 Gopal Stores    NULL        6410.00
2011-06-03 00:35:45.000 Gopal Stores    2000.00     NULL
2011-06-04 00:35:45.000 Gopal Stores    NULL        4370.00
2011-07-01 00:35:45.000 Gopal Stores    10000.00    NULL
2011-07-15 00:35:45.000 Gopal Stores    5000.00     NULL

Current Balance : 10541
Posted

1 solution

Data as opening balance should be part of the header data and you need to use a separate dataset (generated using a separate query) for that, it's same like Opening balance data in a ledger. The report parameters would be 2 dates and the Opening balance would include the data prior to the date provided.

There is no special feature in CR which does this, it's a way you implement these nitty grtties.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900