NEED TALLY APPLICATION QUIT DATE AND TIME

Discussion in 'Tally Developer' started by sattam, Mar 27, 2024.

    
  1. sattam

    sattam Active Member


    Dear respected members,
    When company close in tally this function works fine but if we quit tally by Ecs,Q, or Ctrl+Q its shows memory access violation error.
    Please Help me

    Code:
    [System: Events]
              
            SatCloseEvent     : Close Company    :NOT $$IsRemoteCompany        :Call:satLogoutFUNC
            SatEndEvent        : System End    :    NOT $$IsRemoteCompany    :Call:satLogoutFUNC
    
    [Function:satLogoutFUNC ]
    
       01:Call: log Out function
    
    [Function:log Out function]
    
                Variable    :    Usname     :String
                Variable    :    satstat    :String
                Variable    :    satdat     :Date
                Variable    :    sattim     :String
    
                Object    : Company : ##SvCurrentCompany
               
                005       :    Set Object    :.
                010    :     Set Target
                020    :    Set:Usname:##SVUserName
                040    :    Set:satstat: $$LocaleString:"Logout"
                050    :    Set:satdat:$$Date:$$MachineDate
                060    :    Set:sattim:$$String:$$MachineTime
    
                080    :    Insert Collection Object:satAgg2
               
                110    :        Set Value:satname2:##usname
                130    :        Set Value:satstatus2:##satstat
                140    :        Set Value:satdat2:##satdat
                150    :        Set Value:sattim2:##sattim
               
                175    :    Accept Alter
    
     


  2. AMIT JALAN

    AMIT JALAN Member


    Code:
    [System: Events]
             
            SatCloseEvent     : Close Company    :NOT $$IsRemoteCompany        :Call:satLogoutFUNC
    ;        SatEndEvent        : System End    :    NOT $$IsRemoteCompany    :Call:satLogoutFUNC

    You Don't need to Add Event for System End seperately.... Because when we quit tally while company is open... First It closes all the company and That event run automatically.
     


  3. sattam

    sattam Active Member


    But How to run my function when Tally quit?
     
    Last edited: Mar 28, 2024


  4. narayane88

    narayane88 Active Member


    create log file seprate in Text file
     


  5. sattam

    sattam Active Member


    Please see my function I want to store the value of time and date when user quit tally application like close company
    Then I fetch that value in my report
    Problem is if close company then function works perfectly but if I quit tally application then it's not working
     


  6. sattam

    sattam Active Member


    I want to run that function when tally application quit
    Any body give me solution
    Is it possible or not or any other way I can achieve this
     


  7. narayane88

    narayane88 Active Member


    Try following code
    Code:
    [System: Events]
             
            SatCloseEvent     : Close Company    :NOT $$IsRemoteCompany        :Call:satLogoutFUNC
            SatEndEvent        : System End    :    NOT $$IsRemoteCompany    :Call:satLogoutFUNC
            satStartEvent:System Start:NOT $$IsRemoteCompany   :Call:ListofLogOutfundction
           
    
    
    [Function:satLogoutFUNC ]
    
       01:Call: log Out function
    
    [Function:log Out function]
    
                Variable    :    Usname     :String
                Variable    :    satstat    :String
                Variable    :    satdat     :Date
                Variable    :    sattim     :String
                Variable        : UserDetails:String
               
                    200:Set:UserDetails: ##SVUserName+ "|" + $$LocaleString:"Logout" + "|" +  $$String:$$MachineDate + "|" +$$String:$$MachineTime +"|"
    
                    350:Open File:"E:\my hobbi\logout Details\UserLog.txt":    Text     :     Write
                    360:Write File Line:##UserDetails
                   
    
    
    
    [Function:ListofLogOutfundction]
        Variable:LoopIndex:Number
        Variable:BizSVfilePath:String
        Variable:UserName:String
        Variable:LogType:String
        Variable:LogDate:Date
        Variable:Logtime:Time
        Variable:RawDetails:String
                    Return:Logical
    
    
                    50: List Delete:TallyUserLog
                    100:Set:BizSVfilePath:"E:\my hobbi\logout Details\UserLog.txt"
                    ;105:Log:##BizSVfilePath
                   
                    200:Open File:##BizSVfilePath:    Text     :     Read
                    210        : While            : NOT $$FileIsEOF
                   
                    205:Set:RawDetails:$$FileRead
                    220:Set:UserName:($$StringWordEx:##RawDetails:"|":1)
                    230:Set:LogType:($$StringWordEx:##RawDetails:"|":2)
                    240:Set:LogDate:$$Date:($$StringWordEx:##RawDetails:"|":3)
                    250:Set:Logtime:$$Time:($$StringWordEx:##RawDetails:"|":4)
                   
                   
                    350:List Add   : TallyUserLog:##LoopIndex:##UserName:Name
                    360:List Add   : TallyUserLog:##LoopIndex:##LogType:Type
                    365:List Add   : TallyUserLog:##LoopIndex:##LogDate:Date
                    370:List Add   : TallyUserLog:##LoopIndex:##Logtime:Time
                   
                   
                    380:Increment:LoopIndex
                    390: End While
                    400:Close File
               
    
    
    [Variable:TallyUserLog]
        Variable:Name:String
        Variable:Type:String
        Variable:Date:Date
        Variable:Time:Time
    
    [System:Variable]
        List Variable    : TallyUserLog
       
    [Collection        : BizTallyUserMain]
        Data Source    : Variable    : TallyUserLog    
     


  8. sattam

    sattam Active Member


    Currently not in the system will check tomorrow and revert you back
     


  9. sattam

    sattam Active Member


    when tally quit,at first this code write file in .txt format then store the value from that txt file in list variable But I want to store this tally company wise in company object in aggregate udf
    if I store this in list variable then value will be same for all company in tally
    Suppose I start tally and open company ABC
    then tally quit and again tally start and open company XYZ. but Problem is in report logout date and time and user name will be same for all ABC and XYZ company
    also problem is when tally app quit ##svcurrentcompany not works
    hope You understand thanks
     


  10. narayane88

    narayane88 Active Member


    In the same code, insert the SVcompany variable name for Company Name understanding
     


  11. sattam

    sattam Active Member


    when tally app quit ##SvCurrentCompany not works
     


Share This Page