如何在理货erp 9中导入会计凭证

时间:2015-10-08 10:07:16

标签: php android

如何在计算ERP 9中导入包含项目,数量,费率和金额的会计凭证。

我正在开发一个Android应用程序,它应该将库存数据传输到Tally。到目前为止,我已经设法使用PHP将数据发送到计数器,但是计算了除数量和速率之外的所有数据。

这是代码:

    `<form action="" method="post">
     <table width="100%" border="1">
         <tr>
           <th scope="col">Name</th>
           <td><input name="nm" id="nm" type="text" /></td>
         </tr>
         <tr>
           <td colspan="4"><div align="center">
               <label>
                  <input type="submit" name="Submit" value="Submit" />
              </label>
            </div></td>
          </tr>
        </table>
      </form>

<?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 = '
        <ENVELOPE>
        <HEADER>
        <TALLYREQUEST>Import Data</TALLYREQUEST>
        </HEADER>
        <BODY>
        <IMPORTDATA>
        <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
        <SVCURRENTCOMPANY>PYROTECH ENGINEERS 2015-16</SVCURRENTCOMPANY>
        </STATICVARIABLES>
        </REQUESTDESC>
        <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
        <VOUCHER VCHTYPE="Sales of Job Work" ACTION="Create">
        <DATE>20151001</DATE>
        <PARTYNAME>PAVANI ENGINEERS</PARTYNAME>
        <VOUCHERTYPENAME>Sales of Job Work</VOUCHERTYPENAME>
        <VOUCHERNUMBER>1</VOUCHERNUMBER>
        <REFERENCE>666</REFERENCE>
        <PARTYLEDGERNAME>PAVANI ENGINEERS</PARTYLEDGERNAME>
        <BASICBASEPARTYNAME>PAVANI ENGINEERS</BASICBASEPARTYNAME>
        <FBTPAYMENTTYPE>Default</FBTPAYMENTTYPE>
        <PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>
        <BASICBUYERNAME>PAVANI ENGINEERS</BASICBUYERNAME>
        <LEDGERENTRIES.LIST>
        <LEDGERNAME>PAVANI ENGINEERS</LEDGERNAME>
        <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
        <LEDGERFROMITEM>No</LEDGERFROMITEM>
        <REMOVEZEROENTRIES>No</REMOVEZEROENTRIES>
        <ISPARTYLEDGER>Yes</ISPARTYLEDGER>                        
        <ISLASTDEEMEDPOSITIVE>Yes</ISLASTDEEMEDPOSITIVE>
        <AMOUNT>-193.20</AMOUNT>
        </LEDGERENTRIES.LIST>
        <ALLINVENTORYENTRIES.LIST>
        <STOCKITEMNAME>MY ITEM1</STOCKITEMNAME>
        <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
        <ISLASTDEEMEDPOSITIVE>No</ISLASTDEEMEDPOSITIVE>
        <ISAUTONEGATE>No</ISAUTONEGATE>
        <ISCUSTOMSCLEARANCE>No</ISCUSTOMSCLEARANCE>
        <ISTRACKCOMPONENT>No</ISTRACKCOMPONENT>
        <ISTRACKPRODUCTION>No</ISTRACKPRODUCTION>
        <ISPRIMARYITEM>No</ISPRIMARYITEM>
        <ISSCRAP>No</ISSCRAP>
        <RATE>21.00/KGS</RATE>
        <AMOUNT>193.20</AMOUNT>
        <ACTUALQTY> 9.200 KGS =  50.00 QTY</ACTUALQTY>
        <BILLEDQTY> 9.200 KGS =  50.00 QTY</BILLEDQTY>
        <BATCHALLOCATIONS.LIST>
        <GODOWNNAME>Main Location</GODOWNNAME>
        <BATCHNAME>Primary Batch</BATCHNAME>
        <DESTINATIONGODOWNNAME>Main Location</DESTINATIONGODOWNNAME>
        <INDENTNO/>
        <ORDERNO/>
        <TRACKINGNUMBER/>
        <DYNAMICCSTISCLEARED>No</DYNAMICCSTISCLEARED>
        <AMOUNT>193.20</AMOUNT>
        <ACTUALQTY> 9.200 KGS =  50.00 QTY</ACTUALQTY>
        <BILLEDQTY> 9.200 KGS =  50.00 QTY</BILLEDQTY>
        <ADDITIONALDETAILS.LIST> </ADDITIONALDETAILS.LIST>
        <VOUCHERCOMPONENTLIST.LIST> </VOUCHERCOMPONENTLIST.LIST>
        </BATCHALLOCATIONS.LIST>
        <ACCOUNTINGALLOCATIONS.LIST>
        <OLDAUDITENTRYIDS.LIST TYPE="Number">
        <OLDAUDITENTRYIDS>-1</OLDAUDITENTRYIDS>
        </OLDAUDITENTRYIDS.LIST>
        <LEDGERNAME>LABOUR CHARGES RECEIVED</LEDGERNAME>
        <GSTCLASS/>
        <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
        <LEDGERFROMITEM>No</LEDGERFROMITEM>
        <REMOVEZEROENTRIES>No</REMOVEZEROENTRIES>
        <ISPARTYLEDGER>No</ISPARTYLEDGER>
        <ISLASTDEEMEDPOSITIVE>No</ISLASTDEEMEDPOSITIVE>
        <AMOUNT>193.20</AMOUNT>
        <BANKALLOCATIONS.LIST> </BANKALLOCATIONS.LIST>
        <BILLALLOCATIONS.LIST> </BILLALLOCATIONS.LIST>
        <INTERESTCOLLECTION.LIST> </INTERESTCOLLECTION.LIST>
        <OLDAUDITENTRIES.LIST> </OLDAUDITENTRIES.LIST>
        <ACCOUNTAUDITENTRIES.LIST> </ACCOUNTAUDITENTRIES.LIST>
        <AUDITENTRIES.LIST> </AUDITENTRIES.LIST>
        <TAXBILLALLOCATIONS.LIST> </TAXBILLALLOCATIONS.LIST>
        <TAXOBJECTALLOCATIONS.LIST> </TAXOBJECTALLOCATIONS.LIST>
        <TDSEXPENSEALLOCATIONS.LIST> </TDSEXPENSEALLOCATIONS.LIST>
        <VATSTATUTORYDETAILS.LIST> </VATSTATUTORYDETAILS.LIST>
        <COSTTRACKALLOCATIONS.LIST> </COSTTRACKALLOCATIONS.LIST>
        </ACCOUNTINGALLOCATIONS.LIST>
        <TAXOBJECTALLOCATIONS.LIST> </TAXOBJECTALLOCATIONS.LIST>
        <EXCISEALLOCATIONS.LIST> </EXCISEALLOCATIONS.LIST>
        <EXPENSEALLOCATIONS.LIST> </EXPENSEALLOCATIONS.LIST>
        </ALLINVENTORYENTRIES.LIST>
        </VOUCHER>
        </TALLYMESSAGE>
        </REQUESTDATA>
        </IMPORTDATA>
        </BODY>
        </ENVELOPE>';

/* 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);
        }
    }

?>`

1 个答案:

答案 0 :(得分:0)

事实证明我的代码没有问题,问题出在我的客户理货凭证模板上。在标准计数会计凭证中导入此代码可正确插入数据。