option to IMPORT created XML file directly into tally then can u tell me what are the functions i can use to import the XML file directly into tally through C# code?
I am afraid I cant help much on this.. as I have to go through some of API's in c# which support this import functionality.. But i am sure you would find answer fot it in some other forums.
Please mark this post as Answer if it is of help to you!
I would love to change the world, but they wont give me the source code.
Thanks Kavita..for ur intrest ..i will search in some other forum..but by anyhow if u come to know about these function from any where then please dont forget to tell me...
NiranjandotN...
Member
1 Points
5 Posts
Please Help
Dec 03, 2009 08:50 AM|LINK
Hello,
I am writing a code to gentrate XML following XML file --
For generating this i m writing the following code in C#.net--
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; namespace DataConversion { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { FileStream fs = new FileStream("C:\\XmlDemoFile.xml", FileMode.Create); XmlTextWriter xw = new XmlTextWriter(fs, Encoding.UTF8); xw.WriteStartDocument(); xw.WriteStartElement("ENVELOPE"); //ENVELOPE Starts xw.WriteStartElement("HEADER"); //HEADER Starts xw.WriteElementString("VERSION", "1"); xw.WriteElementString("TALLYREQUEST", "Import Data"); xw.WriteElementString("TYPE", "DATA"); xw.WriteElementString("ID", "All Masters"); xw.WriteEndElement(); //Header Ends xw.WriteStartElement("BODY"); //Body Starts xw.WriteStartElement("DESC"); //DESC Starts xw.WriteStartElement("STATICVARIABLES"); //STATICVARIBLES Starts xw.WriteElementString("IMPORTDUPS", "@@DUPCOMBINE"); //IMPORTDUPS Starts xw.WriteEndElement(); //STATICVARIBLES Ends xw.WriteEndElement(); //DESC Ends xw.WriteStartElement("DATA"); //DATA Starts xw.WriteStartElement("TALLYMESSAGE"); //TALLYMESSAGE Starts xw.WriteStartElement("LEDGER"); //LEDGER Starts xw.WriteElementString("NAME", "ICICI"); xw.WriteElementString("PARENT", "Bank Accounts"); xw.WriteElementString("OPENINGBALANCE", "12500"); xw.WriteEndElement(); //LEDGER Ends xw.WriteStartElement("GROUP"); //GROUP Starts xw.WriteElementString("NAME", "Bangalore Debtors"); xw.WriteElementString("PARENT", "Sundry Debtors"); xw.WriteEndElement(); //GROUP Ends xw.WriteStartElement("LEDGER"); //2ndLEDGER Starts xw.WriteElementString("NAME", "RK Builders Pvt Ltd"); xw.WriteElementString("PARENT", "Bangalore Debtors"); xw.WriteElementString("OPENINGBALANCE", "1000"); xw.WriteEndElement(); //2ndLEDGER Ends xw.WriteEndElement(); //TALLYMESSAGE Ends xw.WriteEndElement(); //DATA Ends xw.WriteEndElement(); //Body Ends xw.WriteEndElement(); //ENVELOPE Ends xw.WriteEndDocument(); xw.Close(); fs.Close(); MessageBox.Show("XML Is Created"); } } }Now in XML genration code i m unable to show this format
XML file XML nodes Adding Xml attributes
kavita_khand...
Star
9767 Points
1931 Posts
Re: Please Help
Dec 03, 2009 09:32 AM|LINK
I would love to change the world, but they wont give me the source code.
NiranjandotN...
Member
1 Points
5 Posts
Re: Please Help
Dec 03, 2009 10:00 AM|LINK
i just want to show <LEDGER NAME="ICICI" Action = "Create"> this output in my XML file through C# code...
i have already added orignal xml file at top and below that the code by which i m genrating the same XML file
please refer line no 18,24 and 29 in posted XML file i m unable to genrate exact line..please refer line no 45,52 and 57 in C# Code file
If there is any doubt please ask..
Thanks
XML file Adding Xml attributes XML nodes
kavita_khand...
Star
9767 Points
1931 Posts
Re: Please Help
Dec 03, 2009 11:04 AM|LINK
ok try this. Also see the bolded out lines.. as I assume you want name as attribute and not as element.
FileStream fs = new FileStream("C:\\XmlDemoFile.xml", FileMode.Create);
XmlTextWriter xw = new XmlTextWriter(fs, Encoding.UTF8);
xw.WriteStartDocument();
xw.WriteStartElement("ENVELOPE"); //ENVELOPE Starts
xw.WriteStartElement("HEADER"); //HEADER Starts
xw.WriteElementString("VERSION", "1");
xw.WriteElementString("TALLYREQUEST", "Import Data");
xw.WriteElementString("TYPE", "DATA");
xw.WriteElementString("ID", "All Masters");
xw.WriteEndElement(); //Header Ends
xw.WriteStartElement("BODY"); //Body Starts
xw.WriteStartElement("DESC"); //DESC Starts
xw.WriteStartElement("STATICVARIABLES"); //STATICVARIBLES Starts
xw.WriteElementString("IMPORTDUPS", "@@DUPCOMBINE"); //IMPORTDUPS Starts
xw.WriteEndElement(); //STATICVARIBLES Ends
xw.WriteEndElement(); //DESC Ends
xw.WriteStartElement("DATA"); //DATA Starts
xw.WriteStartElement("TALLYMESSAGE"); //TALLYMESSAGE Starts
xw.WriteStartElement("LEDGER"); //LEDGER Starts
xw.WriteAttributeString("NAME", "ICICI");
xw.WriteAttributeString("ACTION", "Create");
xw.WriteElementString("PARENT", "Bank Accounts");
xw.WriteElementString("OPENINGBALANCE", "12500");
xw.WriteEndElement(); //LEDGER Ends
xw.WriteStartElement("GROUP"); //GROUP Starts
xw.WriteAttributeString("NAME", "Bangalore Debtors");
xw.WriteElementString("PARENT", "Sundry Debtors");
xw.WriteEndElement(); //GROUP Ends
xw.WriteStartElement("LEDGER"); //2ndLEDGER Starts
xw.WriteAttributeString("NAME", "RK Builders Pvt Ltd");
xw.WriteAttributeString("ACTION", "Create");
xw.WriteElementString("PARENT", "Bangalore Debtors");
xw.WriteElementString("OPENINGBALANCE", "1000");
xw.WriteEndElement(); //2ndLEDGER Ends
xw.WriteEndElement(); //TALLYMESSAGE Ends
xw.WriteEndElement(); //DATA Ends
xw.WriteEndElement(); //Body Ends
xw.WriteEndElement(); //ENVELOPE Ends
xw.WriteEndDocument();
xw.Close();
fs.Close();
I would love to change the world, but they wont give me the source code.
NiranjandotN...
Member
1 Points
5 Posts
Re: Please Help
Dec 04, 2009 05:00 AM|LINK
Thanks Kavita you have almost solved my problem.. I m making a converter by which i can convert sql database's selected
data into TALLY compatible XML format, to import the data in tally from Sql Server database. I have got a site named www.rtslink.com
for Tally integration..they are providing a DLL through which we can convert our database in our Tally compatible xml file..i dont
want to use that DLL because they are charging for it.. With your help i m able to convert database into XML file but to import
this XML file i have to depend on TALLY ..in tally they have a option of IMPORT MASTER and IMPORT TRANSCATIONS through which
we can give the path of XML file and records will be imported . Now i dont want to depend on tally .. If i want to make a s/w
in which i can also give the option to IMPORT created XML file directly into tally then can u tell me what are the functions i can
use to import the XML file directly into tally through C# code? IF U HAVE ANY PROBLEM THEN PLEASE ASK ME Thanks !!
kavita_khand...
Star
9767 Points
1931 Posts
Re: Please Help
Dec 04, 2009 05:09 AM|LINK
I am afraid I cant help much on this.. as I have to go through some of API's in c# which support this import functionality.. But i am sure you would find answer fot it in some other forums.
I would love to change the world, but they wont give me the source code.
NiranjandotN...
Member
1 Points
5 Posts
Re: Please Help
Dec 04, 2009 05:45 AM|LINK
Thanks Kavita..for ur intrest ..i will search in some other forum..but by anyhow if u come to know about these function from any where then please dont forget to tell me...
Thanks
LD JAMES
Member
2 Points
2 Posts
Re: Please Help
Oct 31, 2012 07:34 AM|LINK
Hi Kavita, nice post...
I tried it and it worked perfectly...
Can you tell me how to insert data into an existing ledger or group in Tally