示例#1
0
        private void InsertInitializationActivity(string activity, string comment)
        {
            var row = Initializations.Insert();

            row.Activity = activity;
            row.Comment  = comment;
        }
示例#2
0
        protected virtual void CRSetup_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
        {
            CROpportunityProbability p = OpportunityProbabilities.Select();

            if (p == null)
            {
                p.StageCode   = "A";
                p.Probability = 60;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "L";
                p.Probability = 0;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "P";
                p.Probability = 10;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "Q";
                p.Probability = 20;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "R";
                p.Probability = 80;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "V";
                p.Probability = 40;
                OpportunityProbabilities.Insert(p);
                p.StageCode   = "W";
                p.Probability = 100;
                OpportunityProbabilities.Insert(p);
                OpportunityProbabilities.Cache.IsDirty = false;
            }
        }
示例#3
0
 private void InitOpportunityProbabilities()
 {
     using (ReadOnlyScope scope = new ReadOnlyScope(OpportunityProbabilities.Cache))
     {
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "L", Name = Messages.StageProspect, Probability = 0, SortOrder = 0
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "N", Name = Messages.StageNurture, Probability = 5, SortOrder = 5
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "P", Name = Messages.StageQualify, Probability = 10, SortOrder = 10
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "Q", Name = Messages.StageDevelop, Probability = 20, SortOrder = 20
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "V", Name = Messages.StageSolution, Probability = 40, SortOrder = 40
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "A", Name = Messages.StageProof, Probability = 60, SortOrder = 60
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "R", Name = Messages.StageClose, Probability = 80, SortOrder = 80
         });
         OpportunityProbabilities.Insert(new CROpportunityProbability()
         {
             StageCode = "W", Name = Messages.StageDeploy, Probability = 100, SortOrder = 100
         });
     }
 }
示例#4
0
        protected virtual void InsertPreloadedNodes(IEnumerable <GLBudgetTree> nodes)
        {
            bool hadError = false;

            foreach (GLBudgetTree node in nodes)
            {
                try
                {
                    Details.Insert(node);
                }
                catch (PXSetPropertyException)
                {
                    hadError = true;
                }
            }

            if (hadError)
            {
                throw new PXException(Messages.SubaccountSegmentValuesWereDeactivatedWontLoad);
            }
        }
示例#5
0
        protected virtual IEnumerable consolRecords(
            [PXDBString]
            string ledgerCD,
            [PXDBString]
            string branchCD
            )
        {
            Ledger ledger = PXSelect <Ledger,
                                      Where <Ledger.consolAllowed, Equal <True>,
                                             And <Ledger.ledgerCD, Equal <Required <Ledger.ledgerCD> > > > > .Select(this, ledgerCD);

            Branch branch = PXSelect <Branch,
                                      Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .Select(this, branchCD);

            if (ledger == null)
            {
                throw new PXException(Messages.CantFindConsolidationLedger, ledgerCD);
            }

            if (!string.IsNullOrEmpty(branchCD) && branch == null)
            {
                throw new PXException(Messages.CantFindConsolidationBranch, branchCD);
            }

            var exportSubaccountMapper = CreateExportSubaccountMapper();

            var noSegmentsToExport = false;

            if (PXAccess.FeatureInstalled <FeaturesSet.subAccount>())
            {
                noSegmentsToExport = SubaccountSegmentsView.Select()
                                     .RowCast <Segment>()
                                     .All(segment => segment.ConsolNumChar <= 0);
            }

            PXSelectBase <GLHistory> cmd = new PXSelectJoin <GLHistory,
                                                             InnerJoin <Account, On <Account.accountID, Equal <GLHistory.accountID> >,
                                                                        InnerJoin <Sub, On <Sub.subID, Equal <GLHistory.subID> >,
                                                                                   InnerJoin <Ledger, On <Ledger.ledgerID, Equal <GLHistory.ledgerID> >,
                                                                                              InnerJoin <Branch, On <Branch.branchID, Equal <GLHistory.branchID> > > > > >,
                                                             Where <Ledger.ledgerCD, Equal <Required <Ledger.ledgerCD> >,
                                                                    And <GLHistory.accountID, NotEqual <Current <GLSetup.ytdNetIncAccountID> > > >,
                                                             OrderBy <Asc <GLHistory.finPeriodID, Asc <Account.accountCD, Asc <Sub.subCD> > > > >(this);

            if (!string.IsNullOrEmpty(branchCD))
            {
                cmd.WhereAnd <Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > >();
            }

            foreach (PXResult <GLHistory, Account, Sub> result in cmd.Select(ledgerCD, branchCD))
            {
                GLHistory history = result;
                Account   account = result;
                Sub       sub     = result;

                string accountCD = account.GLConsolAccountCD;
                string subCD     = exportSubaccountMapper.GetMappedSubaccountCD(sub);

                if (accountCD != null && accountCD.TrimEnd() != "" &&
                    (subCD != null && subCD.TrimEnd() != "" || noSegmentsToExport))
                {
                    GLConsolData consolData = new GLConsolData();
                    consolData.MappedValue = subCD;
                    consolData.AccountCD   = accountCD;
                    consolData.FinPeriodID = history.FinPeriodID;
                    consolData             = ConsolRecords.Locate(consolData);
                    if (consolData != null)
                    {
                        consolData.ConsolAmtDebit  += history.FinPtdDebit;
                        consolData.ConsolAmtCredit += history.FinPtdCredit;
                    }
                    else
                    {
                        consolData                   = new GLConsolData();
                        consolData.MappedValue       = subCD;
                        consolData.MappedValueLength = subCD.Length;
                        consolData.AccountCD         = accountCD;
                        consolData.FinPeriodID       = history.FinPeriodID;
                        consolData.ConsolAmtDebit    = history.FinPtdDebit;
                        consolData.ConsolAmtCredit   = history.FinPtdCredit;
                        ConsolRecords.Insert(consolData);
                    }
                }
            }

            return(ConsolRecords.Cache.Inserted);
        }
        public virtual IEnumerable preload(PXAdapter adapter)
        {
            if (PreloadFilter.Current.FromAccount == null)
            {
                PreloadFilter.Cache.RaiseExceptionHandling <AccountsPreloadFilter.fromAccount>(PreloadFilter.Current, PreloadFilter.Current.FromAccount, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXErrorLevel.RowError));
                PreloadFilter.Cache.RaiseExceptionHandling <AccountsPreloadFilter.toAccount>(PreloadFilter.Current, PreloadFilter.Current.ToAccount, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXErrorLevel.RowError));
                return(adapter.Get());
            }
            GLBudgetTree currentItem = ((GLBudgetTree)PXSelect <GLBudgetTree,
                                                                Where <GLBudgetTree.groupID,
                                                                       Equal <Required <GLBudgetTree.groupID> > > > .Select(this, this.CurrentSelected.Group));

            PreloadFilter.Current.AccountCDWildcard = SubCDUtils.CreateSubCDWildcard(currentItem != null ? currentItem.AccountMask : string.Empty, AccountAttribute.DimensionName);

            GLBudgetTree LastItem = PXSelect <GLBudgetTree,
                                              Where <GLBudgetTree.parentGroupID,
                                                     Equal <Required <GLBudgetTree.parentGroupID> > >, OrderBy <Desc <GLBudgetTree.sortOrder> > > .SelectWindowed(this, 0, 1, this.CurrentSelected.Group);

            int  LastSortNum                  = LastItem == null ? 1 : LastItem.SortOrder.Value + 1;
            bool noLinesPreloaded             = true;
            List <GLBudgetTree> nodesToInsert = new List <GLBudgetTree>();

            foreach (PXResult <Account> account in PXSelect <Account, Where <Account.accountCD,
                                                                             GreaterEqual <Required <Account.accountCD> >,
                                                                             And <Account.active, Equal <True>,
                                                                                  And <Account.accountCD, LessEqual <Required <Account.accountCD> >,
                                                                                       And <Account.accountID, NotEqual <Current <GL.GLSetup.ytdNetIncAccountID> > > > > > > .Select(this,
                                                                                                                                                                                     PreloadFilter.Current.FromAccount != null ?
                                                                                                                                                                                     ((Account)PXSelect <Account, Where <Account.accountID, Equal <Current <AccountsPreloadFilter.fromAccount> > > > .Select(this)).AccountCD :
                                                                                                                                                                                     ((Account)PXSelect <Account> .Select(this).First()).AccountCD,
                                                                                                                                                                                     PreloadFilter.Current.ToAccount != null ?
                                                                                                                                                                                     ((Account)PXSelect <Account, Where <Account.accountID, Equal <Current <AccountsPreloadFilter.toAccount> > > > .Select(this)).AccountCD :
                                                                                                                                                                                     ((Account)PXSelect <Account> .Select(this).Last()).AccountCD))
            {
                foreach (PXResult <Sub> sub in PXSelect <Sub, Where <Sub.active, Equal <True>, And <Sub.subCD, Like <Current <AccountsPreloadFilter.subCDWildcard> > > > > .Select(this))
                {
                    Account      acct    = account;
                    Sub          subAcct = sub;
                    GLBudgetTree group   = new GLBudgetTree();
                    if (currentItem == null || acct.AccountID != currentItem.AccountID || subAcct.SubID != currentItem.SubID)
                    {
                        group.AccountID = acct.AccountID;
                        group.SubID     = subAcct.SubID;

                        group.SortOrder = LastSortNum++;

                        group.GroupMask = CurrentSelected.GroupMask;

                        nodesToInsert.Add(group);
                        noLinesPreloaded = false;
                    }
                }
            }
            if (noLinesPreloaded)
            {
                if (Details.Ask(Messages.BudgetTreePreloadArticlesTitle, Messages.BudgetTreePreloadArticlesNothingToPreload, MessageButtons.OK) == WebDialogResult.OK)
                {
                    return(adapter.Get());
                }
            }
            if (nodesToInsert.Count > 500)
            {
                if (Details.Ask(Messages.Confirmation, String.Format(PXMessages.LocalizeNoPrefix(Messages.BudgetTreePreloadArticlesTooManyMessage), nodesToInsert.Count), MessageButtons.OKCancel) == WebDialogResult.OK)
                {
                    foreach (GLBudgetTree node in nodesToInsert)
                    {
                        Details.Insert(node);
                    }
                }
            }
            else
            {
                foreach (GLBudgetTree node in nodesToInsert)
                {
                    Details.Insert(node);
                }
            }
            return(adapter.Get());
        }
示例#7
0
        protected virtual IEnumerable consolRecords(
            [PXDBString]
            string ledgerCD,
            [PXDBString]
            string branchCD
            )
        {
            Ledger ledger = PXSelect <Ledger,
                                      Where <Ledger.consolAllowed, Equal <boolTrue>,
                                             And <Ledger.ledgerCD, Equal <Required <Ledger.ledgerCD> > > > > .Select(this, ledgerCD);

            Branch branch = PXSelect <Branch,
                                      Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > > .Select(this, branchCD);

            if (ledger == null)
            {
                throw new PXException(Messages.CantFindConsolidationLedger, ledgerCD);
            }

            if (!string.IsNullOrEmpty(branchCD) && branch == null)
            {
                throw new PXException(Messages.CantFindConsolidationBranch, branchCD);
            }

            if (true)
            {
                InitSegmentData(null);

                PXSelectBase <GLHistory> cmd = new PXSelectJoin <GLHistory,
                                                                 InnerJoin <Account, On <Account.accountID, Equal <GLHistory.accountID> >,
                                                                            InnerJoin <Sub, On <Sub.subID, Equal <GLHistory.subID> >,
                                                                                       InnerJoin <Ledger, On <Ledger.ledgerID, Equal <GLHistory.ledgerID> >,
                                                                                                  InnerJoin <Branch, On <Branch.branchID, Equal <GLHistory.branchID> > > > > >,
                                                                 Where <Ledger.ledgerCD, Equal <Required <Ledger.ledgerCD> >,
                                                                        And <GLHistory.accountID, NotEqual <Current <GLSetup.ytdNetIncAccountID> > > >,
                                                                 OrderBy <Asc <GLHistory.finPeriodID, Asc <Account.accountCD, Asc <Sub.subCD> > > > >(this);

                if (!string.IsNullOrEmpty(branchCD))
                {
                    cmd.WhereAnd <Where <Branch.branchCD, Equal <Required <Branch.branchCD> > > >();
                }

                foreach (PXResult <GLHistory, Account, Sub> result in cmd.Select(ledgerCD, branchCD))
                {
                    GLHistory history = result;
                    Account   account = result;
                    Sub       sub     = result;

                    string accountCD = account.GLConsolAccountCD;
                    string subCD     = GetMappedValue(sub.SubCD);

                    if (accountCD != null && accountCD.TrimEnd() != "" &&
                        subCD != null && subCD.TrimEnd() != "")
                    {
                        GLConsolData consolData = new GLConsolData();
                        consolData.MappedValue = subCD;
                        consolData.AccountCD   = accountCD;
                        consolData.FinPeriodID = history.FinPeriodID;
                        consolData             = ConsolRecords.Locate(consolData);
                        if (consolData != null)
                        {
                            consolData.ConsolAmtDebit  += history.FinPtdDebit;
                            consolData.ConsolAmtCredit += history.FinPtdCredit;
                        }
                        else
                        {
                            consolData                 = new GLConsolData();
                            consolData.MappedValue     = subCD;
                            consolData.AccountCD       = accountCD;
                            consolData.FinPeriodID     = history.FinPeriodID;
                            consolData.ConsolAmtDebit  = history.FinPtdDebit;
                            consolData.ConsolAmtCredit = history.FinPtdCredit;
                            ConsolRecords.Insert(consolData);
                        }
                    }
                }
            }

            return(ConsolRecords.Cache.Inserted);
        }