title: How to import accounting voucher in tally erp 9
body: <p>How to import accounting voucher with item, quantity, rate and amount in tally ERP 9.</p>
  
  <p>I am developing an android application which should transfer the inventory data to Tally. so far i've managed to send the data to tally using PHP, but tally imports all the data except quantity and rate.</p>
  
  <p>here is the code :</p>
  
  <pre><code>    `&lt;form action="" method="post"&gt;
       &lt;table width="100%" border="1"&gt;
           &lt;tr&gt;
             &lt;th scope="col"&gt;Name&lt;/th&gt;
             &lt;td&gt;&lt;input name="nm" id="nm" type="text" /&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
             &lt;td colspan="4"&gt;&lt;div align="center"&gt;
                 &lt;label&gt;
                    &lt;input type="submit" name="Submit" value="Submit" /&gt;
                &lt;/label&gt;
              &lt;/div&gt;&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
        &lt;/form&gt;
  
  &lt;?php
  /* This is PHP code to insert an entry in Tally. All required XML tags by Tally are taken here in a string and name for Ledger is taken by posted value from HTML form. */
  
  
  if(isset($_POST['Submit']))
      {
          $name = $_POST['nm'];
          $requestXML = '
          &lt;ENVELOPE&gt;
          &lt;HEADER&gt;
          &lt;TALLYREQUEST&gt;Import Data&lt;/TALLYREQUEST&gt;
          &lt;/HEADER&gt;
          &lt;BODY&gt;
          &lt;IMPORTDATA&gt;
          &lt;REQUESTDESC&gt;
          &lt;REPORTNAME&gt;All Masters&lt;/REPORTNAME&gt;
          &lt;STATICVARIABLES&gt;
          &lt;SVCURRENTCOMPANY&gt;PYROTECH ENGINEERS 2015-16&lt;/SVCURRENTCOMPANY&gt;
          &lt;/STATICVARIABLES&gt;
          &lt;/REQUESTDESC&gt;
          &lt;REQUESTDATA&gt;
          &lt;TALLYMESSAGE xmlns:UDF="TallyUDF"&gt;
          &lt;VOUCHER VCHTYPE="Sales of Job Work" ACTION="Create"&gt;
          &lt;DATE&gt;20151001&lt;/DATE&gt;
          &lt;PARTYNAME&gt;PAVANI ENGINEERS&lt;/PARTYNAME&gt;
          &lt;VOUCHERTYPENAME&gt;Sales of Job Work&lt;/VOUCHERTYPENAME&gt;
          &lt;VOUCHERNUMBER&gt;1&lt;/VOUCHERNUMBER&gt;
          &lt;REFERENCE&gt;666&lt;/REFERENCE&gt;
          &lt;PARTYLEDGERNAME&gt;PAVANI ENGINEERS&lt;/PARTYLEDGERNAME&gt;
          &lt;BASICBASEPARTYNAME&gt;PAVANI ENGINEERS&lt;/BASICBASEPARTYNAME&gt;
          &lt;FBTPAYMENTTYPE&gt;Default&lt;/FBTPAYMENTTYPE&gt;
          &lt;PERSISTEDVIEW&gt;Invoice Voucher View&lt;/PERSISTEDVIEW&gt;
          &lt;BASICBUYERNAME&gt;PAVANI ENGINEERS&lt;/BASICBUYERNAME&gt;
          &lt;LEDGERENTRIES.LIST&gt;
          &lt;LEDGERNAME&gt;PAVANI ENGINEERS&lt;/LEDGERNAME&gt;
          &lt;ISDEEMEDPOSITIVE&gt;Yes&lt;/ISDEEMEDPOSITIVE&gt;
          &lt;LEDGERFROMITEM&gt;No&lt;/LEDGERFROMITEM&gt;
          &lt;REMOVEZEROENTRIES&gt;No&lt;/REMOVEZEROENTRIES&gt;
          &lt;ISPARTYLEDGER&gt;Yes&lt;/ISPARTYLEDGER&gt;                        
          &lt;ISLASTDEEMEDPOSITIVE&gt;Yes&lt;/ISLASTDEEMEDPOSITIVE&gt;
          &lt;AMOUNT&gt;-193.20&lt;/AMOUNT&gt;
          &lt;/LEDGERENTRIES.LIST&gt;
          &lt;ALLINVENTORYENTRIES.LIST&gt;
          &lt;STOCKITEMNAME&gt;MY ITEM1&lt;/STOCKITEMNAME&gt;
          &lt;ISDEEMEDPOSITIVE&gt;No&lt;/ISDEEMEDPOSITIVE&gt;
          &lt;ISLASTDEEMEDPOSITIVE&gt;No&lt;/ISLASTDEEMEDPOSITIVE&gt;
          &lt;ISAUTONEGATE&gt;No&lt;/ISAUTONEGATE&gt;
          &lt;ISCUSTOMSCLEARANCE&gt;No&lt;/ISCUSTOMSCLEARANCE&gt;
          &lt;ISTRACKCOMPONENT&gt;No&lt;/ISTRACKCOMPONENT&gt;
          &lt;ISTRACKPRODUCTION&gt;No&lt;/ISTRACKPRODUCTION&gt;
          &lt;ISPRIMARYITEM&gt;No&lt;/ISPRIMARYITEM&gt;
          &lt;ISSCRAP&gt;No&lt;/ISSCRAP&gt;
          &lt;RATE&gt;21.00/KGS&lt;/RATE&gt;
          &lt;AMOUNT&gt;193.20&lt;/AMOUNT&gt;
          &lt;ACTUALQTY&gt; 9.200 KGS =  50.00 QTY&lt;/ACTUALQTY&gt;
          &lt;BILLEDQTY&gt; 9.200 KGS =  50.00 QTY&lt;/BILLEDQTY&gt;
          &lt;BATCHALLOCATIONS.LIST&gt;
          &lt;GODOWNNAME&gt;Main Location&lt;/GODOWNNAME&gt;
          &lt;BATCHNAME&gt;Primary Batch&lt;/BATCHNAME&gt;
          &lt;DESTINATIONGODOWNNAME&gt;Main Location&lt;/DESTINATIONGODOWNNAME&gt;
          &lt;INDENTNO/&gt;
          &lt;ORDERNO/&gt;
          &lt;TRACKINGNUMBER/&gt;
          &lt;DYNAMICCSTISCLEARED&gt;No&lt;/DYNAMICCSTISCLEARED&gt;
          &lt;AMOUNT&gt;193.20&lt;/AMOUNT&gt;
          &lt;ACTUALQTY&gt; 9.200 KGS =  50.00 QTY&lt;/ACTUALQTY&gt;
          &lt;BILLEDQTY&gt; 9.200 KGS =  50.00 QTY&lt;/BILLEDQTY&gt;
          &lt;ADDITIONALDETAILS.LIST&gt; &lt;/ADDITIONALDETAILS.LIST&gt;
          &lt;VOUCHERCOMPONENTLIST.LIST&gt; &lt;/VOUCHERCOMPONENTLIST.LIST&gt;
          &lt;/BATCHALLOCATIONS.LIST&gt;
          &lt;ACCOUNTINGALLOCATIONS.LIST&gt;
          &lt;OLDAUDITENTRYIDS.LIST TYPE="Number"&gt;
          &lt;OLDAUDITENTRYIDS&gt;-1&lt;/OLDAUDITENTRYIDS&gt;
          &lt;/OLDAUDITENTRYIDS.LIST&gt;
          &lt;LEDGERNAME&gt;LABOUR CHARGES RECEIVED&lt;/LEDGERNAME&gt;
          &lt;GSTCLASS/&gt;
          &lt;ISDEEMEDPOSITIVE&gt;No&lt;/ISDEEMEDPOSITIVE&gt;
          &lt;LEDGERFROMITEM&gt;No&lt;/LEDGERFROMITEM&gt;
          &lt;REMOVEZEROENTRIES&gt;No&lt;/REMOVEZEROENTRIES&gt;
          &lt;ISPARTYLEDGER&gt;No&lt;/ISPARTYLEDGER&gt;
          &lt;ISLASTDEEMEDPOSITIVE&gt;No&lt;/ISLASTDEEMEDPOSITIVE&gt;
          &lt;AMOUNT&gt;193.20&lt;/AMOUNT&gt;
          &lt;BANKALLOCATIONS.LIST&gt; &lt;/BANKALLOCATIONS.LIST&gt;
          &lt;BILLALLOCATIONS.LIST&gt; &lt;/BILLALLOCATIONS.LIST&gt;
          &lt;INTERESTCOLLECTION.LIST&gt; &lt;/INTERESTCOLLECTION.LIST&gt;
          &lt;OLDAUDITENTRIES.LIST&gt; &lt;/OLDAUDITENTRIES.LIST&gt;
          &lt;ACCOUNTAUDITENTRIES.LIST&gt; &lt;/ACCOUNTAUDITENTRIES.LIST&gt;
          &lt;AUDITENTRIES.LIST&gt; &lt;/AUDITENTRIES.LIST&gt;
          &lt;TAXBILLALLOCATIONS.LIST&gt; &lt;/TAXBILLALLOCATIONS.LIST&gt;
          &lt;TAXOBJECTALLOCATIONS.LIST&gt; &lt;/TAXOBJECTALLOCATIONS.LIST&gt;
          &lt;TDSEXPENSEALLOCATIONS.LIST&gt; &lt;/TDSEXPENSEALLOCATIONS.LIST&gt;
          &lt;VATSTATUTORYDETAILS.LIST&gt; &lt;/VATSTATUTORYDETAILS.LIST&gt;
          &lt;COSTTRACKALLOCATIONS.LIST&gt; &lt;/COSTTRACKALLOCATIONS.LIST&gt;
          &lt;/ACCOUNTINGALLOCATIONS.LIST&gt;
          &lt;TAXOBJECTALLOCATIONS.LIST&gt; &lt;/TAXOBJECTALLOCATIONS.LIST&gt;
          &lt;EXCISEALLOCATIONS.LIST&gt; &lt;/EXCISEALLOCATIONS.LIST&gt;
          &lt;EXPENSEALLOCATIONS.LIST&gt; &lt;/EXPENSEALLOCATIONS.LIST&gt;
          &lt;/ALLINVENTORYENTRIES.LIST&gt;
          &lt;/VOUCHER&gt;
          &lt;/TALLYMESSAGE&gt;
          &lt;/REQUESTDATA&gt;
          &lt;/IMPORTDATA&gt;
          &lt;/BODY&gt;
          &lt;/ENVELOPE&gt;';
  
  /* Actual code for importing goes here */
          $server = 'localhost:9002';
          $headers = array( "Content-type: text/xml" ,"Content-length: ".strlen($requestXML) ,"Connection: close" );
  
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $server);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_TIMEOUT, 100);
          curl_setopt($ch, CURLOPT_POST, true);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXML);
          curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
          $data = curl_exec($ch);
  
          if(curl_errno($ch)){
              print curl_error($ch);
              echo "  something went wrong..... try later";
          }else{
              echo " request accepted";
              print $data;
              curl_close($ch);
          }
      }
  
  ?&gt;`
  </code></pre>