as promised, I gonna give you some insights from time to time how to solve challenging and complicated business requirements in EC Time Valuation. This shall give you some input to creatively explore what is possible with our time valuation engine. I know that we still have gaps and we are contantly hard working to close them – but I also believe that only few know in detail what tricky scenarios can already be solved with our time valuation engine. This blog shall help to overcome this. It shall help you to solve customer problems and make them happy. In the end, this is what we all want to do.
So, a often heard requirement in the Middle East / North Africa region is to perform a salary deduction when an employee comes late. But it is not only a plane salary deduction, there are some specifis in it, some limits and boundaries and escalation steps.
The concrete customer requirement is: When a positive clock time based time recorder (or duration) comes late compared with his work schedule he gets a salary deduction. But there are escalations steps:
- When he is late for at maximum 15 minutes nothing happens. This is waved through and no salary deduction performed.
- When the employee is late between 15minutes and 30minutes he gets a salary deduction in the height of all late-minutes (not only from 15 onwards !) plus an additional 1 hour deduction.
- When the employee is late more than 30 minutes he gets a salary deduction of the late minutes / hours plus additional a 2 hours salary deduction.
Quite tricky. But we can do it. I show you step by step what you need to configure.
But first some basic conditions needs to be mentioned:
1) EC Time can of course not perform a salary deduction. This can only be done by a payroll engine. But EC Time can calculate the pay types (in SAP speech: wage types) with the hours amount. This pay type is replicated to EC Payroll or SAP onprem Payroll into the Infotype 2010. There payroll can read it and perform a salary deduction. For other payroll providers: our pay types can be extracted via APIs
2) It is currently not yet possible to detect the late coming constellation of an employee by only evaluating the recorded attendance times. For the late coming requirement it is necessary to detect the 1st time pair on a working day. Cause the employee can have multiple on a day like for example:
08:15 – 10:30 working time
10:30 – 11:00 Break
11:00 – 13:00 working time
13:00 – 15:00 Absence doctors appointment
15:00 – 17:00 Working time
And when we just take the time pairs and compare it with the start time of the days work schedule time each subsequent recorded attendance time would fulfill the condition “late coming”. Hence it is relevant to check only the first recorded attendance time slice of a day – but as said, this is unfortunately not yet possible (but on the backlog list). So, we need to find a workaround.
The workaround is that employees have to record an absence time type for the late coming hours.
This is indeed very often seen in business practice amongst customers. Cause with an absence you can trigger a specific notification or approval and a late coming is then not unnoticed by managers.
So, how is it actually done in the configuration? I use mainly the time valuation function: Compare Threshold with Input Groups to Route Inputs. But before I come to this, of course an absence time type is needed to be configured that covers the late part and a step that put the recorded absence hours into a time type group to have it available in the time valuation engine.
The configuration of the absence is quite simple, it is an absence that does not do any time account deduction and that is allowed to be recorded in hours and minutes:
This absence is then assigned to a time profile. The time profile itself is assigned to the employee in the job information and steers which time types are available for this employee overall and which are available for his ESS scenarios Time Sheet and Time Off.
Now we need to direct the absence hours recorded with this time type into a time type group. The time type group is the essential container for calculations in time valuation (can be compared a bit to the technical time types in table T555 in SAP ERP). We gonna need some more time type groups to cover the reqirement. The first one looks like this:
The specified time type at the bottom is exactly the absence time type I have created in the previous step. I have choosen the category “unpaid absence” for this time type group and it is no UI component (means it is not displayed in the time sheet cause we need it only for calculation purposes) and it is neither a time pay type cause we don´t want to transfer this hours to the payroll. We need first to do lots of other calculations before we can transfer something to payroll.
Now we got the hours collected that are recorded with the absence time type “Late coming”. Now comparisons need to be done. And here I use the valuation function “Compare Threshold with Input Groups to Route Inputs”.
Valuation Step 1:
So, it is necessary first to compare if the late coming hours are bigger 15 minutes. Cause below 15 minutes nothing shall happen or be calculated. Those absence times are simply ignored. The interesting part is when the absence is longer than 15 minutes.
This valuation rule compares the time type group “late coming hours” that is stated in the below section as “Input time type group” with the fix value 0.25 (15 minutes). The same time type group is used as comparison group in the “comparison group” field. You might wonder why the “late coming hours” is used twice. Well, this is how the Route function works. The important part of the route function is: it takes the value in the “Input time type group” section and is sending (routing) it to the defined “Time type group above”. This is however only done based on the conditions defined in the rule. And the conditions are: when in the comparison time type group per day a value is detected that is bigger than 0. And here we just use the fact when late hours exist at all, hence we can use the same time type group. In the other rules I need (see below) comparison and input time type group is different.
You can read here a bit more on the “route function”:
New valuation type Route Input
The time type group stated in the “above” section that we use for further calculations looks like this:
Step 1 finished. We got now all recorded late hours above 15minutes in a time type group. Now I need to check if this value is bigger than 30 minutes – cause remember, when more than 30minutes there shall be an additional deduction of 2 hours instead of only 1 hour for the late hours below 30.
Hence another Compare and Route rule is needed:
I check in this valuation rule if the time type group that contains the late hous > 15 (the comparison group) is bigger than 0.5hours (30 minutes). If yes, I take the late hours that are assigned in the “Input time type group” section and route it into another time type group called “Deduction Late 2”, and when not, when the value is not bigger than 30minutes the late hours are put into the “time type group below”, Deduction late 1. And the specifics with Deduction Late 1 and Deduction Late 2 time type group is that they are marked as UI components AND as paytypes. So, we got here already a result that can be transferred to Payroll.
To recap: we checked if an recorded absence is bigger than 15minutes. If not it does not matter. But if so, we checked the absence hours that are bigger than 15minutes (valuation step 1) if they are bigger than 30 minutes and if not, we generate a paytype for all recorded absence hours of the asence “late coming”. But when bigger we create a different paytype “Deduction late 2”. Why are those 2 different pay types necessary? Couldn´t it be simply the same. No. Cause we need to add 1 hour in case if there is a result in the Deduction Late 1 (below 30minutes late) and 2 hours when there is a result in Deduction Late 2 (above 30 minutes). But before we move on that illustrates this, lets first check if the first two rules work (you need to assign the rules to a time recording profile first of course).
Lets first record the absence “Late hours” with only 14minutes:
Good. Nothing gets calcualted.
Now lets change the absence duration to 16 minutes:
Hey ho. Not bad. There is a paytype generated for the full duration of the recorded absence: Deduction Late 1 with 16 minutes. And now the tricky part – what if the absence duration is bigger than 30minutes? I change the duration to 45 minutes:
Well, perfect! The “Deduction Late 1” paytype vanishs and instead a “Deduction Late 2” paytype is generated with 45 minutes. Well done ;-).
Now we need to face the second part of the requirement: adding 1 additional deduction hour when the employee is late up to 30minutes and 2 hours when he is late more than 30minutes. Unfortunately, we need some more valuation rules for this and we need to stretch the possibilities of the current time valuation functions to its limit ;-).
Valuation Step 3:
We need to create a counter for the “late coming fact” below 30minutes and another counter for late coming above 30 minutes. Why a counter? Well, it is a kind of workaround tool. Cause we can´t currently simply add some fix hours to a pay type. This is not yet possible. But the counter gives this possibility in an indirect way. So, we need first set up 2 counters via the already known “time type groups”. But be aware: this time the categroy is not “calculated time” like for the other groups defined above, but “count events”. An event counter counts simply the value 1 when a condition is met. This is the counter that helps us adding 1 hour:
And this is the counter that helps us adding 2 hours:
Now we need to calculate the counter. Does unfortunately not help when they are only created as time type groups 😉
Counter 1 shall be calculated when the employee is more than 15min late, but less than 30minutes.
Counter 2 shall only be created when the employee is late more than 30minutes. We need some time valuation rules for this, but luckily not complicated ones:
This rule checks if something (threshold value is 0) is in the time type group stated in the “Input time type group section”. And here I have assigned our already calculated pay type “Deduction late 1”. So, whenever the previous calculations have calculated a value for this (remember, this is the result of the above 15 and below 30 minutes late coming hours calculations) a counter with value 1 is created per day. And we can apply same logic for the Counter 2, but this time we check the result of the “Deduction Late 2” that contains the result for the late hours beyond 30minutes:
Okay, we count now the events of late coming. But why?
In order to multiple this counters with 60/120 to create a paytype for the deduction of 1 hour (or 60 minutes) respective 2 hours (or 120 minutes). So, we need first 1 new time type group marked as pay type (that it can be transferred to payroll) and UI component (cause we want to display this in the time sheet UI). Please note, due to the fact that we calculate something based on a counter this time type groups need also to be of the category “counted events”. Once time a counter used, all time a counter needed. Don´t bother any longer, technical things. You will get an error when you want to use in a rule that contains a counter something else that is not a counter ;-). I label this time type group “Additional Deduction” and it looks like this:
And how is the generation of 1 respective 2 additional hours done? We need again a time valuation rule that does this:
This valuation has our 2 counters as input time type groups. We can use one rule for creating a result, cause either a value is in counter 1 or in counter 2. Additionally I give a factor of 60 for counter 1 (late up to 30minutes) – the normal counter value 1 gets multiplied with 60 to get 60 minutes. And a factor 120 for the second counter (late beyond 30 minutes) to get 120minutes.
I compare the factored values with threshold 0 and put the value (any value other than 0, but can in fact be only 60 or 120) into the “time type group above” where I maintained the “Additional Deduction” Pay type.
So, whenever there is an event of late coming below 30minutes we have previously build a counter. This counter is taken in this rule, multiplied with 60 and a pay type created with the value 60 minutes – or 1 hour.
And whenever there is an event created late coming above 30 the counter value 1 is multiplied with 120 and a paytype created with 120minutes or 2 hours. This is why we needed in above described valuation step to create two different counters.
But does this work? Lets try it:
First an absence with 14 minutes is recorded:
No results. Well, could have been luck ;-). Lets try it with a 16 minutes absences:
Okay. We got the 16 minutes Deduction Late 1 that I have already previously shown that this works. But on top, there is now an additional pay type “Additional Deduction” of 1 hour. Very good.
And the last piece? The 2 hours deduction when the employee is late more than 30minutes?
Fantastico. Works perfect. I created an absence of 31 minutes and not only the pay type for the 31 minute deduction is created, but also the 2 additional hours.
And it even works when I have created 2 absences in the week, both with 31 minutes. All in all the result is Deduction late 2: 1:02, and 4 additional deduction hours:
So, you see with a bit of creativity our engine is already quite strong and challenging checks and calculation can be made. All in all I needed 5 time type groups and 5 time valutions. You see the rules assigned in my time recording profile:
Hope this was helpful for you. For me it was – cause for me its just like for you as consultants / implementers: practice brings proficiency.
Regards and happy implementing