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 > 0</SYSTEM> </TDLMESSAGE> </TDL> </DESC> </BODY> </ENVELOPE> Current Result: <OPENINGBALANCE>5000</OPENINGBALANCE> <CLOSINGBALANCE>5590</CLOSINGBALANCE>
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
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 > '100' AND $ALTERID < '120' --> <SYSTEM TYPE="Formulae" NAME="AlterIdFilter">$AlterID > 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>
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>