protected virtual void FAOrganizationBook_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { FAOrganizationBook book = (FAOrganizationBook)e.Row; if (book == null) { return; } PXSetPropertyException disableRowException = null; FABookYearSetup setup = PXSelect <FABookYearSetup, Where <FABookYearSetup.bookID, Equal <Current <FAOrganizationBook.bookID> > > > .SelectSingleBound(this, new object[] { book }); if (setup == null && book.UpdateGL != true) { disableRowException = new PXSetPropertyException(Messages.CalendarSetupNotFound, PXErrorLevel.RowWarning, book.BookCode); } OrganizationFinYear nearestFinYear = FinPeriodRepository.FindNearestOrganizationFinYear(book.OrganizationID, "1900"); if (disableRowException == null && book.OrganizationID != FinPeriod.organizationID.MasterValue && book.UpdateGL == true && nearestFinYear == null) { disableRowException = new PXSetPropertyException(GL.Messages.OrganizationCalendarDoesNotExist, PXErrorLevel.RowWarning, PXAccess.GetOrganizationCD(book.OrganizationID)); } if (disableRowException != null) { PXUIFieldAttribute.SetEnabled <FAOrganizationBook.selected>(sender, book, false); sender.RaiseExceptionHandling <FAOrganizationBook.selected>(book, null, disableRowException); } }
public FABookPeriod FindLastNonAdjustmentOrganizationFABookPeriodOfYear(FAOrganizationBook book, string finYear, bool clearQueryCache = false, bool mergeCache = false) { CheckNotNullObjectContract(book, nameof(book)); CheckNotNullOrEmptyStringContract(finYear, nameof(finYear)); return(new Select < FABookPeriod, Where <FABookPeriod.finYear, Equal <Required <FABookPeriod.finYear> >, And <FABookPeriod.bookID, Equal <Required <FABookPeriod.bookID> >, And <FABookPeriod.organizationID, Equal <Required <FABookPeriod.organizationID> >, And <FABookPeriod.startDate, NotEqual <FABookPeriod.endDate> > > > >, OrderBy < Desc <FABookPeriod.finPeriodID> > >() .CreateView(Graph, clearQueryCache, mergeCache) .SelectSingle(finYear, book.BookID, book.OrganizationID) as FABookPeriod); }