Does anyone has "Leave Application Format" where leave is categorised into SICK & EARN LEAVE, here one needs to enter information into mysql throught PHP and retrive it.

I have few queries, how do I take care of following -
(1) If any public holidays comes between SL or EL and then it is
summed with either SL or EL taken.
(2) How do I take care of Saturday & Sunday.
(3) How do I take care of total SL or EL from outstanding balance of
SL(7 days) & EL(20 days).
(4) How do I generate a balance when any number of days has been
taken for any type of SL/EL.
(5) How do I generate a e-mail confirmation for request to Team
Manager for his approval after request for SL/EL has been made.
(6) How do I generate a final approval emails to both Team Manager
& HR-Manager about the confirmation that SL/EL has been
approved.

Any clue yo start with?

BR
srimks11@gmail.com