コード例 #1
0
        protected virtual void BuildParentList(GLTranReclHist tran, List <GLTranReclHist> result)
        {
            if (tran.ParentTran == null)
            {
                return;
            }

            tran.ParentTran.SortOrder = tran.SortOrder - 1;
            tran.ParentTran.IsParent  = tran.ReclassType == ReclassType.Split;

            BuildParentList(tran.ParentTran, result);

            result.Add(tran.ParentTran);

            var reverseTran = (GLTranReclHist)TransView.Cache.Locate(new GLTranReclHist(tran.ParentTran.Module, tran.ParentTran.BatchNbr, tran.ParentTran.LineNbr - 1));

            if (reverseTran == null)
            {
                return;
            }

            reverseTran.SortOrder = tran.ParentTran.SortOrder;
            reverseTran.IsSplited = tran.ParentTran?.IsSplited == true;
            result.Add(reverseTran);
        }
コード例 #2
0
        protected virtual int?SortChildTrans(GLTranReclHist tran, bool hasSplitsInChain)
        {
            bool isNotIncluded = (tran.ReclassRemainingAmt ?? 0m) == 0m && hasSplitsInChain && !IsCurrentTran(tran);

            var reverseTran = (GLTranReclHist)TransView.Cache.Locate(new GLTranReclHist(tran.Module, tran.BatchNbr, tran.LineNbr - 1));

            if (reverseTran != null)
            {
                reverseTran.SortOrder  = tran.SortOrder;
                reverseTran.ParentTran = tran.ParentTran;
                reverseTran.IsSplited  = tran.IsSplited;
            }
            else if (tran.ParentTran != null)
            {
                throw new PXException(Messages.ReversingEntryHasNotBeenFound);
            }

            if (!tran.ChildTrans.Any())
            {
                return(tran.SortOrder);
            }

            int? lastSortOrder  = tran.SortOrder;
            bool splitsDetected = false;

            foreach (GLTranReclHist lowerTran in tran.ChildTrans.Where(m => m.ReclassType == ReclassType.Split))
            {
                lastSortOrder      += 1;
                lowerTran.SortOrder = lastSortOrder;
                splitsDetected     |= lowerTran.ReclassType == ReclassType.Split;
                lastSortOrder       = SortChildTrans(lowerTran, hasSplitsInChain);
            }

            foreach (GLTranReclHist lowerTran in tran.ChildTrans.Where(m => m.ReclassType == ReclassType.Common))
            {
                lastSortOrder      += 1;
                lowerTran.SortOrder = lastSortOrder;
                splitsDetected     |= lowerTran.ReclassType == ReclassType.Split;
                lastSortOrder       = SortChildTrans(lowerTran, hasSplitsInChain);
            }

            if (isNotIncluded)
            {
                tran.SortOrder        = null;
                reverseTran.SortOrder = null;
            }

            tran.IsParent = splitsDetected;

            return(lastSortOrder);
        }
コード例 #3
0
        protected bool IsCurrentTran(GLTranReclHist tran)
        {
            var currentTran = CurrentReclassTranView.Cache.Inserted.Select <GLTran>().SingleOrDefault();

            return(tran.Module == currentTran.Module && tran.BatchNbr == currentTran.BatchNbr && tran.LineNbr == currentTran.LineNbr);
        }