Home > Enterprise >  XML request for Groupwise vouchers details ,ledgers and their bill references , GST breakups ,addres
XML request for Groupwise vouchers details ,ledgers and their bill references , GST breakups ,addres

Time:02-19

I am trying to fetch Groupwise vouchers details from tally through xml request, I successfully got groups details.

Next, I need to pass group names one by one in for loop , should receive Groupwise vouchers details ,ledgers and their bill references , GST breakups ,address etc.,

I tried following code to get group details and received correct response.

<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
    <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>MyReportGroupTable</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
            </STATICVARIABLES>
            <TDL>
                <TDLMESSAGE>
                    <REPORT NAME="MyReportGroupTable">
                        <FORMS>MyForm</FORMS>
                    </REPORT>
                    <FORM NAME="MyForm">
                        <PARTS>MyPart</PARTS>
                    </FORM>
                    <PART NAME="MyPart">
                        <LINES>MyLine</LINES>
                        <REPEAT>MyLine : MyCollection</REPEAT>
                        <SCROLLED>Vertical</SCROLLED>
                    </PART>
                    <LINE NAME="MyLine">
                        <FIELDS>FldGuid,FldName,FldParent,FldPrimaryGroup,FldIsRevenue,FldIsDeemedPositive,FldSortPosition</FIELDS>
                    </LINE>
                    <FIELD NAME="FldGuid">
                        <SET>$Guid</SET>
                    </FIELD>
                    <FIELD NAME="FldName">
                        <SET>$$StringFindAndReplace:$Name:'"':'""'</SET>
                    </FIELD>
                    <FIELD NAME="FldParent">
                        <SET>$$StringFindAndReplace:$Parent:'"':'""'</SET>
                    </FIELD>
                    <FIELD NAME="FldPrimaryGroup">
                        <SET>$_PrimaryGroup</SET>
                    </FIELD>
                    <FIELD NAME="FldIsRevenue">
                        <SET>$IsRevenue</SET>
                    </FIELD>
                    <FIELD NAME="FldIsDeemedPositive">
                        <SET>$IsDeemedPositive</SET>
                    </FIELD>
                    <FIELD NAME="FldSortPosition">
                        <SET>$SortPosition</SET>
                    </FIELD>
                    <COLLECTION NAME="MyCollection">
                        <TYPE>Group</TYPE>
                        <FETCH>IsRevenue,IsDeemedPositive,SortPosition,_PrimaryGroup</FETCH>
                    </COLLECTION>
                </TDLMESSAGE>
            </TDL>
        </DESC>
    </BODY>
</ENVELOPE>

After this ,I require XML request to get Groupwise vouchers details, ledgers details, their bill references , GST breakups and address

I tried so many xml codes for past one month ,but I didn't get success.

I have tried following code. I got response successfully. But I cannot able to link / add group name & their parent group name

<ENVELOPE>
   <HEADER>
       <VERSION>1</VERSION>
       <TALLYREQUEST>Export</TALLYREQUEST>
       <TYPE>Data</TYPE>
       <ID>MyReportLedgerVouchers</ID>
   </HEADER>
   <BODY>
       <DESC>
           <STATICVARIABLES>
               <SVFROMDATE>$fromDate$</SVFROMDATE>
               <SVTODATE>$toDate$</SVTODATE>
               <SVEXPORTFORMAT>$$SysName:ASCII</SVEXPORTFORMAT>
           </STATICVARIABLES>
           <TDL>
               <TDLMESSAGE>
                   <REPORT NAME="MyReportLedgerVouchers">
                       <FORMS>MyForm</FORMS>
                   </REPORT>
                   <FORM NAME="MyForm">
                       <PARTS>MyPart</PARTS>
                   </FORM>
                   <PART NAME="MyPart">
                       <LINES>MyLine</LINES>
                       <REPEAT>MyLine : MyCollection</REPEAT>
                       <SCROLLED>Vertical</SCROLLED>
                   </PART>
                   <LINE NAME="MyLine">
                       <FIELDS>FldDate,FldVoucherType,FldVoucherNumber,FldLedger,FldAmount,FldNarration</FIELDS>
                   </LINE>
                   <FIELD NAME="FldDate">
                       <SET>$Date</SET>
                   </FIELD>
                   <FIELD NAME="FldVoucherType">
                       <SET>$VoucherTypeName</SET>
                   </FIELD>
                   <FIELD NAME="FldVoucherNumber">
                       <SET>$$StringFindAndReplace:$VoucherNumber:'"':'""'</SET>
                   </FIELD>
                   <FIELD NAME="FldLedger">
                       <SET>$$StringFindAndReplace:$FldLedger:'"':'""'</SET>
                   </FIELD>
                   <FIELD NAME="FldAmount">
                       <SET>$FldAmount</SET>
                   </FIELD>
                   <FIELD NAME="FldNarration">
                       <SET>$$StringFindAndReplace:$Narration:'"':'""'</SET>
                   </FIELD>
                   <COLLECTION NAME="MyCollection">
                       <TYPE>Voucher</TYPE>
                       <FETCH>Narration,AllLedgerEntries</FETCH>
                       <FILTER>FilterCancelledVouchers,FilterOptionalVouchers,FilterVch</FILTER>
                   </COLLECTION>
                   <SYSTEM TYPE="Formulae" NAME="FilterVch">NOT $$IsEmpty:($$FilterValue:$LedgerName:AllLedgerEntries:First:FilterVchLedger)</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FilterVchLedger">$$IsEqual:$LedgerName:"$ledgerName$"</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FilterVchLedgerNot">NOT $$IsEqual:$LedgerName:"$ledgerName$"</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FldAmount">if $$IsDr:$$FilterAmtTotal:AllLedgerEntries:FilterVchLedger:$Amount then (-$$FilterAmtTotal:AllLedgerEntries:FilterVchLedger:$Amount) else ($$FilterAmtTotal:AllLedgerEntries:FilterVchLedger:$Amount)</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FldLedger">if $$FilterCount:AllLedgerEntries:FilterVchLedgerNot > 1 then ($$FullList:AllLedgerEntries:$LedgerName) else ($$FilterValue:$LedgerName:AllLedgerEntries:First:FilterVchLedgerNot)</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FilterCancelledVouchers">NOT $IsCancelled</SYSTEM>
                   <SYSTEM TYPE="Formulae" NAME="FilterOptionalVouchers">NOT $IsOptional</SYSTEM>
               </TDLMESSAGE>
           </TDL>
       </DESC>
   </BODY>
</ENVELOPE>```

CodePudding user response:

Use Below Xml to get Vouchers based on Group Name

Change <Childof>Sales Accounts</Childof> accordingly

<ENVELOPE>
    <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Collection</TYPE>
        <ID>Vouchers</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT> <!-- * Supports only xml format -->
              <SVViewName>Accounting Voucher View</SVViewName>
                <SVFROMDATE TYPE="Date">20200801</SVFROMDATE>
                <SVTODATE TYPE="Date">20210831</SVTODATE>
            </STATICVARIABLES>
            <TDL>
                <TDLMESSAGE>
                    <COLLECTION ISMODIFY="No" ISFIXED="No" ISINITIALIZE="No" ISOPTION="No" ISINTERNAL="No" NAME="Vouchers">
                        <TYPE> Vouchers : Group</TYPE>
                            <!--Replace Sales Accounts with GroupName you want to search -->
                        <Childof>Sales Accounts</Childof>
                        <NATIVEMETHOD>*</NATIVEMETHOD>
                    
                    </COLLECTION>
  
                </TDLMESSAGE>
            </TDL>
        </DESC>
    </BODY>
</ENVELOPE>
  • Related