protected void ComputeTotal() { this.AspNetPager1.CurrentPageIndex = 1; string taskCode = this.txtTaskCode.Text.Trim(); string taskName = this.txtTaskName.Text.Trim(); string resourceCode = this.txtResourceCode.Text.Trim(); string resourceName = this.txtResourceName.Text.Trim(); DataTable cBSTaskAnalysis = ConstructReport.GetCBSTaskAnalysis(taskCode, taskName, resourceCode, resourceName, this.prjId, "StuffCBSCode", 0, 0); string[] array = new string[4]; if (cBSTaskAnalysis.Rows.Count != 0) { array[0] = System.Convert.ToDecimal(cBSTaskAnalysis.Compute("sum(BudCost)", "1>0")).ToString("0.000"); array[1] = System.Convert.ToDecimal(cBSTaskAnalysis.Compute("sum(ConsCost)", "1>0")).ToString("0.000"); array[2] = System.Convert.ToDecimal(cBSTaskAnalysis.Compute("sum(ReductionAmount)", "1>0")).ToString("0.000"); array[3] = System.Convert.ToDecimal(cBSTaskAnalysis.Compute("sum(OutPrice)", "1>0")).ToString("0.000"); } else { array[0] = "0.000"; array[1] = "0.000"; array[2] = "0.000"; array[3] = "0.000"; } this.ViewState["Total"] = array; }
public void BindGv() { string taskCode = this.txtTaskCode.Text.Trim(); string taskName = this.txtTaskName.Text.Trim(); string resourceCode = this.txtResourceCode.Text.Trim(); string resourceName = this.txtResourceName.Text.Trim(); this.AspNetPager1.RecordCount = ConstructReport.GetCBSTaskCount(taskCode, taskName, resourceCode, resourceName, this.prjId, "LaborCBSCode"); DataTable cBSTaskAnalysis = ConstructReport.GetCBSTaskAnalysis(taskCode, taskName, resourceCode, resourceName, this.prjId, "LaborCBSCode", this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex); this.gvLaborCost.DataSource = cBSTaskAnalysis; this.gvLaborCost.DataBind(); }
protected void btnExcel_Click(object sender, System.EventArgs e) { DataTable dataTable = new DataTable(); string taskCode = this.txtTaskCode.Text.Trim(); string taskName = this.txtTaskName.Text.Trim(); string resourceCode = this.txtResourceCode.Text.Trim(); string resourceName = this.txtResourceName.Text.Trim(); dataTable = ConstructReport.GetCBSTaskAnalysis(taskCode, taskName, resourceCode, resourceName, this.prjId, "LaborCBSCode", 0, 0); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.NewRow(); dataRow["Num"] = "合计"; dataRow["BudCost"] = dataTable.Compute("sum(BudCost)", "1>0"); dataRow["ConsCost"] = dataTable.Compute("sum(ConsCost)", "1>0"); dataRow["ReductionAmount"] = dataTable.Compute("sum(ReductionAmount)", "1>0"); dataTable.Rows.Add(dataRow); } dataTable = this.GetTitleByTable(dataTable); ExcelHelper.ExportExcel(dataTable, "人工明细表", "人工明细表", "人工明细表.xls", null, null, 2, base.Request.Browser.Browser); }