Click here to Skip to main content
12,395,319 members (67,399 online)
Rate this:
 
Please Sign up or sign in to vote.
I have a sql server table in this structure

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

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 25-Sep-11 3:38am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 25 Sep 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100