Exemple #1
0
        public virtual IEnumerable ViewDetails(PXAdapter adapter)
        {
            Amounts amt = Amts.Current;
            AccBalanceByAssetFilter filter = Filter.Current;

            if (amt != null && filter != null)
            {
                FACostDetailsInq graph         = CreateInstance <FACostDetailsInq>();
                AccountFilter    filterDetails = graph.Filter.Insert(new AccountFilter()
                {
                    AssetID     = amt.AssetID,
                    EndPeriodID = filter.PeriodID,
                    AccountID   = filter.AccountID,
                    SubID       = filter.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 transactions(PXAdapter adapter)
        {
            AccountFilter filter = Filter.Current;

            if (filter == null)
            {
                yield break;
            }

            PXSelectBase <Transact> cmd = new PXSelectJoin <Transact, LeftJoin <FixedAsset, On <Transact.assetID, Equal <FixedAsset.assetID> > >, Where <Transact.origin, Equal <FARegister.origin.split>, And <Transact.released, Equal <True>, And <Where <FixedAsset.assetID, Equal <Current <AccountFilter.assetID> >, And <Transact.tranType, Equal <FATran.tranType.purchasingMinus>, Or <FixedAsset.splittedFrom, Equal <Current <AccountFilter.assetID> >, And <Transact.tranType, Equal <FATran.tranType.purchasingPlus> > > > > > > > >(this);

            if (filter.BookID != null)
            {
                cmd.WhereAnd <Where <Transact.bookID, Equal <Current <AccountFilter.bookID> > > >();
            }

            foreach (Transact tran in cmd.Select())
            {
                if (tran.TranType == FATran.tranType.PurchasingPlus)
                {
                    tran.DebitAmt  = tran.TranAmt;
                    tran.CreditAmt = 0m;
                    tran.AccountID = tran.DebitAccountID;
                    tran.SubID     = tran.DebitSubID;
                }
                else if (tran.TranType == FATran.tranType.PurchasingMinus)
                {
                    tran.CreditAmt = tran.TranAmt;
                    tran.DebitAmt  = 0m;
                    tran.AccountID = tran.CreditAccountID;
                    tran.SubID     = tran.CreditSubID;
                }
                else
                {
                    continue;
                }
                yield return(tran);
            }
        }
Exemple #3
0
        public virtual IEnumerable transactions(PXAdapter adapter)
        {
            AccountFilter filter = Filter.Current;

            if (filter == null)
            {
                yield break;
            }

            PXSelectBase <Transact> select = new PXSelectJoin <Transact,
                                                               LeftJoin <FABook, On <Transact.bookID, Equal <FABook.bookID> > >,
                                                               Where <Transact.assetID, Equal <Current <AccountFilter.assetID> >,
                                                                      And <Transact.released, Equal <True> > > >(this);

            if (!string.IsNullOrEmpty(filter.StartPeriodID))
            {
                select.WhereAnd <Where <Transact.finPeriodID, GreaterEqual <Current <AccountFilter.startPeriodID> > > >();
            }

            if (!string.IsNullOrEmpty(filter.EndPeriodID))
            {
                select.WhereAnd <Where <Transact.finPeriodID, LessEqual <Current <AccountFilter.endPeriodID> > > >();
            }

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

            if (filter.AccountID != null)
            {
                select.WhereAnd <Where <Transact.debitAccountID, Equal <Current <AccountFilter.accountID> >, Or <Transact.creditAccountID, Equal <Current <AccountFilter.accountID> > > > >();
            }

            if (filter.SubID != null)
            {
                select.WhereAnd <Where <Transact.debitSubID, Equal <Current <AccountFilter.subID> >, Or <Transact.creditSubID, Equal <Current <AccountFilter.subID> > > > >();
            }

            foreach (Transact tran in select.Select())
            {
                if ((filter.AccountID == null || filter.AccountID == tran.CreditAccountID) && (filter.SubID == null || filter.SubID == tran.CreditSubID))
                {
                    Transact tranCredit = (Transact)Transactions.Cache.CreateCopy(tran);
                    tranCredit.AccountID = tran.CreditAccountID;
                    tranCredit.SubID     = tran.CreditSubID;
                    tranCredit.CreditAmt = tran.TranAmt;
                    tranCredit.DebitAmt  = 0m;
                    yield return(tranCredit);
                }

                if ((filter.AccountID == null || filter.AccountID == tran.DebitAccountID) && (filter.SubID == null || filter.SubID == tran.DebitSubID))
                {
                    Transact tranDebit = (Transact)Transactions.Cache.CreateCopy(tran);
                    tranDebit.AccountID = tran.DebitAccountID;
                    tranDebit.SubID     = tran.DebitSubID;
                    tranDebit.CreditAmt = 0m;
                    tranDebit.DebitAmt  = tran.TranAmt;
                    yield return(tranDebit);
                }
            }
        }