public virtual IEnumerable nextperiod(PXAdapter adapter) { GLHistoryEnqFilter filter = Filter.Current as GLHistoryEnqFilter; int?calendarOrganizationID = FinPeriodRepository.GetCalendarOrganizationID(filter.OrganizationID, filter.BranchID, filter.UseMasterCalendar); FinPeriod nextPeriod = FinPeriodRepository.FindNextPeriod(calendarOrganizationID, filter.FinPeriodID, looped: true); filter.FinPeriodID = nextPeriod != null ? nextPeriod.FinPeriodID : null; return(adapter.Get()); }