C# code to import Ledgers from excel to Tally

Discussion in 'Tally Integration' started by teja varma, Sep 20, 2019.

    
  1. Himanshu-2002

    Himanshu-2002 Active Member


    I think TDL is Working Fine But Debit And Credit are not equal So, Enter data properly...
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Maybe because that is the end of the loop...........If not end of loop... there would definitely be a error message.
     


  3. abhinand vk

    abhinand vk Active Member


    I know c and c++ any similarity have this c# with these languages
     


  4. teja varma

    teja varma Active Member


    as you know c and c++ c# is very easy to learn and understand
    you can implement the same functionality in c++ too
    but c# is easy to write, less verbose and no need to manage memory and other stuff
    c# is a runtime language(CLR) which is converted to IL (Intermediate language) then executed/managed by .Net Framework
    that's why c# is called a managed code
    on the other hand, c/c++ is unmanaged code which is directly converted to machine code (platform-specific binary)
    in c/c++ there is no runtime to manage memory, platform-specific code, system calls
    you have to write/manage your code

    finally, for critical application c/c++ is best
    for normal applications especially for windows applications, c# will be fine
     
    abhinand vk likes this.


  5. Rubazi

    Rubazi New Member



  6. diwakar

    diwakar New Member


    I'm facing this issue while using import option in tally also.
     


  7. diwakar

    diwakar New Member


    Yes Sir. If possible please contact me(919030815176). I will show you by anydesk.
     


  8. diwakar

    diwakar New Member


    Hi sir, if possible please contact me on this number 919030815176. I will show you on anydesk. I'm facing this issue not only by my application, by tally import option also. Please contact me.
     


  9. Himanshu-2002

    Himanshu-2002 Active Member


    Diwakar Sir...If You made this code then I believe You can correct this code yourself...Just Keep Trying
     


  10. diwakar

    diwakar New Member


    Sir, first I thought I made some mistake in coding, I tried a lot but didn't find any. Later I go through tally import option at gateway of tally. Manually I generated two xml files , I imported first one through import option at tally ,imported successfully. When I tried with second xml file ,tally closed automatically. I checked the tally.imp file for error. It is not shown any error. I google for this type of issue, didn't find anything.
     


  11. Himanshu-2002

    Himanshu-2002 Active Member


    Then Contact Tally Solutions and Tell them About this issue... They will solve your problems
     


  12. teja varma

    teja varma Active Member


    maybe the second XML file is in improper format, attach that XML file, i will check once
     


  13. diwakar

    diwakar New Member


    Hi sir, I want verify whether the voucher is exported to tally with voucher number. Can you suggest or can you give any C# code to do this.
     


  14. Sai Vineeth

    Sai Vineeth Active Member


    Code:
    Using TallyConnector //Importing TallyConnector Library
    using TallyConnector.Models;
    
    //public Tally = new Tally("http://localhost",9000); --You can Specify url and port on which tally is running
    public Ctally = new Tally(); //If Nothing is specified default url is localhost running on port 9000
    
    //We can also Setup default Configuration using Setup method - Once setup you no need to explicitly send these through each methods
    Ctally.Setup(URL,Port,CompName,fromDate,toDate); //URL and port are mandatory Fields
    
    //Check() Returns true if tally is running
    public bool status = await Ctally.Check(); // To check Whether Tally is running on Given url and port.
    
    //GetCompaniesList() Returns List of companies opened in Tally
    List<Company> CompaniesList = await  Ctally.GetCompaniesList();
    
    //FetchAllTallyData() will get all tally masters like Groups/Ledgers ...etc., in Ctally.Groups,Ctally.Ledgers lists
    await Ctally.FetchAllTallyData(CompName);
    
    //You can find ledger names in Ctally.Ledgers
    
    //looping through ledgernames
    foreach (var Ledger in Ctally.Ledgers)
    {
    Ledger TLedger = await Ctally.GetLedgerfromTally(Ledger);
    
    //You will get ledger with all fields
    //TLedger.Name will be LedgerName
    //TLedger.OpeningBal  will have Opening Bal
    //Similarly we will have all fields you can check with intellisense
    
    }
    
    You can see that in 2 lines you can get ledger from tally
    Code:
    Using TallyConnector;
    using TallyConnector.Models;
    public Ctally = new Tally();
    Ledger TLedger = await Ctally.GetLedgerfromTally(LedgerName);
    
    • You need to reference Tally Connector Library in your Project you can download it from Github
    • If you have any suggestions or found any missing fields for any object raise an issue in github

    Ledger_Fields_1.png

    Ledger_Fields_2.png
     
    Last edited: Jun 11, 2021


  15. Sai Vineeth

    Sai Vineeth Active Member


    You cannot get Voucher by Voucher Number only ,
    You will require both Voucher number and Voucher Date
    else Only master ID
    Code:
    Using TallyConnector //Get from Github - https://github.com/Accounting-Companion/TallyConnector/releases
    using TallyConnector.Models;
    
    public Ctally = new Tally();
    Voucher voucher = await Ctally.GetVoucherByVoucherNumber(VoucherNumber,Date);
    //If you have master id of voucher
    Voucher voucher = await Ctally.GetVoucherByMasterID(VoucherMasterID);
    
    
    If Voucher exists in Tally voucher object will have voucher data else it will be null
    xml used -
     


  16. Sanket Patel

    Sanket Patel New Member


    How can we get get masterid in response to the data sent to tally via Import (XML) method.
    Lets say I sent Sales voucher to tally via XML, how do I get master id back in response?

    2. how do I check if the voucher number (Sales / Journal / Payment ) exists in Tally (without passing Date)?
     


  17. Sai Vineeth

    Sai Vineeth Active Member


    When you create voucher you will get master id in response xml
    for others you will not get master id on creating

    To get voucher With only voucher number we can apply filter to voucher based on voucher number
    Use this XML change
    Code:
    <TYPE>Ledger</TYPE>
    to
    Code:
    <TYPE>Voucher</TYPE>
    & change filter based on vouchernumber
     


  18. diwakar

    diwakar New Member


    Hi, When i import an xml file to tally its working fine, but when i import the same file using SOAP (.NET Application) it giving error - " could not set svcurrentcompany to " ... I checked the company name in tally and xml file, both are same. Tally version is Gold Prime. Can any one help me to get out of this. Same .NET application working fine till yesterday with same company name.
     


  19. Sai Vineeth

    Sai Vineeth Active Member


    What is the name of company
    and post xml you are using
     


  20. diwakar

    diwakar New Member


    here i'm uploading the file.
     

    Attached Files:



Share This Page