finish the add and edit function. with fromdate and to date validation