How to restrict employee from taking coming month's leave earlier?

Hello,
I have allocated one leave per month to the employee. Now I have a scenario, where The employee can take the pending leaves of the past month but he should not take the leave of the coming months earlier.
Does anyone know about the solution?
Thanks

@CodeOne Have you created leave allocation for upcoming month ?

If Yes, then there will be a way like you can allocate leave on start of new month only and not in advance, in this case employee will not able to create leaves which is not allocated yet to them.

@Hardik_Gadesha Yeah, that’s ok, but I have a scenario in which I have to allocate annual leave to the employee.
For example, I have to allocate 1.5 leaves per month to employees. So I have allocated 18 leaves to the employees in the period starting from 1-1-2022 to 31-12-22. So as per the current period, employees should be able to take leave only till November 2022, they should not be able to take 1.5 leave of December 2022.

So you have created leave allocation for x type of leave for y employeee, balance = 18 and period is 1.1.2022-31.12.2022 ? @CodeOne

@Hardik_Gadesha Yes, I have created it.

you can split this 1 entry in 12 entry for 12 months, ass 1.5 in every month entry

@Hardik_Gadesha That’s right, but I have to allocate 18 leaves by 1 entry. Any solution for that?
Thanks.

Then you have to go with custom code solution for this @CodeOne

@Hardik_Gadesha Ok I will try it. Thank you for the above all solution.