How to export employees from tally in XML format? - tally

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>

Related

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.

Export Item-wise stock summary from Tally ERP 9

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>

Wikipedia API: how to retrieve multiple titles AND resolve redirects in 1 call?

It appears from the MediaWiki API:Query page that you can only resolve a redirect one at a time.
The document even says "The example below isn't really useful because it doesn't use any query modules, but shows how the redirects parameter works."
But how can you get the redirect information -- using a query module that does return multiple results?
If you have any result that returns pages, then you can just append redirects to the query and it resolves the redirects. If you don't have results that returns pages, you can usually convert it to that by using a generator.
For example, the query
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Redirects_from_gender&redirects
returns something like (shortened)
<api>
<query>
<categorymembers>
<cm pageid="648" ns="0" title="Actress" />
<cm pageid="19887132" ns="0" title="Administratrix" />
</categorymembers>
</query>
</api>
If you convert that into a generator
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender
you get
<api>
<query>
<pages>
<page pageid="648" ns="0" title="Actress" />
<page pageid="19887132" ns="0" title="Administratrix" />
</pages>
</query>
</api>
And if you now add redirects
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender&redirects
you get
<api>
<query>
<redirects>
<r from="Actress" to="Actor" />
<r from="Administratrix" to="Administrator (law)" />
</redirects>
<pages>
<page pageid="21504235" ns="0" title="Actor" />
<page pageid="6676496" ns="0" title="Administrator (law)" />
</pages>
</query>
</api>
You can also use prop=redirects with any generator, e.g. generator=allpages. This is a new feature since MW-1.23, fixing bug T59057.
When using generator=allpages with max limits (gaplimit=max and rdlimit=max) and apihighlimits right is available, all redirects on ArchWiki are resolved in a single query ;)
https://wiki.archlinux.org/api.php?action=query&generator=allpages&gapfilterredir=nonredirects&gaplimit=max&prop=redirects&rdprop=pageid|title|fragment&rdlimit=max