Beispiel #1
0
        public virtual IEnumerable showPreload(PXAdapter adapter)
        {
            GLBudgetTree parentNode = PXSelect <GLBudgetTree, Where <GLBudgetTree.groupID, Equal <Required <GLBudgetTree.groupID> > > > .Select(this, this.CurrentSelected.Group);

            PXStringState subStrState = (PXStringState)Details.Cache.GetStateExt(null, typeof(GLBudgetTree.subID).Name);
            string        subWildCard = new String('?', subStrState.InputMask.Length - 1);

            if (parentNode != null)
            {
                PreloadFilter.Current.AccountCDWildcard = SubCDUtils.CreateSubCDWildcard(parentNode != null ? parentNode.AccountMask : string.Empty, AccountAttribute.DimensionName);
                if (parentNode.AccountMask != null)
                {
                    Account AcctFrom = PXSelect <Account, Where <Account.active, Equal <True>,
                                                                 And <Account.accountCD, Like <Required <SelectedNode.accountMaskWildcard> > > >,
                                                 OrderBy <Asc <Account.accountCD> > > .SelectWindowed(this, 0, 1, PreloadFilter.Current.AccountCDWildcard);

                    Account AcctTo = PXSelect <Account, Where <Account.active, Equal <True>,
                                                               And <Account.accountCD, Like <Required <AccountsPreloadFilter.accountCDWildcard> > > >,
                                               OrderBy <Desc <Account.accountCD> > > .SelectWindowed(this, 0, 1, PreloadFilter.Current.AccountCDWildcard);

                    PreloadFilter.Current.FromAccount = AcctFrom != null ? AcctFrom.AccountID : null;
                    PreloadFilter.Current.ToAccount   = AcctTo != null ? AcctTo.AccountID : null;
                }
                else
                {
                    PreloadFilter.Current.FromAccount = null;
                    PreloadFilter.Current.ToAccount   = null;
                }
                PreloadFilter.Current.SubIDFilter = parentNode.SubMask ?? subWildCard;
            }
            else
            {
                PreloadFilter.Current.FromAccount = null;
                PreloadFilter.Current.ToAccount   = null;
                PreloadFilter.Current.SubIDFilter = subWildCard;
            }
            if (PreloadFilter.Current != null)
            {
                if (parentNode != null)
                {
                    if (parentNode.AccountMask != null && PreloadFilter.Current.FromAccount == null)
                    {
                        if (Details.Ask(Messages.BudgetTreePreloadArticlesTitle, String.Format(PXMessages.LocalizeNoPrefix(Messages.BudgetTreePreloadArticlesMessage), parentNode.AccountMask), MessageButtons.OK) == WebDialogResult.OK)
                        {
                            return(adapter.Get());
                        }
                    }
                }
            }
            Details.AskExt();
            return(adapter.Get());
        }