示例#1
0
        //Grid数据源
        protected void GridDataBind()
        {
            var stime = DateTime.MinValue;
            var etime = DateTime.MinValue;

            if (!string.IsNullOrEmpty(txt_DateTimeStart.Text))
            {
                stime = DateTime.Parse(txt_DateTimeStart.Text);
            }
            if (!string.IsNullOrEmpty(txt_DateTimeEnd.Text))
            {
                etime = DateTime.Parse(txt_DateTimeEnd.Text).AddDays(1);
            }

            var costReportList = _costReport.GetReportListForDeposit(int.Parse(ddl_State.SelectedValue), stime, etime, string.IsNullOrEmpty(RCB_ReportPersonnel.SelectedValue) ? null : new List <Guid> {
                new Guid(RCB_ReportPersonnel.SelectedValue)
            }, txt_ReportNo.Text);
            var query = costReportList.AsQueryable();

            #region 合计
            var totalName  = RG_ReportDepositRecovery.MasterTableView.Columns.FindByUniqueName("TotalName");
            var reportCost = RG_ReportDepositRecovery.MasterTableView.Columns.FindByUniqueName("ReportCost");
            var payCost    = RG_ReportDepositRecovery.MasterTableView.Columns.FindByUniqueName("PayCost");
            if (query.Any())
            {
                var sumReportCost = query.Sum(p => Math.Abs(p.ReportCost));
                var sumPayCost    = query.Sum(p => Math.Abs(p.PayCost));
                totalName.FooterText  = "合计:";
                reportCost.FooterText = string.Format("{0}", ERP.UI.Web.Common.WebControl.NumberSeparator(sumReportCost));
                payCost.FooterText    = string.Format("{0}", ERP.UI.Web.Common.WebControl.NumberSeparator(sumPayCost));
            }
            else
            {
                totalName.FooterText  = string.Empty;
                reportCost.FooterText = string.Empty;
                payCost.FooterText    = string.Empty;
            }
            #endregion

            RG_ReportDepositRecovery.DataSource = query.OrderByDescending(p => p.ReportDate).ToList();
        }
        //Grid数据源
        protected void GridDataBind()
        {
            if (string.IsNullOrEmpty(hf_oldReportPersonnel.Value))
            {
                var info = new List <CostReportInfo>();
                RG_ReportDepositRecovery.DataSource = info;
            }
            else
            {
                var reportPersonnelIds = hf_oldReportPersonnel.Value.Split(',').Select(personnelId => new Guid(personnelId)).ToList();
                var costReportList     = _costReport.GetReportListForDeposit(0, DateTime.MinValue, DateTime.MinValue, reportPersonnelIds, string.Empty);
                var query = costReportList.AsQueryable();

                RG_ReportDepositRecovery.DataSource = query.OrderByDescending(p => p.ReportDate).ToList();
            }
        }