CS Time/TNA Documents

username password

For Running Totals

    Table of contents
    No headers

    Using a script allows for the most flexible rules, and hence is the approach most often used. Simply put you can manipulate the time calculated, moving time from one category to another. There is an embed point that has been created especially for this purpose and is called - “Before Daily Running”.


    An example script might look like this;

    At Before Daily Running
      If Dai:Hours2 > 8:00
        Dai:Hours6 = Dai:Hours2 – 8:00
        Dai:Hours2 = 8:00
      Else
        Dai:Hours7 = 8:00 - Dai:Hours2
        Dai:Hours2 = 8:00
      End

     

    In the above script the normal time is set to 8 hours. If the person has worked more than 8 hours then the excess is moved to the Flexi+ category (category 6) and the normal time is limited to 8 hours. If they've worked less than 8 hours then the missing time is added to the Flexi- time (category 7), and the normal hours is again set to 8.

    A slightly more complicated script might not allow the flexitime to become negative. In other words the normal time is only padded out if sufficient flexitime exists. In this case the script might look like this;

     

    At Before Daily Running
      If Dai:Hours2 > 8:00
        Dai:Hours6 = Dai:Hours2 – 8:00
        Dai:Hours2 = 8:00
      Else
        If Dai:Hours8 > Dai:Hours2 - 8:00
          Dai:Hours7 = 8:00 - Dai:Hours2
          Dai:Hours2 = 8:00
        Else
          Dai:Hours7 = Dai:Hours8
          Dai:Hours2 = Dai:Hours2 + Dai:Hours8
        End
      End

     

    In both of the above scripts the Add category is category number 6, the subtract is number 7 and the total is in 8. The Normal time is in category 2.

    Of course these are just 2 common examples. You will need to adjust the rules depending on the rules required on your site.

    Permalink:  http://tinyurl.com/kqjp7sl

    Page last modified 11:23, 2 Aug 2011 by Admin CS Time/TNA Documents > Macro Scripts > Examples > For Running Totals

    Comments0

    You must login to post a comment.
    Attach file

    Files0

     
    Powered by MindTouch Core