public virtual IEnumerable ViewDetails(PXAdapter adapter)
        {
            Amounts          amt    = Amts.Current;
            FixedAssetFilter filter = Filter.Current;

            if (amt != null && filter != null)
            {
                FACostDetailsInq graph         = CreateInstance <FACostDetailsInq>();
                AccountFilter    filterDetails = graph.Filter.Insert(new AccountFilter()
                {
                    AssetID     = filter.AssetID,
                    EndPeriodID = filter.PeriodID,
                    AccountID   = amt.AccountID,
                    SubID       = amt.SubID
                });

                filterDetails.StartPeriodID = null;
                filterDetails.BookID        = filter.BookID;
                graph.Filter.Cache.IsDirty  = false;
                throw new PXRedirectRequiredException(graph, true, "ViewDetails")
                      {
                          Mode = PXBaseRedirectException.WindowMode.Same
                      };
            }
            return(adapter.Get());
        }
        public virtual IEnumerable amts(PXAdapter adapter)
        {
            FixedAssetFilter filter = Filter.Current;

            if (filter == null || filter.AssetID == null || filter.PeriodID == null)
            {
                yield break;
            }

            FixedAsset asset = PXSelect <FixedAsset, Where <FixedAsset.assetID, Equal <Current <FixedAssetFilter.assetID> > > > .Select(this);

            PXSelectBase <FATran> select = new PXSelectJoin <FATran,
                                                             LeftJoin <Account, On <FATran.debitAccountID, Equal <Account.accountID> >,
                                                                       LeftJoin <Sub, On <FATran.debitSubID, Equal <Sub.subID> >,
                                                                                 LeftJoin <CreditAccount, On <FATran.creditAccountID, Equal <CreditAccount.accountID> >,
                                                                                           LeftJoin <CreditSub, On <FATran.creditSubID, Equal <CreditSub.subID> >,
                                                                                                     LeftJoin <FABookPeriod, On <FATran.bookID, Equal <FABookPeriod.bookID>,
                                                                                                                                 And <FATran.finPeriodID, Equal <FABookPeriod.finPeriodID> > >,
                                                                                                               LeftJoin <FABook, On <FATran.bookID, Equal <FABook.bookID> > > > > > > >,
                                                             Where <FATran.assetID, Equal <Current <FixedAssetFilter.assetID> >,
                                                                    And <FATran.finPeriodID, LessEqual <Current <FixedAssetFilter.periodID> >,
                                                                         And <FATran.released, Equal <True>,
                                                                              And <Where <FATran.tranType, NotEqual <FATran.tranType.calculatedPlus>,
                                                                                          And <FATran.tranType, NotEqual <FATran.tranType.calculatedMinus>,
                                                                                               And <FATran.tranType, NotEqual <FATran.tranType.reconcilliationPlus>,
                                                                                                    And <FATran.tranType, NotEqual <FATran.tranType.reconcilliationMinus> > > > > > > > > >(this);

            if (filter.BookID != null)
            {
                select.WhereAnd <Where <FATran.bookID, Equal <Current <FixedAssetFilter.bookID> > > >();
            }

            Dictionary <string, Amounts> dict = new Dictionary <string, Amounts>();

            foreach (PXResult <FATran, Account, Sub, CreditAccount, CreditSub, FABookPeriod> res in select.Select())
            {
                Account       dacct  = res;
                Sub           dsub   = res;
                CreditAccount cacct  = res;
                CreditSub     csub   = res;
                FATran        tran   = res;
                FABookPeriod  period = res;

                if (!IsAccrualAccount <FATran.debitAccountID, FATran.debitSubID>(tran, asset))
                {
                    Amounts record = null;
                    string  dkey   = string.Format("{0}{1}", dacct.AccountCD, dsub.SubCD);
                    if (!dict.TryGetValue(dkey, out record))
                    {
                        record = new Amounts
                        {
                            BookID    = tran.BookID,
                            AccountID = tran.DebitAccountID,
                            SubID     = tran.DebitSubID,
                            AcctDescr = dacct.Description,
                            SubDescr  = dsub.Description,
                            BranchID  = tran.BranchID,
                            ItdAmt    = 0m,
                            YtdAmt    = 0m,
                            PtdAmt    = 0m
                        };
                    }
                    record.ItdAmt += tran.TranAmt;
                    if (filter.PeriodID.Substring(0, 4) == period.FinYear)
                    {
                        record.YtdAmt += tran.TranAmt;
                    }
                    if (filter.PeriodID == tran.FinPeriodID)
                    {
                        record.PtdAmt += tran.TranAmt;
                    }
                    dict[dkey] = record;
                }

                if (!IsAccrualAccount <FATran.creditAccountID, FATran.creditSubID>(tran, asset))
                {
                    Amounts record = null;
                    string  ckey   = string.Format("{0}{1}", cacct.AccountCD, csub.SubCD);
                    if (!dict.TryGetValue(ckey, out record))
                    {
                        record = new Amounts
                        {
                            BookID    = tran.BookID,
                            AccountID = tran.CreditAccountID,
                            SubID     = tran.CreditSubID,
                            AcctDescr = cacct.Description,
                            SubDescr  = csub.Description,
                            BranchID  = tran.BranchID,
                            ItdAmt    = 0m,
                            YtdAmt    = 0m,
                            PtdAmt    = 0m
                        };
                    }
                    record.ItdAmt -= tran.TranAmt;
                    if (filter.PeriodID.Substring(0, 4) == period.FinYear)
                    {
                        record.YtdAmt -= tran.TranAmt;
                    }
                    if (filter.PeriodID == tran.FinPeriodID)
                    {
                        record.PtdAmt -= tran.TranAmt;
                    }
                    dict[ckey] = record;
                }
            }

            foreach (Amounts amt in dict.Values)
            {
                if (amt.ItdAmt != 0m || amt.YtdAmt != 0m || amt.PtdAmt != 0m)
                {
                    yield return(amt);
                }
            }
        }