Code suddenly breaks. When I debug I found intvNo method which used to calculate days interval between two dates is not working.
intvNo(empLeave1.EndDate,periodStartDate,IntvScale::Day);
I have replace it with following way.
date2Num(periodEndDate) -date2Num(periodStartDate);