Search code examples
integrationtally

Verify vouchers integrated into tally from staging table


If I have 5 vouchers in SQL server database staging table and I imported all 5 vouchers in tally using tally XML API.

How can I verify and cross check the vouchers between tally and SQL using only voucher number?

Do I have to read entire voucher summary from tally and then extract voucher numbers from the XML data ? After extracting voucher numbers I can compare it to staging table.

How can I just export only voucher number or one specific field from a report in tally ?


Solution

  • Do you know the voucher number after importing into Tally? Depending on the answer to this, I'll update my answer.

    Case 1: If you do know the voucher number, you can use Tally XML to request for that particular voucher number and if you get a positive response, then that voucher exists in tally. No need to read voucher summary. You'll just need to look for a particular element tag in XML response - if that element exists = voucher exists.

    Case 2: But I assume you don't know the voucher number that was created during the import. In that case. It'll be a bit more tricky. Let me know and I'll update with whatever solution I have.

    --Update--

    After discussing (see comments), I'm updating the answer as per Case 1. XML Request Structure -

    <ENVELOPE>
      <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>EXPORT</TALLYREQUEST>
        <TYPE>COLLECTION</TYPE>
        <ID>FindParticularVoucher</ID>
      </HEADER>
      <BODY>
        <DESC>
          <STATICVARIABLES>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
            <SVCURRENTCOMPANY>FOO COMPANY</SVCURRENTCOMPANY>
            <VCHNO>ABC1234</VCHNO>
          </STATICVARIABLES>
          <TDL>
            <TDLMESSAGE>
              <COLLECTION NAME="FindParticularVoucher" ISINITIALIZE="YES">
                <TYPE>Voucher</TYPE>
                <FILTER>GetInvoiceVoucher</FILTER>
              </COLLECTION>
              <VARIABLE NAME="VCHNO">
                <TYPE>String</TYPE>
              </VARIABLE>
              <SYSTEM TYPE="FORMULAE" NAME="GetInvoiceVoucher">$VoucherNumber = $$String:##VCHNO</SYSTEM>
            </TDLMESSAGE>
          </TDL>
        </DESC>
      </BODY>
    </ENVELOPE>
    

    Remember to change the Company name & Voucher Number within the SVCURRENTCOMPANY and VCHNO Xml Tags.

    You might get a complex XML Response. All you need to do is look for the XML Node named Voucher within the Collection Node - Envelope/Body/Data/Collection/Voucher. If this VoucherNode exists = your voucher exists in tally. In this case you don't need to export any data or the voucher number.