コード例 #1
0
        protected override void BindData()
        {
            base.BindData();
            BindingSource.DataSource = rpt_Analytic;

            if (rpt_Analytic.DataLayout != null)
            {
                using (new CDS.Client.Desktop.Essential.UTL.WaitCursor())
                {
                    System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
                    System.IO.StreamWriter sr2     = new System.IO.StreamWriter(stream2);
                    sr2.WriteLine(rpt_Analytic.DataLayout);
                    sr2.Flush();
                    stream2.Seek(0, System.IO.SeekOrigin.Begin);
                    Pivot.RestoreLayoutFromStream(stream2, DevExpress.Utils.OptionsLayoutBase.FullLayout);
                    foreach (PivotGridField field in Pivot.Fields)
                    {
                        if (field.UnboundExpression != String.Empty)
                        {
                            field.Options.ShowUnboundExpressionMenu = true;
                            field.UnboundType = UnboundColumnType.Decimal;
                            if (field.DataControllerColumnName.Contains("%"))
                            {
                                field.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Average;
                            }
                        }
                    }
                }
            }

            BindingSourceAnalyticSource.DataSource     = DataContext.ReadonlyContext.VW_AnalyticSource.ToList();
            ddlDatePeriodSelect.Properties.DataSource  = DataContext.ReadonlyContext.VW_Period.Select(n => n.Code).Distinct().OrderByDescending(n => n).ToList();
            ddlDateQuarterSelect.Properties.DataSource = DataContext.ReadonlyContext.VW_Period.Select(n => new { n.FinancialYear, n.FinancialQuarter }).Distinct().OrderByDescending(n => n).ToList().Select(n => n.FinancialYear + " " + n.FinancialQuarter);
            ddlDateYearSelect.Properties.DataSource    = DataContext.ReadonlyContext.VW_Period.Select(n => n.FinancialYear).Distinct().OrderByDescending(n => n).ToList();
            BindDefaultDate();
            Pivot.FieldsCustomization(pnlFields);
        }