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