Send print action to Tally using XML Request

Discussion in 'Tally Integration' started by Bhushan Cellica, Mar 2, 2017.

    

  1. Hello Everyone,

    I have configured printer settings with Tally, and I am able to print "Sales Invoice" from Tally.

    But Now I am creating "Sales Invoice" from my C# application and want to print "Sales Invoice" from C# application.
    How I can send print action to Tally using XML request to print specific Sales Invoice Voucher in Tally ?

    Thanks in Advance !!!
     



  2. Hello All,
    I have able to print specific voucher.

    Now I want to use PDF Printer and save file automatically with some file name at specified location.
    Please guide me through it.
    Using this, I want to send PDF voucher to customer through EMail.

    Thanks in advance
     


  3. Gopinath

    Gopinath New Member


    HI,

    I Am looking for the same.

    can you provide me the reference for generating PDF from XML Request.
     



  4. Sorry but, i am not succeed yet in it.
    I will update the details here once i am done on it.

    Thank you for interest in it.
     


  5. Gopinath

    Gopinath New Member



  6. teja varma

    teja varma Active Member


    for exporting balance sheet, send a request like this :
    Code:
     <ENVELOPE>
      <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>HostController</ID>
      </HEADER>
      <BODY>
        <DESC>
          <STATICVARIABLES>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          </STATICVARIABLES>
          <TDL>
            <TDLMESSAGE>
                <REPORT Name="HostController">
                <FORM>HostController</FORM>  
                </REPORT>
                <FORM Name="HostController">
                 <PART>HostController</PART>  
                </FORM>
                <PART Name="HostController">
                <LINE>HostController</LINE>
                <SCROLLED>Vertical</SCROLLED>
                </PART>
                <LINE Name="HostController">
                <FIELD>NameField</FIELD>
                <LOCAL>Field:Name Field:setas:$$TriggerReportExport</LOCAL>
                </LINE>
                <FUNCTION Name="TriggerReportExport">
                    <ACTION>02:SET:SvExportFormat:$$SysName:PDF</ACTION>
                    <ACTION>03:SET:SvPrintFileName:$$MakeExportName:"Balance Sheet":##SvExportFormat</ACTION>
                    <ACTION>04:SET:SVOpenFileAfterExport:No</ACTION>
                    <ACTION>05:EXPORT REPORT:Balance Sheet:True</ACTION>
                    <ACTION>06:Return:"Process Completed"</ACTION>
                </FUNCTION>
            </TDLMESSAGE>
          </TDL>
        </DESC>
      </BODY>
    </ENVELOPE>
    
    hope it will be helpful for you
    All the Best.
     
    Last edited: Apr 15, 2020


  7. Gopinath

    Gopinath New Member



    Hi Teja,

    Really thanks for Sharing the Code snipped. It worked well. with modifying as "EXPORT REPORT:Balance Sheet: TRUE"

    I am new to TDL and i am struggling to export a single sales voucher / Invoice as PDF using filter and voucher number.

    please help me to export as PDF through XML Request.
     


  8. teja varma

    teja varma Active Member


    Yeah i forgot to add true parameter for export action
    Thanks for pointing out
    Export single invoice invoice via xml request is a bit hard , let me try that one , i will update the status
     
    Gopinath likes this.


  9. teja varma

    teja varma Active Member


    To export the invoice:
    Code:
     <ENVELOPE>
      <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>HostController</ID>
      </HEADER>
      <BODY>
        <DESC>
          <STATICVARIABLES>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          </STATICVARIABLES>
          <TDL>
            <TDLMESSAGE>
                <REPORT Name="HostController">
                <FORM>HostController</FORM>  
                </REPORT>
                <FORM Name="HostController">
                 <PART>HostController</PART>  
                </FORM>
                <PART Name="HostController">
                <LINE>HostController</LINE>
                <SCROLLED>Vertical</SCROLLED>
                </PART>
                <LINE Name="HostController">
                <FIELD>NameField</FIELD>
                <LOCAL>Field:Name Field:setas:$$TriggerReportExport</LOCAL>
                </LINE>
                <FUNCTION Name="TriggerReportExport">
                    <ACTION>02:SET:SvExportFormat:$$SysName:PDF</ACTION>
                    <ACTION>03:SET:SvPrintFileName:$$MakeExportName:"Invoice":##SvExportFormat</ACTION>
                    <ACTION>04:SET:SVOpenFileAfterExport:No</ACTION>
                    <ACTION>05:EXPORT REPORT:TargetInvoice:True</ACTION>
                    <ACTION>06:Return:"Process Completed"</ACTION>
                </FUNCTION>
                <REPORT Name="TargetInvoice">
                <OBJECT>Voucher:"ID:2"</OBJECT>
                <TITLE>Invoice</TITLE>
                <USE>Voucher</USE>
                <FORM>Printed Invoice</FORM>
                </REPORT>
            </TDLMESSAGE>
          </TDL>
        </DESC>
      </BODY>
    </ENVELOPE>
    
    you have to replace id <OBJECT>Voucher:"ID:2"</OBJECT> with master id of the voucher you want to export
    it is for sales voucher, for other voucher types you have to change the form name <FORM>Printed Invoice</FORM> to get respective print format
     


  10. Gopinath

    Gopinath New Member


    upload_2020-4-20_6-19-50.png

    Dear Teja,

    Really Appreciate your efforts in sharing this code and helping others from your schedule.

    I am getting an error while executing the XML request. Could you help me with that? Attached the screenshot of the error.

    upload_2020-4-20_6-19-50.png
     


  11. teja varma

    teja varma Active Member


    Disable all the tdl's in tally and give a try..
     


  12. Gopinath

    Gopinath New Member


    Hi Teja,

    I Tried But it is the same error.
     


  13. teja varma

    teja varma Active Member


    Its working fine at my end
    try checking exporting report from tally itself(Manually)
     


  14. Gopinath

    Gopinath New Member


    Dear Teja,

    Thanks for your support.

    The Manual Export works fine from Tally. Only when sending XML Request the Error Occurs.

    I tried Uninstall and reInstalled Tally 9 erp still the error persists.

    If you could give me any debugging steps or any custom TDL for this Export i can try and resolve the issue.
     


  15. teja varma

    teja varma Active Member


    send the data backup that you are using..
    I will check if there is any problem in the data
     


  16. Gopinath

    Gopinath New Member


    HI Teja,

    Can i Get your Email to share the data.
     


  17. teja varma

    teja varma Active Member


    varma@apploops.com
     


  18. skulal75

    skulal75 New Member


    Code:
     <ENVELOPE>
      <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>Export</TALLYREQUEST>
        <TYPE>Data</TYPE>
        <ID>HostController</ID>
      </HEADER>
      <BODY>
        <DESC>
          <STATICVARIABLES>
            <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          </STATICVARIABLES>
          <TDL>
            <TDLMESSAGE>
                <REPORT Name="HostController">
                <FORM>HostController</FORM>
                </REPORT>
                <FORM Name="HostController">
                 <PART>HostController</PART>
                </FORM>
                <PART Name="HostController">
                <LINE>HostController</LINE>
                <SCROLLED>Vertical</SCROLLED>
                </PART>
                <LINE Name="HostController">
                <FIELD>NameField</FIELD>
                <LOCAL>Field:Name Field:setas:$$TriggerReportExport</LOCAL>
                </LINE>
                <FUNCTION Name="TriggerReportExport">
                    <ACTION>02:SET:SvExportFormat:$$SysName:PDF</ACTION>
                    <ACTION>03:SET:SvPrintFileName:$$MakeExportName:"Pay slip":##SvExportFormat</ACTION>
                    <ACTION>04:SET:SVOpenFileAfterExport:No</ACTION>
                    <ACTION>05:EXPORT REPORT:Pay Slip:True</ACTION>
                    <ACTION>06:Return:"Process Completed"</ACTION>
                </FUNCTION>
            </TDLMESSAGE>
          </TDL>
        </DESC>
      </BODY>
    </ENVELOPE>
    
    ******************************************************
    Hello Sir
    i used above code to download payslip from tally but i can able download pay slip template only because i am not able to pass the particular employee name or id ,plz suggest me how to pass employee id.
     
    Last edited: Jun 2, 2021


  19. SURANJIT DUTTA

    SURANJIT DUTTA New Member


    It is working for me with a few issues:
    1)GST Amounts does not get printed but when exported in pdf format from tally it does
    2)The pdf page size is too big but when exported from tally it is normal and as configured
    I am very new in this field a little help would be much appreciated.
     


  20. B Patil

    B Patil New Member


    For "GST Amounts does not get printed but when exported in pdf format from tally it does"
    Check which variable is set to True/False when you do it manually. While sending XML
    set the value of that variable in Report Tag like:
    ....

    <REPORT Name="TargetInvoice">
    ...
    ...
    ...
    <SET>VariableName:Yes</SET>
    </REPORT>
     


  21. Sigh

    Sigh New Member


    How to print instead of export?
     


  22. Sigh

    Sigh New Member


    My application is done I just need to know how to send the print command
     


  23. parthm42

    parthm42 New Member


    @teja varma
    Using this, PDF Exported but Invoice total and amount in words is missing from exported PDF

    upload_2022-6-18_17-17-29.png
     
    Last edited: Jun 20, 2022



  24. There are 2 parts of your solutions
    A) <ACTION>05:EXPORT REPORT:pay Slip:True</ACTION>
    here instead of export you have to give the print option

    B) you need to make your customized report to print as by default one will come blank as report will have to be given with voucher id
     


  25. parthm42

    parthm42 New Member


    A

    <ACTION>05:pRINT REPORT:TargetInvoice:True</ACTION>

    After Change print option, it's print totally blank
     


Share This Page