A blog on Tally Integration, to import and export data from Tally.ERP programmatically using VB6, VB.NET,C#,ASP.NET etc

Wednesday, February 24, 2010

Ledger Opening Balance

You can retrieve the Ledger Opening Balances from Tally using the underneath SQL-SELECT statement :-

Select $Name,$OpeningBalance From Ledger

The above SELECT-SQL returns correct balances if you are working in the 1st year. However, in the 2nd year or later (i.e. if the Current Period beginning is different from the Books beginning date) the above SELECT-SQL returns the OpeningBalance as on the Current period Beginning date which is incorrect. To understand this let's take an example :-

1) Create a New Company in Tally with Books Beginning date as 01-04-2005 (i.e. 1st April, 2005)

2) Next, create a Ledger named "My Bank A/c" under group "Bank Accounts" with Opening Balance of Rs 5000

3) Next, enter a Payment Voucher on 2nd May 2005 as follows :-

Dr: Office Expenses Rs 100
Cr: My Bank A.c Rs 100

4) Next, use the SELECT-SQL mentioned above. It returns the correct opening balance for "My Bank A/c" which is Rs 5000/-

5) Next, change the period using Alt+F2 key and set it as 01-04-2006 to 31-03-2007

6) Now, again use the same SELECT-SQL given above. In this case, it returns the Opening Balance for "My Bank A/c" as Rs 4900/- instead of Rs 5000/-

a) In simple words, the $OpeningBalance returns the Ledger-Opening-balance as on the current-period-beginning-date (i.e as on 01-04-2006 in this example)
b) You must use TDL, to get the Ledger Openingbalance as on the Books-beginning date (i.e. 01-04-2005 in this example) irrespective of what the current period is set in Tally.