Log Maintainance

aliennavaliennav Member Posts: 449
How can i get to know that which user is logging in and which is logging out with time.
means log maintainance.

Comments

  • aliennavaliennav Member Posts: 449
    aliennav wrote:
    How can i get to know that which user is logging in and which is logging out with time.
    means log maintainance.


    what changes have to be made in the system??
  • ArhontisArhontis Member Posts: 667
    You could modify a little the cu 1 (applicationmanagement) where there are two functions LogInStart() and LogInEnd() where they are called when a user logs in or logs out.

    There is already some functionality but keeps the time the user worked (table 51 User Time Register) so you could extend that table to keep the login time and the log out time and modify those already made functions to add your code...

    But remember that every time the user logs out the code finds and adds the new time if it finds already a time register at that date.
        UserTimeRegister.INIT;
        UserTimeRegister."User ID" := USERID;
        UserTimeRegister.Date := LogInDate;
        IF UserTimeRegister.FIND THEN BEGIN
          UserTimeRegister.Minutes := UserTimeRegister.Minutes + Minutes;
          UserTimeRegister.MODIFY;
        END ELSE BEGIN
          UserTimeRegister.Minutes := Minutes;
          UserTimeRegister.INSERT;
        END;
    
    So you could just add a couple of columns (login Time and Logout Time) and in the above code add the two lines:
    .
          .
          .
        UserTimeRegister.INIT;
        UserTimeRegister."User ID" := USERID;
        UserTimeRegister.Date := LogInDate;
        UserTimeRegister."Login Time" := LogInTime;//new line
        UserTimeRegister."Logout Time" := LogOutTime;//new line
        IF UserTimeRegister.FIND THEN BEGIN
          .
          .
          .
    
    But that way if a user logs in and out all the time, you will have the last login/out per day... I don't know it is ok with you...

    EDIT:
    You must have the "Register Time" to TRUE in the User Setup for every user to work the above functionality...
  • aliennavaliennav Member Posts: 449
    Arhontis wrote:
    You could modify a little the cu 1 (applicationmanagement) where there are two functions LogInStart() and LogInEnd() where they are called when a user logs in or logs out.

    There is already some functionality but keeps the time the user worked (table 51 User Time Register) so you could extend that table to keep the login time and the log out time and modify those already made functions to add your code...

    But remember that every time the user logs out the code finds and adds the new time if it finds already a time register at that date.
        UserTimeRegister.INIT;
        UserTimeRegister."User ID" := USERID;
        UserTimeRegister.Date := LogInDate;
        IF UserTimeRegister.FIND THEN BEGIN
          UserTimeRegister.Minutes := UserTimeRegister.Minutes + Minutes;
          UserTimeRegister.MODIFY;
        END ELSE BEGIN
          UserTimeRegister.Minutes := Minutes;
          UserTimeRegister.INSERT;
        END;
    
    So you could just add a couple of columns (login Time and Logout Time) and in the above code add the two lines:
    .
          .
          .
        UserTimeRegister.INIT;
        UserTimeRegister."User ID" := USERID;
        UserTimeRegister.Date := LogInDate;
        UserTimeRegister."Login Time" := LogInTime;//new line
        UserTimeRegister."Logout Time" := LogOutTime;//new line
        IF UserTimeRegister.FIND THEN BEGIN
          .
          .
          .
    
    But that way if a user logs in and out all the time, you will have the last login/out per day... I don't know it is ok with you...

    EDIT:
    You must have the "Register Time" to TRUE in the User Setup for every user to work the above functionality...


    Thanx .
    I'll try it soon
  • aliennavaliennav Member Posts: 449
    I tried the change u mentioned .Also declared 2 variable Login Time,Logout Time with the datatype as TIME.But when i try to save that table ie user Time Register,it is showing that ur license does not have the permission to declare time variable.
    What to do now?
  • ArhontisArhontis Member Posts: 667
    :sick:

    What? First of all, what is the error message? When do you get it?
    If it is when you modify the object Register table by adding two fields and try to save it then check your field numbers... Custom fields must be in the range 50000..99999.
  • aliennavaliennav Member Posts: 449
    Ya that was a silly mistake.I gave the right IDs but now how can i see the recorded times.

    Till i have done is

    added those two lines in the CU 1 and 2 field in the user time register.
    What to do now
    Tell me if i am missing something.
    Thanx in advance
  • ArhontisArhontis Member Posts: 667
    Now you have to check the "Register Time" at the General Ledger Setup and it will work... This flag is to enable all that functionality...

    Just login/logout and go to the time register table and see if you got the login and logout times...

    Maybe you will need a new report or modify the form 71 to show those values...
  • aliennavaliennav Member Posts: 449
    Arhontis wrote:
    Now you have to check the "Register Time" at the General Ledger Setup and it will work... This flag is to enable all that functionality...

    Just login/logout and go to the time register table and see if you got the login and logout times...

    Maybe you will need a new report or modify the form 71 to show those values...

    Thanx ma'an it's working.
    But I have observed that if i log in from the same user twice in a day then it just keeps adding the two times and then display.
    Can't i get that no. of records for which the user has logged in??
  • ArhontisArhontis Member Posts: 667
    I am glad you got it... As for the multiple login/logout per date you have to change the primary key and maybe the code in cu 1. But I advice you not to...

    But in case it is really important then add the Login Time new field to the primary key of the table... but I don't think such major change to a table is necessary... You will miss the multiple logins... Is that a problem?
Sign In or Register to comment.