-1

I want to get the tally custom (user defined report)report data using xml. Like:- Get the Outstandings report, Purchase Bills Pending, Sales Bills Pending report etc.

<ENVELOPE>  
  <HEADER>  
    <TALLYREQUEST>Export Data</TALLYREQUEST>  
  </HEADER>  
  <BODY>  
    <EXPORTDATA>  
      <REQUESTDESC>  
        <!-- Specify the Report Name here -->  
        <REPORTNAME>My Own Report</REPORTNAME>  
        <STATICVARIABLES>  
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>  
        </STATICVARIABLES>  
      </REQUESTDESC>  
    </EXPORTDATA>  
  </BODY>  
</ENVELOPE>
  • 1
    Try to keep your sample code what you have done so far to achieve it. – Kundan Atre Jun 17 '19 at 06:48
  • Possible duplicate of [How do you parse and process HTML/XML in PHP?](https://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – hanshenrik Jun 17 '19 at 12:52

2 Answers2

0

read How do you parse and process HTML/XML in PHP? , there's plenty of ways to parse XML in PHP. for example, in your case, to get the REPORTNAME one could use DOMDocument,

$domd=@DOMDocument::loadHTML($xml);
$report_name=$domd->getElementsByTagName("REPORTNAME")->item(0)->textContent;
hanshenrik
  • 19,904
  • 4
  • 43
  • 89
0

Here's a link for how to request a report via XML:

The code is as below. You would need replace the tag to have the name of your custom report.

<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Trial Balance</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
  • Assuming you have a way to ping Tally via their port (usually localhost:9000), either via CURL or PHP. A simple way to do this is to store this XML in a file (say my_report.xml), install curl and then just run the command

    curl -X POST localhost:9000 --data @my_report.xml

  • The custom report should also be loaded via TDL in Tally for this to work.

Mitalee Rao
  • 191
  • 6