示例#1
0
        /// <summary>
        /// Calculate grouped result
        /// </summary>
        /// <param name="i_Table">data source</param>
        public override void CalculateResult(DataTable i_Table)
        {
            //If have no data source ,clear group struct
            if (i_Table == null)
            {
                this.RootGroupInfo.ClearGroupResult(this._RootGroupInfo);

                _HaveData = false;

                return;
            }

            _HaveData = true;

            if (this.RootGroupInfo.Summaries == null)
            {
                this.RootGroupInfo.Summaries = new GroupSummaryCollection();
            }
            if (this.RootGroupInfo.SubGroupInfos == null || this.RootGroupInfo.SubGroupInfos.Count == 0)
            {
                this.RootGroupInfo.SubGroupInfos = new GroupInfoCollection();

                this.RootGroupInfo.SubGroupInfos.Add(new FieldGroupInfo(""));
            }
            if (MatrixInfo == null)
            {
                this.MatrixInfo = new MatrixInfo(RootGroupInfo, RootGroupInfo.SubGroupInfos[0], null, null);
            }
            else
            {
                this.MatrixInfo = MatrixInfo.CopyFrom(RootGroupInfo, MatrixInfo);
            }

            this.MatrixInfo.MatrixDisplay = this.MatrixDisplay;
            this.MatrixInfo.GridInfo.Apply(this.GridInfo);

            //Filter rows
            Webb.Collections.Int32Collection m_Rows = new Int32Collection();

            if (this.ExControl != null && this.ExControl.Report != null)
            {
                m_Rows = this.ExControl.Report.Filter.GetFilteredRows(i_Table);                        //2009-5-25 11:02:57@Simon Add this Code
            }


            m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(i_Table, m_Rows);

            m_Rows = this.RepeatFilter.Filter.GetFilteredRows(i_Table, m_Rows);

            this.Filter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this.Filter); //2009-4-29 11:37:37@Simon Add UpdateAdvFilter

            m_Rows = this.Filter.GetFilteredRows(i_Table, m_Rows);                                                          //06-04-2008@Scott

            m_Rows.CopyTo(this.FilteredRows);

            MatrixInfo.CalculateMatrixResult(i_Table, m_Rows);
        }
示例#2
0
        public void AddTotalAndOthers(System.Data.DataTable i_Table, Int32Collection outerRows, Int32Collection innerRows)
        {
            if (this.RootGroupInfo == null)
            {
                return;
            }

            GroupResultCollection m_newResults = new GroupResultCollection();

            GroupResult m_TotalGroupResult = new GroupResult();

            m_TotalGroupResult.Summaries = new GroupSummaryCollection();

            GroupResult m_OtherGroupResult = new GroupResult();

            m_OtherGroupResult.Summaries = new GroupSummaryCollection();

            if (this.TotalPosition != TotalType.None)
            {
                #region Caclculate Result for Total

                m_TotalGroupResult.GroupValue = this.RootGroupInfo.TotalTitle;

                m_TotalGroupResult.RowIndicators = new Int32Collection();

                m_TotalGroupResult.ParentGroupInfo = this.RootGroupInfo;  //Add at 2009-2-19 14:23:47@Simon

                innerRows.CopyTo(m_TotalGroupResult.RowIndicators);

                if (this.RootGroupInfo.Summaries.Count > 0)
                {
                    GroupSummary summaryTotal = this.SummaryForTotalGroup.Copy();

                    m_TotalGroupResult.Summaries.Add(summaryTotal);

                    m_TotalGroupResult.CalculateSummaryResult(i_Table, innerRows, innerRows);
                }

                m_TotalGroupResult.SubGroupInfos = RootGroupInfo.SubGroupInfos.Copy();

                foreach (GroupInfo subGroupInfo in m_TotalGroupResult.SubGroupInfos)
                {
                    subGroupInfo.CalculateGroupResult(i_Table, outerRows, outerRows, innerRows, subGroupInfo);
                }
                #endregion
            }
            if (this.TotalPosition == TotalType.AllBefore)
            {
                m_newResults.Add(m_TotalGroupResult);
            }
            if (this.TotalOthersPosition == TotalType.AllBefore)
            {
                m_newResults.Add(m_OtherGroupResult);
            }

            Int32Collection m_OtherRowsTotal = new Int32Collection();

            for (int i = 0; i < this.RootGroupInfo.GroupResults.Count; i++)
            {
                if (i >= this.HorizonTopCount && HorizonTopCount > 0)
                {
                    m_OtherRowsTotal = m_OtherRowsTotal.Combine(this.RootGroupInfo.GroupResults[i].RowIndicators, m_OtherRowsTotal);
                }
                else
                {
                    m_newResults.Add(this.RootGroupInfo.GroupResults[i]);
                }
            }

            if (this.TotalOthersPosition != TotalType.None)
            {
                #region calculate Other results

                m_OtherGroupResult.GroupValue = this.TotalOthersName;

                m_OtherGroupResult.RowIndicators = new Int32Collection();

                m_OtherGroupResult.ParentGroupInfo = this.RootGroupInfo;  //Add at 2009-2-19 14:23:47@Simon

                m_OtherRowsTotal.CopyTo(m_OtherGroupResult.RowIndicators);

                if (this.RootGroupInfo.Summaries.Count > 0)
                {
                    GroupSummary summaryTotal = this.SummaryForOthers.Copy();

                    m_OtherGroupResult.Summaries.Add(summaryTotal);

                    m_OtherGroupResult.CalculateSummaryResult(i_Table, outerRows, m_OtherRowsTotal);
                }

                m_OtherGroupResult.SubGroupInfos = this.RootGroupInfo.SubGroupInfos.Copy();

                foreach (GroupInfo subGroupInfo in m_OtherGroupResult.SubGroupInfos)
                {
                    subGroupInfo.CalculateGroupResult(i_Table, m_OtherRowsTotal, outerRows, m_OtherRowsTotal, subGroupInfo);
                }
                #endregion
            }

            if (this.TotalOthersPosition == TotalType.AllAfter)
            {
                m_newResults.Add(m_OtherGroupResult);
            }
            if (this.TotalPosition == TotalType.AllAfter)
            {
                m_newResults.Add(m_TotalGroupResult);
            }

            this.RootGroupInfo.ResetGroupResults(m_newResults);
        }