Auto export balance sheet in excel format

Discussion in 'Tally Developer' started by Ritesh Mehta, Jul 3, 2012.

    
  1. Ritesh Mehta

    Ritesh Mehta New Member


    Dear All,

    Is there any possibility to export balance sheet in excel format automatically everyday at 11 pm?

    Also everyday file name should be in combination of datetime.xls.

    So we want to know is there any possibility to do the same or not?

    Thanks,
    Ritesh
     


  2. admin

    admin Administrator Staff Member



  3. PKR

    PKR New Member


    Dear Mr. Ritesh,

    Please find the below code for auto export of Balance Sheet.

    To open the Tally automatically use the Windows Task Scheduler

    Once windows Task Scheduler open the Tally then the Default company will open in Tally (Set Default Company in F12)

    Once the Tally Default Company opens, this code will start work.



    ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

    [System: Events]

    CmplExport: Load Company: True: Action: Call: PK LoadCmpFunc

    [Function: PK LoadCmpFunc]

    01: Action: Trigger Key: V
    02: Action: Trigger Key: Alt+9

    [#Form: Accounting Voucher]

    Add: Button: ExportExcel

    [Button: ExportExcel]

    Key: Alt+9
    Action: Call: PK Cmp Export

    [Function: PK Cmp Export]

    Local Formula: SysDate: $$SysInfo:SystemDate

    Variable: FileName: String

    00: SET: SVExportLocation: $(AppINIConfig, "AppINIConfig").ExportPath
    01: SET: SVOpenFileAfterExport: No
    10: SET: SVExportFormat: $$SysName:pDF
    20: SET: FileName: ##SVCurrentCompany + "-" + $$String:mad:SysDate + ".PDF"
    30: SET: SVPrintFileName: $$PKLastChar:##SVExportLocation:##FileName
    40: SET: SVPrintFileName: $$MakeExportName:##SVPrintFileName:##SVExportFormat
    50: EXPORT REPORT: BalanceSheet: TRUE
    70: Action: TriggerKey: Ctrl+Q
    80: Action: TriggerKey: Ctrl+Q

    [Function: PKLastChar]

    Parameter: pLocPath: String
    Parameter: pFileName: String
    Parameter: pLastChar: String: "\"

    Local Formula: StrLenDir: $$StringLength:##pLocPath
    Local Formula: LastChar: $$StringPart:##pLocPath:(@StrLenDir - 1):1

    Variable: ReturnStr: String

    00: IF: $$ExactMatch:mad:LastChar:##pLastChar
    10:SET: ReturnStr: ##pLocPath + ##pFileName
    20: ELSE:
    30:SET: ReturnStr: ##pLocPath + ##pLastChar + ##pFileName
    40: ENDIF
    50: RETURN: ##ReturnStr



     
    naren1234 likes this.


  4. admin

    admin Administrator Staff Member


    If company is having user name and Password.. How u will open using windows schedular??

     


  5. PKR

    PKR New Member


    Sir,

    It's may not right solutions, but we can set the user name and password in F12 Config or in TDL Code based on that we can open tally company without human intervention.

    Advise us for better solution.

    Code is below

    #Part : SVLoginDetails]
    Lines : SVCUserName, SVCPassword
    Local : Field : SVCPassword16170 : Width : 30

    Local : Field :SVCUserName : Setas : "a"
    Local : Field :SVCPassword : Setas : "a"


    [*Function : LoadDefaultCompanies]

    Parameter : pInRestartMode : Logical

    ;; Associate the AppINIConfig object, which gives access to all the Tally.INI parameters
    Object : AppINIConfig : AppINIConfig

    ;; In restart mode load the restored companies, which is available for the application in
    ;; restart mode, SelectCompany without any parameter means load the restored companies.
    01 : IF : ##pInRestartMode

    ;; SelectCompany without any parameter means load the restored companies.
    02 : SELECT COMPANY


    ;; Return
    03 : RETURN

    ;; End if of restart mode check
    04 : ENDIF

    ;; case : If load default companies is Yes and there is list of companies to be loaded;
    ;; Call the SelectCompany action with the list of default companies to loaded.
    05 : IF : $DefaultCompanies AND NOT $$IsEmptyCollection:Load AND NOT $CmdNoIniLoad
    P1 : Action : TriggerKey : Ctrl+A

    /*P2 : Action : TriggerKey : Enter*/

    ;; call select company action with the list of default companies
    ;; empty separator characters for using default sysname character.
    06 : SelectCompany:"":$$FullListEx:"":Load:##SVCurrentPath:$Load

    07 : ENDIF

    ;; now load the companies specified in command line
    08 : DO IF : (NOT $$IsEmptyCollection:CmdLoad) : SelectCompany:"":$$FullListEx:"":CmdLoad:##SVCurrentPath:$CmdLoad
     
    naren1234 likes this.


  6. admin

    admin Administrator Staff Member


    Your solution is good. I just asked that question because of user should not comeback for the opening company with username & Password. Your explanation is seemed to be good. Instead of hardcoding... let it be configurable.

    We should thankful to R&D team for their effort for introducing - TriggerKey action in Function. Such a wonderful feature.

    Let Ritesh work on it.

     


  7. shubh

    shubh New Member


    Dear Experts,

    How can we get balance sheet on every start of month
     


  8. Vineet More

    Vineet More New Member


    Hi Guys,

    Can you please let me know how to set the Export Format as Constant in TDL as PDF?

    I tried as mentioned below:

    [System: Variable]
    SVExportFormat : $$SysName:pDF

    I am new to TDL programming.

    Request you to please help me out.

    Regards
    Vineet More
     


Share This Page