protected void BindGv() { this.AspNetPager1.RecordCount = ConstructReport.GetConsResCount(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.txtReourceCode.Text.Trim(), this.txtReourceName.Text.Trim(), this.prjId, WebUtil.GetUserNames(base.UserCode)); this.gvConstruct.DataSource = ConstructReport.GetConsRes(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.txtReourceCode.Text.Trim(), this.txtReourceName.Text.Trim(), this.prjId, WebUtil.GetUserNames(base.UserCode), this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize); this.gvConstruct.DataBind(); string[] value = (string[])this.ViewState["Total"]; int[] index = (int[])this.ViewState["index"]; GridViewUtility.AddTotalRow(this.gvConstruct, value, index); }
protected void btnExcel_Click(object sender, System.EventArgs e) { DataTable dataTable = new DataTable(); dataTable = ConstructReport.GetConsRes(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.txtReourceCode.Text.Trim(), this.txtReourceName.Text.Trim(), this.prjId, WebUtil.GetUserNames(base.UserCode), 0, 0); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.NewRow(); dataRow["Num"] = "合计"; dataRow["AccountingQuantity"] = dataTable.Compute("sum(AccountingQuantity)", "1>0"); dataRow["Total"] = dataTable.Compute("sum(Total)", "1>0"); dataTable.Rows.Add(dataRow); } dataTable = this.GetTitleByTable(dataTable); ExcelHelper.ExportExcel(dataTable, "施工报量查询", "施工报量查询", "施工报量查询.xls", null, null, 3, base.Request.Browser.Browser); }
protected void ComputeTotal() { this.AspNetPager1.CurrentPageIndex = 1; DataTable consRes = ConstructReport.GetConsRes(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.txtReourceCode.Text.Trim(), this.txtReourceName.Text.Trim(), this.prjId, WebUtil.GetUserNames(base.UserCode), 0, 0); string[] array = new string[2]; if (consRes.Rows.Count != 0) { array[0] = System.Convert.ToDecimal(consRes.Compute("sum(AccountingQuantity)", "1>0")).ToString("0.000"); array[1] = System.Convert.ToDecimal(consRes.Compute("sum(Total)", "1>0")).ToString("0.000"); } else { array[0] = "0.000"; array[1] = "0.000"; } int[] value = new int[] { 8, 9 }; this.ViewState["Total"] = array; this.ViewState["index"] = value; }