Link to home
Start Free TrialLog in
Avatar of Mehram
MehramFlag for Pakistan

asked on

ms sql opening balance on ledger

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
Avatar of assyst
assyst

you have to maintain a seperate table for storing the opening balance.
Here you can store the financial year too...

Thanks
ASKER CERTIFIED SOLUTION
Avatar of assyst
assyst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mehram

ASKER

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
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.
Does anyone have an ERD or DB schema for a general ledger application like Quickbooks?