Beispiel #1
0
        protected void RG_Report_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            IList <CostReportInfo> costReportInfoList;

            if (SearchType == "Search")
            {
                costReportInfoList = _costReport.GetReportStatistics(StartTime, EndTime, new Guid(SearchClass), new Guid(SearchBranch), new Guid(SearchFiliale));
            }
            else
            {
                if (StartTime == DateTime.MinValue)
                {
                    StartTime = DateTime.Now.Date.AddDays(-30);
                }
                if (EndTime == DateTime.MinValue)
                {
                    EndTime = DateTime.Now;
                }
                costReportInfoList = _costReport.GetReportStatisticsByBranch(StartTime, EndTime, new Guid(SearchBranch), new Guid(SearchFiliale));
            }

            //合计金额
            var sumPayCost = RG_Report.MasterTableView.Columns.FindByUniqueName("PayCost");

            if (costReportInfoList.Count > 0)
            {
                var total = costReportInfoList.Sum(ent => Math.Abs(ent.RealityCost));
                sumPayCost.FooterText = string.Format("合计:{0}", WebControl.NumberSeparator(total));
            }
            else
            {
                sumPayCost.FooterText = string.Empty;
            }
            RG_Report.DataSource = costReportInfoList;
        }