Technical Articles
Blocking Leave Beyond Current Payroll Period
Hi All,
This Blogs explains how to Stop an employee to apply leave beyond Payroll Period. This is one of our client requirement and we achieved through the below Business rule
Requirement: Client Payroll Period is 26th to 25th of Every month. Employees are not allowed to apply leave in this window.
Solution Steps:
- Write Business rule by using Variables
- Assign Business rule to Time Type
- Result
1. Business Rule using Variables: Create Business rule under Time Management –> Absence Validation scenario.
Create two variables:
- Previous_Month_26th –> Get the Previous month 26th in to this variable and store
- Current_Month_25th –> Get the current month 25th date in this variable and store
Please find the screenshot for your reference
Compare these two dates with Employee time start date.
If employee Time start date is before 26th of previous month throw the error & Else if Employee Time start date is after 25th of current month then throw the error.
Please find the below screenshot for your reference.
2. Assigning Business rule to Time Type: Assign this rule to the Time type under Take Rules
Please find the below screenshot for your reference.
3. Result: Employee Apply a leave (Start Date) beyond the Payroll window. System throw error message. Please find the below screenshot for reference.
Hope this Blog helps you to accommodate similar kind of requirement & it helps you to know how to use variables to simplify the business rule & process Business rules efficiently.
Regards,
Manjunath BK
Good use of the rule; however why to hard code, The pay calendar changes sometimes, I would rather do this.
Hi Prasanna,
yea, you can do this as well, if you configured Pay calendar in the system.
Hi Manjunath,
Thanks for sharing the logic.
My client also requires the same logic. From Previous Month 26th till current month 25th is their payroll period. And they are giving one day grace period to apply leave for that period and the window should get closed by 26th of current month.
Condition-1 : - After 26th of current they shouldnot be able to apply leave for previous period
Condition-2 :- For the Current period ( i.e., 26th of current month onwards, system should allow to apply leaves).
Using the logic, we could test first condition but second condition is not met, if we try for second condition then first one is not met.
Can you suggest how can we get the logic which works for both.
Thanks & Regards
Surya Rani
Hi Surya,
Yes, if your current date (today's date) is on or after 26th then it should work fine.
Please check and let me know if you need more suggestion