Solved

ms sql opening balance on ledger

Posted on 2006-07-12
5
1,460 Views
Last Modified: 2010-10-04
Sir, I am using two table for posting my vouchers and I am using following code for displaying ledger of each account

select b.Acc_ID, a.VCreateDate, b.Naration, b.Debit, b.Credit  from AC_VCHRMASTER a join AC_VCHRDETAIL b on a.VCHR_NO=b.VCHR_NO where Acc_id='1003001001' and VCreateDate >='07/01/2006' and VCreateDate <='07/29/2006'

Result:
Acc_ID                       VCreateDate                             Naration     Debit        Credit
1003001001      2006-07-12 00:00:00.000      fdfd      .00      1010.000000

Before defined period transaction user want add one list namely Opening Balance and amount on debit or credit whatever actual. How to calculate amount before define period transcation. through create view or else

Please help.

Rgds.
Mehram
0
Comment
Question by:Mehram
  • 3
5 Comments
 
LVL 7

Expert Comment

by:assyst
Comment Utility
you have to maintain a seperate table for storing the opening balance.
Here you can store the financial year too...

Thanks
0
 
LVL 7

Accepted Solution

by:
assyst earned 500 total points
Comment Utility
Addition...to the above comment...

Like if you have a table maintaining the financial year, you can add one more col and store the opening balance there.
0
 

Author Comment

by:Mehram
Comment Utility
Sir, for example I am working in year 2005 and month is currently going on Nov-05, its mean is that the database have data from Jun to Nov-05 but user is select period for ledger from sep to nov-05 for which the past two month (july and aug would not be display but the balance would be come on report of past two month.

Please help.
Rgds.
Mehram
0
 
LVL 7

Expert Comment

by:assyst
Comment Utility
Hi Mehram,

Are you maintaining closing balance for every month. If so you make a stored procedure and call that in the particular report. You can get the closing balance directly or by using a cursor inside the stored proc and then put all the result in a temporary table and you can use this table for populating data in the report. You can make use of # tables for this purpose so that no need to maintain a seperate table in your database.
0
 

Expert Comment

by:apples1234
Comment Utility
Does anyone have an ERD or DB schema for a general ledger application like Quickbooks?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now