Hello,
a last quick one just before christmas vacation. To show that you need sometimes to think creativly around corners to come to the desired result.
Assume an employee has got an on call duty (can be recorded in EC time sheet with a specific on call category time type). During the on call duty the employee needs to perform actual work. This work needs to be recorded as an attendance.
And the specific requirement of a customer is that working time during an on call service is to be paid at least for two hours starting from the employees first on call - work time.
So when an employee works only 10 minutes starting from 08:00 he gets paid for two hours.
Each other recorded hours within a 2 hours window starting from his first recorded time is covered by the fix 2 hours payment.
Subsequent hours recorded after this 2 hours window are normally paid.
An example:
Employee needs to work during an on call service from 06:00 - 07:00. The "2 hours windows" starts hence at 06:00 and ends at 08:00.
The employee gets for this 1 hour work 2 hours paid.
However, he needs to perform another work from 07:30 - 10:00 on the same day. The second record is partially inside the 2 hours window from 06:00 - 08:00. The result should be that for the second record the employee gets only 2.5 hours paid, cause the first 30 minutes are already covered by the first 2 hours payment.
Initial thoughts are that you need to detect the first time pair of the day and create a virtual 2 hours window and compare all other time recordings with this. But this is the wrong path. You can simply use our Aggregate Input and Split time valuation method to get the result.
Lets take a closer look.
The first part is: to create a 2 hours paytype regardless how many hours the employee has recorded.
First we need a time type group that collects all recorded on call - work time types:
A normal time type group that has got as input time type a new created On Call Work attendance time type.
Second we need a counter time type group that is later filled in a time valuation as soon as an on call work is recorded. So far it is only an empty time type group, but category is "counted events".
Third we need 2 other time type groups that are marked as pay types. They represent the time valuation result and this is what then gets filled at the end with our calculations and what is going to be send to payroll. We need 2 - one for the fix 2 hours payment and one for normal payment:
First the group that shall contain later on 2 hours - even when the employee records only 10 minutes:
Note that this group is set as a pay type, Ui component (that we can see the result in the time sheet) and it is of the category "counted events". Why this? Cause this pay type is going to be created based on a counted event (see above) and you need then as an output a paytype of category "counted event" as well.
But more on this later.
And last the time type group that we use to payout the "normal" hours beyond 2:
This one is flagged as pay type and UI component as well and shall contain the normal to be paid hours in the case the record is outside of the 2 hours window.
Now we are done with the preparation. Lets dive into the valuation rules.
First we cover the 2 hour fix payment.
As already mentioned, this is done on the basis of a "counted event". So when a time type on call work is recorded, the counter is set to 1.
This is done with a simple rule using "compare threshold and count event" valuation type:
This rule takes the time type group in which we collect the recorded on call work time types and compares it with 0 and puts if something exist into the above group. Due to the fact that the valuation type is "counted events" not the hours, but simply 1 is send to the above group.
Now we need to use a little trick to get out of this 1 value the desired 2 hours payment.
We use this created counter in another valuation rule and multiply it with 120. Why this? Remember, the value 1 is in the counter. Multiplied with 120 results in 120. This value is compared to 2 hours (value on the database: 120,00) and hence we get in the "below time type group" always a result of 120 or 2 hours:
Valuation type for this group is the "Aggregate Input group and split" function. So again: the counter with 1 is multiplied with 120 (see the factor in the lower input time type group section), compared with fix value threshold 2 hours and in the above section I assign a new time type group the time type group that is used for the 2 hours payment.
Lets check first if this works:
Yes, works. I recorded only 30 minutes of the time type On call - Work and the system calculates 2 hours of payment.
Now the second part: how to cover that after the 2 hours window a normal payment shall be done for any further on call work?
We need another valuation rule. This rule compares now the recorded on call work time hours that we collect in our 2nd time type group with another 2 hours threshold. But this time we do not use the counted event time type group, but the other time type group in which the real recorded hours a stored.
Input time type group is now as mentioned not a counted event, but the "normal" recorded on call work times. There can be multiple in it with different start / from times. This time we do not use a factor, but we just compare with the same valuation type than before, aggregate input group and split, again with the threshold 2 hours. And everything that is above is moved to the pay type time type group "on call work normal pay".
That´s it. Should already work, lets check:
Result looks good. I record from 06:00 - 09:00 and get as a result a 2 hours fix payment and 1 hour for "normal on call time".
But what about the 2 hours window - starting from the first record onwards which is 06:00. Does this work when I record multiple time types?
Yes it does - I reduce the first record to 06:30 only - the result of 2 hours fix pay remains.
And I create another record within the 2 hours window from 07:30 - 10:00. The first 30 minutes of this record is within the 2 hours window and hence already included in the 2 hours fix pay, but for the hours starting from 08:00 onwards "normal on call pay" shall be created. This unfortunately does not work. The valuation rules can´t identify the gaps inbetween.
For this constellation you would need your employees to simply over-record the gap. Means time recording from 06:00 - 10:00, result would than be 2 hours fix pay and 2 hours normal pay:
Might be that there is the possibility to force employees to record another timetype for the gap that does not count for the payment - this should work. But short before christmas vacation no time to test this out.
Hope this helps a bit, take care.
Volker