public override object Evaluate(PXCache cache, object item, Dictionary <Type, object> pars)
 {
     try
     {
         return(DepreciationCalc.GetRecoveryEndDate(cache.Graph, (FABookBalance)item));
     }
     catch (PXException ex)
     {
         throw new PXSetPropertyException(ex.Message, PXErrorLevel.Error);
     }
     catch
     {
         return(null);
     }
 }
        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);
        }
Ejemplo n.º 3
0
        public override void Verify(PXCache cache, object item, List <object> pars, ref bool?result, ref object value)
        {
            int?bookID = (int?)Calculate <BookID>(cache, item);

            try
            {
                value = DepreciationCalc.GetRecoveryEndDate(cache.Graph, (FABookBalance)item);
            }
            catch (PXException ex)
            {
                throw new PXSetPropertyException(ex.Message, PXErrorLevel.Error);
            }
            catch
            {
                value = null;
            }
        }