Export Credit & Debit Balance for ledgers while exporting from tally.

Discussion in 'Tally Integration' started by Rutal Jadav, Nov 25, 2022.

    
  1. Rutal Jadav

    Rutal Jadav Member


    Is it possible to export Credit & Debit Balance from the tally along with the Opening Balance and Closing Balance of Ledgers?
    For example, I have one sundry creditor ledger Named Purchase Ledger with Opening Balance 5000. After purchasing 590 items. I want the below-expected result.

    <OPENINGBALANCE>5000</OPENINGBALANCE>
    <CLOSINGBALANCE>5590</CLOSINGBALANCE>
    <DEBITBALANCE>0</DEBITBALANCE>
    <CREDITBALANCE>590</CREDITBALANCE>

    I am using the below mention XML to export the ledger's details from the tally.

    <ENVELOPE>
    <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Collection</TYPE>
    <ID>CustMasterColl</ID>
    </HEADER>
    <BODY>
    <DESC>
    <STATICVARIABLES>
    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
    <SVCURRENTCOMPANY>Company Name</SVCURRENTCOMPANY>
    </STATICVARIABLES>
    <TDL>
    <TDLMESSAGE>
    <COLLECTION ISMODIFY="No" ISFIXED="No" ISINITIALIZE="Yes" ISOPTION="No" ISINTERNAL="No" NAME="CustMasterColl">
    <TYPE>Ledger</TYPE>
    <FETCH>OPENINGBALANCE,CLOSINGBALANCE</FETCH>
    <FILTERS>AlterIdFilter</FILTERS>
    </COLLECTION>
    <SYSTEM TYPE="Formulae" NAME="AlterIdFilter">$AlterID &gt; 0</SYSTEM>
    </TDLMESSAGE>
    </TDL>
    </DESC>
    </BODY>
    </ENVELOPE>

    Current Result:

    <OPENINGBALANCE>5000</OPENINGBALANCE>
    <CLOSINGBALANCE>5590</CLOSINGBALANCE>
     


  2. Sai Vineeth

    Sai Vineeth Active Member


    Closing balance or any amount in Tally is negative then debit else credit
    you can create compute statement using same logic or handle this after receiving xml
     


  3. Rutal Jadav

    Rutal Jadav Member


    I am computing using the below code but didn't get desired response.

    <ENVELOPE>
    <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Collection</TYPE>
    <ID>CustMasterColl</ID>
    </HEADER>
    <BODY>
    <DESC>
    <STATICVARIABLES>
    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
    <SVCURRENTCOMPANY>Company Name</SVCURRENTCOMPANY>
    </STATICVARIABLES>
    <TDL>
    <TDLMESSAGE>
    <COLLECTION ISMODIFY="No" ISFIXED="No" ISINITIALIZE="Yes" ISOPTION="No" ISINTERNAL="No" NAME="CustMasterColl">
    <!-- * Tally Masters Types like Ledger, Group, StockItem ..etc., -->
    <TYPE>Ledger</TYPE>
    <FETCH>*,MASTERID,OPENINGBALANCE,CLOSINGBALANCE</FETCH>
    <FILTERS>AlterIdFilter</FILTERS>
    </COLLECTION>
    <!-- * IF you want Between then $ALTERID &gt; '100' AND $ALTERID &lt; '120' -->
    <SYSTEM TYPE="Formulae" NAME="AlterIdFilter">$AlterID &gt; 0</SYSTEM>
    <COMPUTE>CreditBalance:$CLOSINGBALANCE - $OPENINGBALANCE</COMPUTE>
    </TDLMESSAGE>
    </TDL>
    </DESC>
    </BODY>
    </ENVELOPE>

    My desired output is:

    <OPENINGBALANCE>5000</OPENINGBALANCE>
    <CLOSINGBALANCE>5590</CLOSINGBALANCE>
    <DEBITBALANCE>0</DEBITBALANCE>
    <CREDITBALANCE>590</CREDITBALANCE>
     


  4. narayane88

    narayane88 Active Member



    Writer your own Report then export
     


  5. Sai Vineeth

    Sai Vineeth Active Member


    Compute should be inside collection and your logic is wrong
    What I mentioned is If Closing Balance is negative then means it should be #ClosingBalance < 0 and vice versa
    There is another way where you can use tdl function $$IsDebit
    Code:
                          <COMPUTE>DebitClosingBalance: if $$IsDebit:$CLOSINGBALANCE then $$ABS:$CLOSINGBALANCE else 0</COMPUTE>
                            <COMPUTE>CreditClosingBalance:if not $$IsDebit:$CLOSINGBALANCE then $$ABS:$CLOSINGBALANCE else 0</COMPUTE>
     


Share This Page