Add check for active agreement in query for managing timesheets