ERPNext HR Leave

Hi.
I would like to find out if is posible to limit how many days all employes can take in particular mounth.

for example employes have 22 days each, but in one month all eployes can take only 15 days.

You may have to write a server script for such rules.

Maybe somebody could help me out with this? i,m kinda newbie what comes to scripting