Calculating time

Related topics

During the time calculation process the clocking transactions in the TR journal are transformed into time balances, e.g. hours and days, in order to send information about presence and absence into the payroll system. The calculation process consists of the following main steps:

  • Create time transactions
    The clocking transactions in the TR journal are matched with the day scheme and transactions containing duration and wage type for different intervals of the day are created. Overtime is checked and may be reduced if the day scheme requires full time before overtime or if there is negative flexitime. Overtime is also rounded, if specified.
  • Create transactions from overlapping intervals
    Overlapping intervals are used to create transactions in addition to those created in the previous step.
  • Check minimum time
    For overlapping intervals and overtime intervals a minimum time can be specified. In this step, the total time inside such an interval is checked.
  • Create balance
    In this step, day balances are created. Period balances are updated and minimum and maximum values are checked.

Calculation rules
Calculation rules can be used in the time calculation process to perform additional calculations on day balances. See About working with day balance calculation rules for more information.

Depending on the type of day scheme, the time calculation process might differ. The following sections describe the differences.

Normal day scheme

The day scheme divides the day into a number of intervals and describes for each interval if presence is expected or not.

The clocking transaction in the journal creates another set of intervals indicating when an employee has been present or absent.

By combining these two sets you get a third set of intervals. For each interval in this set you can decide if the employee has been present or absent and whether presence is expected or not. You also check if time codes have been used and if they are valid for the interval. If a transaction shall be created the duration is calculated and wage type is retrieved from the day scheme or from the time code.

If time codes have been used both when clocking in and out and if both codes are valid for an interval, then the last used time code will be selected. For example, an employee clocks out during working hours using a time code for absence and then clocks in using another time code for absence. In this case the code used when clocking in will be used for the period of absence.

In the following cases more than one transaction may be created for an interval:

For flexitime the creation of transactions is controlled by the Flexi/presence attribute which is defined for the wage group.

When Flexi/presence = NO and there is negative flexitime, a transaction with wage type equal to the wage type for presence during working hours is also created. If positive flexitime is reported only the transaction for flexitime is created. This means that presence time will be equal to expected presence as long as you clock in and out inside the flexitime intervals.

When Flexi/presence = YES and there is positive flexitime a transaction with wage type equal to the wage type for presence during working hours is also created. If negative flexitime is reported only the transaction for flexitime is created.

Floating day scheme

A day scheme with floating work hours only specifies how many hours you are expected to work during a day; not when the work is supposed to be done.

When a day scheme with floating work hours is used the total presence time is first calculated and then compared to the expected presence time.

If the total presence time is less than expected a transaction for absence will be created if a time code for absence has been entered. If no code for absence has been entered but a wage type for flexitime is specified in the scheme, a transaction with negative flexitime is created.

If the total presence time is greater than expected the difference will be counted as overtime if a time code for overtime has been entered. If overtime is not requested but a wage type for flexitime has been specified in the scheme, a transaction with positive flexitime is created.

Overtime intervals may be used to get the total overtime divided into different wage types. The start and end times of an interval are used to calculate the duration of the interval. Starting with the first interval the overtime is compared to the duration. Overtime up to that amount will get a wage type from that interval. Remaining overtime is then compared to the duration of the next interval, and so on until all overtime has been distributed.

For day schemes with floating working hours there is no need to check full time before overtime. Overtime is granted only for the time that exceeds the expected presence. Furthermore, there is no need to check and adjust overtime and flexitime; it is not possible to have both overtime and flexitime. Rounding of overtime is done in the same way as for normal day schemes (see the next section).

For flexitime the creation of transactions is controlled by the Flexi/presence attribute which is defined for the wage group.

When Flexi/presence = NO and there is negative flexitime, a transaction with wage type equal to the wage type for presence during working hours is also created. If positive flexitime is reported only the transaction for flexitime is created.

When Flexi/presence = YES and there is positive flexitime, a transaction with wage type equal to the wage type for presence during working hours is also created. If negative flexitime is reported only the transaction for flexitime is created.

Overtime

The wage type for overtime can be assigned in two ways. If the day scheme has no overtime intervals defined for the time code used for overtime, then the overtime will get the wage type associated with the time code.

If there are overtime intervals defined, the wage type is determined from the overtime intervals covering the requested overtime. If a minimum time is specified for an interval, the total overtime inside the interval is calculated and later compared to the minimum time.

In some cases, the scheme borders are adjusted if you clock in or out outside the scheme. If you have clocked in before scheme start and request overtime, you will get overtime according to the first overtime interval of the day if the interval starts on the same time as the scheme. When clocking out after scheme end, the last overtime interval will be used if the interval ends on the same time as the scheme.

When overtime intervals are used and there is no overtime interval covering the requested overtime, no time is calculated and it is reported as an error in the batch job error log.

Initially, transactions are created for all requested overtime. As a last step some additional processing is done to check and adjust overtime. The overtime may be adjusted if full time before overtime is required. Overtime and flexitime may also be dependent of each other. The scheme may also have rules for rounding of overtime, either per overtime interval or for the total overtime of the day.

Full time before overtime

If the day scheme requires full time before overtime, granted overtime is not allowed to be greater than the difference between actual presence (including requested overtime) and expected presence according to the day scheme. If the initially calculated overtime is greater, then the overtime will be reduced.

The reduction is first done for the overtime created at the beginning of the day or at the end of the day. If there still is overtime to reduce, the remaining overtime transactions are processed until all exceeding overtime has been reduced. The reason for this order is that overtime giving the highest compensation should be reduced first. There is no information connected to the wage type that tells anything about the compensation, but usually the wage types used for the outermost intervals have the highest compensation.

In order to keep presence time correct when overtime is reduced, transactions with ordinary presence are created if the code of a wage type for presence is specified for the system value Wage type otime reduction (WTPOTMRED).

Rounding per overtime interval

If rounding is specified for an overtime interval and there is no rounding on day level, then the overtime inside the interval will be reduced to a multiple of the rounding value. If a wage type for remaining time is specified, a transaction is also created for the remainder with that wage type.

If minimum time is specified for the overtime interval, the reduction due to rounding will also reduce the total time inside the interval that is checked later when minimum times are checked.

Overtime/flexitime

The overtime may also be adjusted depending on the flexitime balance. The dependence between overtime and flexitime is controlled by the Flexi/Overtime attribute which is defined per wage group. This attribute can have the following values:

  • No check
    There is no adjustment of overtime and flexitime.
  • Reduce negative flexitime
    Negative flexitime is not allowed in combination with overtime. Reduction of negative flexitime is done only if the day scheme requires full time before overtime.
  • Convert all flexitime

If the Flexi/presence attribute is YES, then overtime is not reduced but the flexitime balance is set to zero.

If Flexi/presence is NO, overtime and negative flexitime are reduced. The reduction is first done for the overtime created at the beginning of the day or at the end of the day. If there still is negative flexitime and overtime, the remaining overtime transactions are processed until there is neither negative flexitime nor overtime.

The reason for this order is that overtime giving the highest compensation should be reduced first. There is no information connected to the wage type that tells anything about the compensation, but usually the wage types used for the outermost intervals have the highest compensation.

Convert all flexitime means that if there is overtime, then positive flexitime will also be converted to overtime. If you, for instance, clock in before start of working hours and get flexitime and then clock out in the evening requesting overtime, the flexitime will automatically be converted to overtime. Negative flexitime is processed in the same way as described above.

Rounding total overtime

If rounding of overtime is defined in the day scheme, the total overtime of the day will be rounded to a multiple of the rounding value. The total overtime is reduced with the remainder from the rounding. When rounding is done for the total overtime no rounding is done for overtime intervals.

The reduction is first done for the transaction inside the last overtime interval of the day, if it exists. If there still is time to be reduced, the overtime transactions are processed in ascending order by time.

If a wage type for remaining time is specified in the day scheme, a transaction with the remainder is created with this wage type. If there is no wage type for remaining time the remainder is dropped.

Calculations for lunch zone

Flexitime at lunch

When a flexitime interval is specified at lunch, the calculation depends on whether you have clocked for lunch or not. Clocked for lunch means that you have both clocked out and clocked in during the flexitime interval at lunch without using a time code for absence.

When clocked for lunch the clocked lunch time is compared to the minimum and maximum values. If less than minimum the lunch time is set equal to the minimum value and the time below the minimum is dropped. If the lunch time is greater than the maximum value it is set equal to the maximum value and the time exceeding the maximum gets wage type for time exceeding maximum lunch specified in the scheme. Flexitime is calculated as the difference between standard lunch and lunch time after adjustments.

Presence time during the lunch zone depends on the wage group attribute Flexi/presence. If the value of the attribute for the current wage group is NO, presence is calculated as the difference between the length of the lunch zone and the standard lunch. If the value is YES, presence is calculated as the difference between the length of the lunch zone and lunch time after adjustments for minimum or maximum lunch time. In both cases the presence time will also be reduced by absence during the lunch and time exceeding maximum lunch time.

It is also possible to clock for lunch using a time code for overtime. If the actual lunch break is less than the standard lunch time, a transaction with overtime is created instead of flexitime. The overtime created during lunch is then checked and adjusted according to the same rules as overtime created at the start or the end of the day.

When not clocked for lunch no time is calculated for the standard lunch interval. The flexitime interval outside the standard lunch interval is calculated according to normal rules for presence and absence during the interval of expected presence time. This means that time between in and out (present) will be presence time with a wage type from the day scheme. Time between out and in (not present) will be absence if a time code for absence has been used or dropped if no time code has been used.

No flexitime at lunch

When there is no flexitime at lunch, the time during the lunch break has no influence on calculated time except when you clock out or in during the lunch break with a code for overtime. The overtime created during lunch is then checked and adjusted according to the same rules as overtime created at the start or the end of the day.

Overlapping intervals

Overlapping intervals are used to create transactions for different types of time (presence, absence, flexitime, etc.) in addition to those created in the base calculation. They also specify for which specific wage type transactions shall be created.

All transactions with the specified time from the base calculation are compared with the overlapping intervals in the day scheme. If the transaction and the interval are overlapping, a transaction is created with the overlapping time and wage type from the overlapping interval.

If minimum time is specified for an overlapping interval the total time of all transactions created from the interval is calculated and later compared to the minimum time.

Check minimum time

For overtime intervals and overlapping intervals a minimum time can be specified. After the base calculation, adjustment of overtime and creation of transactions from overlapping intervals the total time for transactions created from intervals with minimum time is compared to the minimum time. If the total time is less than the minimum, a new transaction with negative time is created for all original transactions.

Create balances

Day balances

The time transactions for an employee and date are summed up to day balances. There are two types of day balances; total and detailed balances. The total day balance is the total hours per employee, date and wage type. In the detailed balances the time is also divided per reference according to the clocked start and stop times for manufacturing operations, project activities, etc. For manufacturing time the detailed balance also contains reported quantities.

For overtime the actual total balance may be less than the requested overtime. If this is the case the time between start and stop must be adjusted when the detailed balances are created so that the sum still will be equal to the total balance.

For example: Ordinary work ends at 5 p.m. and you clock out at 7 p.m. requesting overtime. You clocked in late in the morning getting negative flexitime; 0,5 hours. Between 5 p.m. and 7 p.m. you worked 0,5 hours in project A and 1,5 hours in project B. Requested overtime is 2 hours, but actual overtime will be 1,5 after reduction of negative flexitime. The ratio between actual and requested overtime is 1,5/2 = 0,75. The time for each project will be adjusted with the factor 0,75 giving 0,38 hours for project A and 1,12 hours for project B.

If there is time without a reference, a detailed balance is created with reference equal to the home cost centre of the employee so that the sum of all detailed balances for a wage type initially is equal the total balance.

If the Calculate manufacturing balances attribute is YES for an employee, detailed balances for manufacturing time are not created by dividing the presence time according to the clocked start and stop times. Instead, the balances are created from manufacturing transactions. The detailed balances contain both hours and approved and rejected quantity, but the total balances only hours. A wage type is searched in the following order:

  • From operation or consolidated order.
  • From work centre in the transaction.
  • From work centre for the operation or consolidated order.

If a wage type cannot be determined no balance is created.

Calculation rules

The next step is to perform calculations from the calculation rules that are attached to the day scheme. These calculations are performed on the total balances. After the calculations, the detailed balances for a wage type are adjusted proportionally so that the sum will still be equal to the total balance of the wage type.

Period balances

Next, the period balances are updated with the total day balances. At the same time minimum and maximum tests are performed for those wage types that are tested daily. If the new balance is below minimum or above maximum, the balance is set equal to the minimum or maximum limit and the difference will update the wage type for minimum or maximum. If the balance of this wage type also will be outside the minimum or maximum limit, the balance is limited and the difference will update the wage type for minimum or maximum specified for this wage type. This continues until all balances with daily minimum and maximum tests are inside the minimum and maximum limits.

Finally, if the calculated date is the last day of the wage period or the year minimum and maximum, tests are performed for those wage types where the frequency for test is period or year. If the wage type for minimum and maximum also has minimum or maximum tests that are performed at the end of a period or year, these tests are then performed. This continues until all balances are inside the minimum and maximum limits.

Enquiries and printouts

  • Attest group enquiry
  • Employee enquiry
  • Day balance calc rule enquiry
  • Batch job error log

Related topics