copied over procedure to calculate reamining absences