babynus wrote:
floor (DATEDIFF(CURDATE(),${Employee.startDate}) / ( 365 * 5 ) )
floor((YEAR(NOW()) - YEAR(${Employee.startDate}) - IF( DAYOFYEAR(NOW()) < DAYOFYEAR(${Employee.startDate}) , 1, 0)) / 5)
In fact both formulas are wrong, as extra day off for seniority is generally calculated only at the end of the vesting period
I come back on that.. If projeqtor calculate Special right
ONLY at the end of vesting period, the 2nd formula is accurate...
for exemple : acquisition period from 1st june - 31th may with a employe start on october 2015
at 31th of may 2020 (end of vesting period) floor((YEAR(NOW()) - YEAR(${Employee.startDate}) = 2020-2015 = 5
so 5/5 should lead to 1 seniority day
but as his start day is
AFTER 31th may, he should not have that because he des'nt have full 5Y presence at vestling end period date ..
that why "-IF( DAYOFYEAR(NOW()) < DAYOFYEAR(${Employee.startDate}) , 1, 0)" will remove 1 year , with DAYOFYEAR(NOW())= end of vesting date (31th may)
so that floor (4/5) = 0 and not one ...
just have to know exactly
WHEN those special rights are calculated
and I still don't manage to make seniority calculation works properly for other employes... BTW as our vacancy can be anticipated (i.e. taken before end of vesting period), I've got a delay before use of 1 month. Pressing initialise with contractual values, with a period from 1st of june to 31may, leads to a initialise value of 2 days initialised (1st-june to 31thjune) without any calculation from previous period for seniority.