public static int GetBookPeriodsInYear(PXGraph graph, FABook book, int Year)
        {
            FABookYear year = DepreciationCalc.GetBookYear(graph, book.BookID, Year);

            if (year == null)
            {
                throw new PXException(Messages.FABookPeriodsNotDefined, book.BookCode, Year);
            }

            return(PXSelectGroupBy <FABookPeriod,
                                    Where <FABookPeriod.bookID, Equal <Required <FABookPeriod.bookID> >,
                                           And <FABookPeriod.finYear, Equal <Required <FABookPeriod.finYear> >,
                                                And <FABookPeriod.startDate, NotEqual <FABookPeriod.endDate> > > >,
                                    Aggregate <Count <FABookPeriod.finPeriodID> > >
                   .Select(graph, book.BookID, year.Year).RowCount ?? 0);
        }