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

Saturday, May 19, 2007

Using RTSLINK DLL in VB.NET

PInvoke is the mechanism by which .NET languages can call unmanaged functions in DLLs. This is especially useful for calling Windows API functions that aren’t encapsulated by the .NET Framework classes, as well as for other third-party functions provided in DLLs.

Using PInvoke in VB.NET to call RTSLINK DLL functions

There are mainly two ways in which you can use PInvoke in VB
1) Using the Declare Statement
2) Using DllImport

Using the Declare Statement
Declare Auto Function RTSOpen Lib "RTSLINK.DLL" Alias "Open" () As Long
Declare Auto Function Send Lib "RTSLINK.DLL" (ByVal strRequestXML As String) As Long
Declare Auto Function GetLastErrorMessage Lib "RTSLINK.DLL" () As String

Remarks:-
For more information on using PInvoke in VB.NET, please refer the article at CodeProject

Friday, April 20, 2007

Analyzing the Tally Server Response

RTSLINK DLL

This article describes how to read the Tally Server Response after a XML request is sent using the Send() function. To begin with, let us see the C language declaration of the Send() function.

C language declaration of the Send() function
int __stdcall Send(message);

Remarks:-
  1. The send function returns an Integer value (Zero for success, otherwise the error-code).
  2. If the return value is Zero, it implies that the XML request has been successfully sent to the Tally server.

Analysing the Tally Server Response
As mentioned above, if the Send() function returns 0 (Zero), it implies that the XML Request has been successfully sent to the Tally Server. The XML requested can be either reading or writing data to the Tally' database. Example of XML Request:-
  1. Export (read) any report data (Trial balance, Ledger etc.)
  2. Import (write) any master or voucher data to Tally's database
On receiving the XML Request message, the Tally Server processes it and then delivers a response/result which can be retrieved using the ResponseText() function which is described later on. Example:-
  1. If you had requested for any Report, the Tally Server response will contain the Report data.
  2. If you had requested for writing data to Tally's database, the Tally Server response will contain details whether a new records is created; or altered or deleted.
In the later case, when the XML request is to write to Tally's database, it becomes essential to analyze the Tally Server response and check for errors. For this the ResponseText() function is to be used. The ResponseText() function retrieves the Tally Server response and returns it in a string.

C language declaration of ResponseText() function
LPSTR __stdcall ResponseText(void);

You can either display the response message in a Message-Box or parse it using XML DOM. Use the following VB code to parse the response message and check if any errors are there or not.

Sample VB code
Set ChildNodes = XMLDOM.SelectNodes("/RESPONSE/LINEERROR")
if (ChildNodes.Length > 0) then
MsgBox "Tally write error"
else
MsgBox "Success"
end if

For more information about using XML DOM, please refer the topic "Using XML DOM" in "RTSlink - An Insight" document which can be downloaded from www.rtslink.com/downloads.html


Shweta Computers
www.rtslink.com

Tuesday, April 17, 2007

Creating customized Tally Reports - MyDaybook v1.3

MyDaybook version 1.3  supercedes the older version 1.2.

The new features in MyDaybook version 1.3 are as follows:-
1) Allows you to Delete multiple Voucher entries

Click here  for more information on MyDaybook v1.3.

Monday, April 16, 2007

Tally Customization - Linking Sales Voucher module with Tally Software

Tally Customization - How to link Sales Voucher entry module with Tally Accounting Software ?

Click here for more information.

Tuesday, April 10, 2007

Linking Receipt Voucher entry module with Tally

Click here for more information on linking the Receipt module of your software with Tally.

Wednesday, March 7, 2007

Export / Fetch Tally data programmatically

Click here for information about Exporting Tally data programmatically using XML Tags.

Thursday, February 15, 2007

Linking Ledger Master module with Tally

LEDGER.EXE is a Master Entry form developed by Mr Vikas Aggrawal, Ahmedabad. This program has been developed in Visual Foxpro 6 and demonstrates how you can link your application with Tally Accounting Software.

Notes
Entries done in this VFP form are automatically posted in Tally. Full source-code of LEDGER.EXE (1991 kb) is provided. The source-files include:-

1) Ledger.pjx and Ledger.pjt (Project file)
2) Ledger.scx and Ledger.sct (Form)
3) Main.prg (Main Program file)
4) Sclib.prg (Program file)
5) Ledger.dbf (VFP Table)
6) Party.dbf
7) Group.scx and Group.sct

To run LEDGER.EXE file, you need RTSLINK DLL.

Click here to download the RTSlink DLL setup-file.

Click here to download the LEDGER.EXE file.

Friday, February 9, 2007

Group Master Entry form

GROUP.EXE is a Master Entry form developed by Mr Vikas Aggrawal, Ahmedabad. This program has been developed in Visual Foxpro 6 and demonstrates how you can link your application with Tally Accounting Software.

Notes
Entries done in this VFP form are automatically posted in Tally. Full source-code of GROUP.EXE (1983 kb) is provided. The source-files include:-

1) Group.pjx and Group.pjt (Project file)
2) Group.scx and Group.sct (Form)
3) Main.prg (Main Program file)
4) Sclib.prg (Program file)
5) Group.dbf (VFP Table)

To run GROUP.EXE file, you need RTSLINK DLL.

Click here to download the RTSLINK DLL setup-file.

Click here to download the GROUP.EXE file.

Thursday, February 8, 2007

Good Programming Practices

1. Start with a good program design.
2. Your program should be functional at all times. Adding new functionality should not break the existing functionality.
3. Divide the work into small incremental steps such that you can accomplish and review it within a single day.
4. Review each line of your code.
5. Adopt top-bottom approach.

Linking your Software with Tally

I am not a programmer. Can I use the RTSLINK Utility ?
RTSLINK DLL utility is for Programmers / Software developers who have developed their own software and wish to link it with Tally.

What does "Linking with Tally" mean ?
Suppose, you do a Payment Voucher entry (or any other voucher) in your program. Automatic Posting of this entry into the Tally software is what we call "Linking with Tally". In other words, any entry added / modifed or deleted in your software must be automatically reflected in Tally. (Note: Tally software must be running in background)

Can I post data from my software into Tally directly ?
Yes. This is already dicussed in the previous point.

How do I link my software with Tally ?
You will have to modify the SAVE module of all the Entry/Transactions screens in your program. Although this is not very difficult, but it may take few days/weeks as there may be several modules in your program. You will be linking only the "Accounts & Inventory" modules of your program with Tally.

Proper planning and a systematic approach can ease this task. Let us try to understand what needs to be done in the SAVE modules of your software.

STEP 1: SAVE module of your program
Data entered by the User is to be saved into the database.

It is presummed that the developer has a functional program with complete module to SAVE the data into the database. We shall move to the Step 2 of the SAVE module which is generating Tally supported XML tags.

STEP 2: SAVE module of your program
At the end of the SAVE module, write code to generate Tally supported XML tags. These tags will be different for each module.

Generating the XML tags
The first thing you must do is to refer the Tally supported XML Tags for the module you wish to link. Suppose you wish to link GROUP Master module of your software with Tally, you need to have the XML tags for the GROUP master. You can get this from the Tally Software itself using option "Display -> List of Accounts -> Export" or you may download it from www.rtslink.com/downloads.html

We are providing sample XML Tags for GROUP master.


<ENVELOPE>
<HEADER>
<TALLYREQUEST>Import Data</TALLYREQUEST>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
<REPORTNAME>All Masters</REPORTNAME>
</REQUESTDESC>
<REQUESTDATA>
<TALLYMESSAGE xmlns:UDF="TallyUDF">
<GROUP NAME="My Debtors" ACTION="Create">
<NAME.LIST>
<NAME>My Debtors</NAME>
</NAME.LIST>
<PARENT>Sundry Debtors</PARENT>
<ISSUBLEDGER>No</ISSUBLEDGER>
<ISBILLWISEON>No</ISBILLWISEON>
<ISCOSTCENTRESON>No</ISCOSTCENTRESON>
</GROUP>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>


Having seen the XML tags, you need to write code for it. We are herewith providing VISUAL BASIC code that stores the GROUP MASTER XML Tags into a string variable. This string variable is passed as a parameter in the Send() function.
Visual Basic code

Dim strRequestXML As String
Dim strAction As String
strAction="Create"

strRequestXML = _
"<ENVELOPE>" & _
" <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>" & _
" <BODY>" & _
" <IMPORTDATA>" & _
" <REQUESTDESC>" & _
" <REPORTNAME>All Masters</REPORTNAME>" & _
" </REQUESTDESC>" & _
" <REQUESTDATA>" & _
" <TALLYMESSAGE>" & _
" <GROUP NAME=" & Form1.txtName.Text & "ACTION=" & strACTION & ">" & _
" <NAME.LIST>" & _
" <NAME>" & Form1.txtName.Text & "</NAME>" & _
" </NAME.LIST>" & _
" <PARENT>" & Form1.cmbParent.Text & "</PARENT>" & _
" </GROUP>" & _
" </TALLYMESSAGE>" & _
" </REQUESTDATA>" & _
" </IMPORTDATA>" & _
" </BODY></ENVELOPE>"


Notes:
You will have to subsitute the object names "Form1", "txtname", "cmbParent" etc in your code.

STEP 3: SAVE module of your program
- Connect to the Tally Server using Open() function of RTSLINK DLL.
- Invoke RTSLINK Send() function to send the XML tags (string) to the Tally server.

Notes:
1) Please refer the Visual basic Example 1 given in www.rtslink.com/visualbasic.html for the syntax to use RTSLINK DLL functions.
2) You will have to declare RTSLINK DLL functions before you can use them. This is covered in the Example 1 in www.rtslink.com/visualbasic.html


CONCLUSION
You have seen how to link GROUP MASTER module of your Software with Tally Software. The most critical thing in linking with Tally is to create the XML Tags and store it in a STRING variable.

You may try creating XML Tags for other Masters on the same lines. Creating XML tags for Vouchers (transactions) is comparatively difficult as compared to Masters. We would suggest that you complete all the MASTERS linking and then proceed with the Transactions.

FINAL WORDS
We would request programmers / software developers to provide sample code written in other programming languages for linking with Tally. The code will be put on this blogspot for the benefit of all interested programmers.