Symptom
Using the rule function 'getAbsenceInDaysForPeriodBasedOnWorkingDays' in an accrual rule, the result is for a particular month, is different depending on the leave dates.
Reproducing the Issue
1. Request is from the 1st - 31st of December, for a time type with a counting method which does not consider holidays, and Saturday and Sunday as non working days, the result is 21 days for this rule function.
The result of the lookup is also 21, so the accrual for December is 0 days (21 divided by 21) as they expected / wanted, considering the employee on leave for the whole month.
2. If the request spans over the whole month of December (example 6 Nov 2017- 14 Jan 2018), the result for rule function 'getAbsenceInDaysForPeriodBasedOnWorkingDays' is 20 days, giving an accrual of .1 days for December (20 divided by 21. rounds up to .1).
Cause
This rule function returns values in the following ways:
In case the employee time is longer than the rule function selection period (longer than that month example: > 1st Dec = 31 Dec, so 6 Nov 2017 - 14 Jan 2018), we check each employee time calendar and take the quantity in days and sum it up. Which in this case is 20 days (because the 25th December is a public holiday).
If the employee time is within the selection period (the month in question - 1st - 31st Dec), we take directly the quantity in days value from the employee time (check the employee time in manage data, Number of Days here would show 21 days).
So in summary, the employee time shows value 21 days which reflects the counting method on the time type, although the sum of the employee time calendar is only 20 (because the 25th Dec is a holiday and is considered here).
The rule function works as designed. It works based on work schedule and holiday calendar and not based on deduction quantity, which is maybe not some customer expect.
Resolution
If you want to always consider the deduction quantity, you should raise an enhancement to request a rule function which does this, please see reference KBA on the same.
See Also
Keywords
getAbsenceInDaysForPeriodBasedOnWorkingDays,deduction quantity, quantity in days , KBA , LOD-SF-EC-TIM , Time Off , Problem