コード例 #1
0
ファイル: ReportBuilder.cs プロジェクト: plamikcho/xbrlpoc
        /// <summary>
        /// Performs all of the steps necessary to build a raw <paramref name="report"/> for the rendering engine.
        /// </summary>
        /// <param name="topNode">The top-level node from the presentation taxonomy which represents this report.</param>
        /// <param name="report">The report object to populate.</param>
        /// <returns>True on success, false on fail.</returns>
        private bool BuildReport( Node topNode, out InstanceReport report )
        {
            report = new InstanceReport();
            report.ReportLongName = topNode.Label;
            executor.Invoke( "Building Report: " + report.ReportLongName );

            report.ReportName = ReportHeader.GetShortName( topNode.Label );
            report.ReportName = ReportHeader.RemoveReportNumber( report.ReportName );
            report.ReportName = ReportHeader.RemoveProcessingTokens( report.ReportName );

            if( ReportUtils.IsStatementOfEquityCombined( report.ReportLongName ) )
                report.IsEquityReport = true;

            report.RoleURI = topNode.MyPresentationLink.Role;
            report.TopLevelNode = topNode;
            report.Version = this.currentAssemblyVersion;

            report.IsEmbedReport = this.internalReports.ContainsKey( report.RoleURI );
            report.ShowElementNames = ReportUtils.IsShowElements( report.ReportLongName );

            if( report.ReportName.ToLower().IndexOf( "notes" ) >= 0 )
                report.ReportType = ReportHeaderType.Notes;

            ReportBuilder.GetDimensions( this.currentTaxonomy, topNode, null, ref report.AxisByPresentation, ref report.AxisMembersByPresentation );
            this.BuildReportRows( report, topNode, 0 );

            if( report.Rows.Count == 0 )
                return false;

            this.GetCommonDimensions( ref report.AxisByPresentation, ref report.AxisMembersByPresentation );
            this.GetDimensionDefaults( report, ref report.AxisMemberDefaults );
            this.BuildReportColumns( report );

            if( report.Columns.Count == 0 )
                return false;

            ReportBuilder.FillMissingCells( report );

            bool isRuleEnabled = this.FireRuleProcessing( RulesEngineUtils.ABSTRACT_HEADER_RULE );
            if( isRuleEnabled )
            {
                this.RemoveChildlessAbstracts( report );
                this.FireRuleProcessed( RulesEngineUtils.ABSTRACT_HEADER_RULE );
            }

            this.ApplyRowPrecision( report );
            this.ApplyFootnotes( report );
            report.HasEmbeddedReports = report.CheckForEmbeddedReports();

            report.SortColumns();
            ReportBuilder.MergeColumns( report );

            return true;
        }