Export Item-wise stock summary from Tally ERP 9 - tally

I am working with Tally ERP 9 (Accounting software) for export stock summary report.
I am able to export stock summary report through below xml request
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Stock Summary</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVCURRENTCOMPANY>Global Trading Corporation</SVCURRENTCOMPANY>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
Now My question is How to export Stock Summary -> F5(Item-wise) report using xml request?

I am able to get Item Wise Stock Summary by by setting 'IsItemWise' variable as 'Yes'.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Stock Summary</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVCURRENTCOMPANY>Global Trading Corporation</SVCURRENTCOMPANY>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<REPORT NAME="Stock Summary" ISMODIFY="Yes" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No">
<SET>IsItemWise: Yes</SET>
</REPORT>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>

Related

How to export employees from tally in XML format?

How to export employees & employee groups from tally in XML format?
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>CostCenters</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<COLLECTION ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No" NAME="CostCenters">
<TYPE>CostCenter</TYPE>
<NATIVEMETHOD>*</NATIVEMETHOD>
<FILTERS>filter</FILTERS>
</COLLECTION>
<SYSTEM TYPE="Formulae" NAME="filter">ISEMPLOYEEGROUP="NO"</SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
I tried by using above mentioned code. But its response looks like below:
<DATA><COLLECTION ISMSTDEPTYPE="Yes" MSTDEPTYPE="4"> </COLLECTION></DATA>
But, when I tried without filter, it provides all employees & employee group
Your Filter is wrong
you should prefix $ for ISEMPLOYEEGROUP
<SYSTEM TYPE="Formulae" NAME="filter">$ISEMPLOYEEGROUP="NO"</SYSTEM>
or
<SYSTEM TYPE="Formulae" NAME="filter">Not $ISEMPLOYEEGROUP</SYSTEM>
to get employee groups above filter works
If you want employees add another filter
<SYSTEM TYPE="Formulae" NAME="IsPayroll">$FORPAYROLL</SYSTEM>

Tally XML Get GST Rate Setup by Stock Group

I am able to get the GST rates grouped by Stock Group using the below XML, but How do i pass the stock group in this request so that i can get GST Rates for items under the particular stock group
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>GST Rate Setup</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>*</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
I tried to pass the stock group name using static variables, but since i don't know the variable name, i am getting nowhere.
We can create Custom reports by extending existing reports in TDL definition
In below xml I extended GST Rate Setup by mentioning in use Tag
To known the variable used in report we need to refer TDL code which is available in TDL Developer Application
Here we are overwriting Stock Group Name by setting testgroup
Replace testgroup with whatever group youwant
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Cust GST Rate Setup</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVShowAll>No</SVShowAll >
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<Report ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No" NAME="Cust GST Rate Setup">
<Use>GST Rate Setup</Use>
<Set>Stock Group Name:testgroup</Set>
<Form>GST Rate Setup</Form>
</Report>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>

How to retrieve GSTN of a company : Tally XML integration

Trying to retrieve the GSTIN of the active company in Tally ERP. Making a POST call using the following **<FETCH>Gstnotificationnumber</FETCH>** command
But no data is returned as part of the response under **<DATA>** output given below
Any help would be really great!!
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>COMPANY</SUBTYPE>
<ID TYPE="Name">Example Company Name</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>Gstnotificationnumber</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
Output From Tally ERP which is missing Gstnotificationnumber from the COMPANY object
Tally Object Schema - (For Reference)
<DATA>
<TALLYMESSAGE>
<COMPANY NAME="Example Company Name" RESERVEDNAME="" REQNAME="Example Company Name">
<NAME TYPE="String">Example Company Name</NAME>
<ISDEEMEDPOSITIVE TYPE="Logical"></ISDEEMEDPOSITIVE>
<CANDELETE TYPE="Logical">No</CANDELETE>
<MASTERID TYPE="Number"> 29</MASTERID>
</COMPANY>
</TALLYMESSAGE>
</DATA>
So the GSTIN number in Tally is not a field belonging to the Company Object. Some of the fields belonging to the Company Object are Address, Phone Number, Email, State etc. For example, modify the <FETCH> tag to have Address and the <DATA> tag in the response will give you the required details.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>COMPANY</SUBTYPE>
<ID TYPE="Name">Example Company Name</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>Address</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
If you look deep into the Tally database structure, the GSTIN Number belongs to the Tax Unit Object. Assuming that default configurations have not been changed for a sample company, the Tax Unit object is usually 'Default Tax Unit'. Now you can query the Tax Unit Object for the company and fetch the GSTIN.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>Tax Unit</SUBTYPE>
<ID TYPE="Name">Default Tax Unit</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>GSTRegNumber</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
If you're getting errors in the Tax Unit, it's easier to just use the in-built code to get what you need. There's two ways you can get the GSTIN Number:
By using the formula - CMPGSTaxNumber
By using the direct Object-Method notation : $GSTRegNumber:TaxUnit:##CMPExcisePrimaryGodown
To get these in your XML, you would need to add TDL code within <TDL></TDL> tags in your SOAP request.
A sample is below, if you're interested in reading how the TDL Report structure works, you can refer this document by Tally Solutions.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>GSTReport</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<REPORT NAME="GSTReport">
<FORM>GSTReportForm</FORM>
</REPORT>
<FORM NAME="GSTReportForm">
<PART>GSTReportPart</PART>
</FORM>
<PART NAME="GSTReportPart">
<LINE>GSTReportLine</LINE>
<SCROLLED>Vertical</SCROLLED>
</PART>
<LINE NAME="GSTReportLine">
<FIELDS>GSTNumber</FIELDS>
</LINE>
<FIELD NAME="GSTNumber">
<SET>$GSTRegNumber:TaxUnit:##CMPExcisePrimaryGodown</SET>
</FIELD>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>

XML format for Deleting tally voucher

Below is the xml with which I'm trying to delete voucher in tally:
<envelope>
<header>
<version>
1
</version>
<tallyrequest>
Import
</tallyrequest>
<type>
Data
</type>
<id>
Vouchers
</id>
</header>
<desc>
</desc>
<data>
<tallymessage>
<voucher action="Delete" date="01-Jan-2019" tagname="Voucher Number" tagvalue="3" vchtype="Journal">
</voucher>
</tallymessage>
</data>
</envelope>
But I'm getting this error on posting the xml although voucher number 3 with date 2019-01-01 is present in tally:
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<STATUS>0</STATUS>
</HEADER>
<BODY>
<DATA>
DESC not found </DATA>
</BODY>
</ENVELOPE>
Earlier the xml was working. For some reason it's not working now.
the only change i made to your xml was changing id to All Masters
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Import</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>All Masters</ID>
</HEADER>
<BODY>
<DESC>
</DESC>
<DATA>
<TALLYMESSAGE>
<VOUCHER DATE="01-May-2019" TAGNAME = "Voucher Number" TAGVALUE="1234" VCHTYPE = "Sales" ACTION="Delete">
<NARRATION>Deleted by Mitalee
</NARRATION>
</VOUCHER>
</TALLYMESSAGE>
This is the response I got:
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<STATUS>1</STATUS>
</HEADER>
<BODY>
<DATA>
<IMPORTRESULT>
<CREATED>0</CREATED>
<ALTERED>0</ALTERED>
<DELETED>1</DELETED>
<LASTVCHID>0</LASTVCHID>
<LASTMID>0</LASTMID>
<COMBINED>0</COMBINED>
<IGNORED>0</IGNORED>
<ERRORS>0</ERRORS>
<CANCELLED>0</CANCELLED>
</IMPORTRESULT>
</DATA>
<DESC>
<CMPINFO>
<COMPANY>0</COMPANY>.....
Couple of things you could do:
Check if the journal voucher actually exists. Try it for sales, purchase, etc. after verifying that the voucher is already present.
Check if educational mode is interfering with your xml request. You could have a friend run the xml on a licensed version of Tally.
Check the company and dates selected for this voucher number.

Can JSTL transform XML encoded in UTF-8?

I am making a simple JSP application to transform XML data into HTML.
I use JSTL and my XML data is encoded in UTF-8. It works, but the danish characters look strange in the browser.
Like this:
Danish characters written directly in jsp: ÆØÅ æøå
Same danish characters transformed with jstl:
character: Æ character: æ
character: Ø character: ø
character: Å character: å
However, if I manually change the xml definition like so:
<?xml version="1.0" encoding="ISO-8859-1" ?>
The output is transformed properly.
Should I set up JSTL in some way to handle UTF-8, or is it,that my file is actually latin1 encoded by mistake? I do not know how to check this...
Here is my test xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<rows>
<row>
<name>character: Æ</name>
<surname>character: æ</surname>
</row>
<row>
<name>character: Ø</name>
<surname>character: ø</surname>
</row>
<row>
<name>character: Å</name>
<surname>character: å</surname>
</row>
</rows>
Here is my xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="0">
<xsl:for-each select="rows/row">
<tr>
<td>
<xsl:value-of select="name" />
</td>
<td>
<xsl:value-of select="surname" />
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
My index.jsp:
<?xml version="1.0" encoding="UTF-8" ?>
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%# taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
Written directly in jsp: ÆØÅ æøå
<h3>xml transformed with jstl:</h3>
<c:import url="/Test.xsl" var="xsltdoc" />
<c:import url="/Test.xml" var="xmldoc" />
<x:transform xml="${xmldoc}" xslt="${xsltdoc}" />
</body>
</html>
I am using JSTL libraries (Implementation-Version: 1.2) on JBOSS AP 4.2.3.
Ok, I checked the encoding of my xml data here, and it is correct, that it is UTF-8 encoded.
Apparently, in index.jsp JSTL must be set to use UTF-8 like so
<c:import url="/Metadata1.xsl" var="xsltdoc" charEncoding="UTF-8" />
<c:import url="/Metadata1.xml" var="xmldoc" charEncoding="UTF-8" />
This solves my problem.