protected void ComputeTotal()
    {
        this.AspNetPager1.CurrentPageIndex = 1;
        DataTable lSMTaskAnalysis = ConstructReport.GetLSMTaskAnalysis(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.prjId, 0, 0);

        string[] array = new string[9];
        if (lSMTaskAnalysis.Rows.Count != 0)
        {
            array[0] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(LaborBudCost)", "1>0")).ToString("0.000");
            array[1] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(StuffBudCost)", "1>0")).ToString("0.000");
            array[2] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(MachineBudCost)", "1>0")).ToString("0.000");
            array[3] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(BudTotal)", "1>0")).ToString("0.000");
            array[4] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(LaborConsCost)", "1>0")).ToString("0.000");
            array[5] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(StuffConsCost)", "1>0")).ToString("0.000");
            array[6] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(MachineConsCost)", "1>0")).ToString("0.000");
            array[7] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(ConsTotal)", "1>0")).ToString("0.000");
            array[8] = System.Convert.ToDecimal(lSMTaskAnalysis.Compute("sum(DiffTotal)", "1>0")).ToString("0.000");
        }
        else
        {
            array[0] = "0.000";
            array[1] = "0.000";
            array[2] = "0.000";
            array[3] = "0.000";
            array[4] = "0.000";
            array[5] = "0.000";
            array[6] = "0.000";
            array[7] = "0.000";
            array[8] = "0.000";
        }
        this.ViewState["Total"] = array;
    }
 public void BindGv()
 {
     this.AspNetPager1.RecordCount = ConstructReport.GetLSMTaskCount(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.prjId);
     this.dt = ConstructReport.GetLSMTaskAnalysis(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.prjId, this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex);
     this.gvCost.DataSource = this.dt;
     this.gvCost.DataBind();
 }
    protected void btnExcel_Click(object sender, System.EventArgs e)
    {
        DataTable dataTable = new DataTable();

        dataTable = ConstructReport.GetLSMTaskAnalysis(this.txtTaskCode.Text.Trim(), this.txtTaskName.Text.Trim(), this.prjId, 0, 0);
        if (dataTable.Rows.Count > 0)
        {
            DataRow dataRow = dataTable.NewRow();
            dataRow["Num"]             = "合计";
            dataRow["LaborBudCost"]    = System.Convert.ToDecimal(dataTable.Compute("sum(LaborBudCost)", "1>0")).ToString("0.000");
            dataRow["StuffBudCost"]    = System.Convert.ToDecimal(dataTable.Compute("sum(StuffBudCost)", "1>0")).ToString("0.000");
            dataRow["MachineBudCost"]  = System.Convert.ToDecimal(dataTable.Compute("sum(MachineBudCost)", "1>0")).ToString("0.000");
            dataRow["BudTotal"]        = System.Convert.ToDecimal(dataTable.Compute("sum(BudTotal)", "1>0")).ToString("0.000");
            dataRow["LaborConsCost"]   = System.Convert.ToDecimal(dataTable.Compute("sum(LaborConsCost)", "1>0")).ToString("0.000");
            dataRow["StuffConsCost"]   = System.Convert.ToDecimal(dataTable.Compute("sum(StuffConsCost)", "1>0")).ToString("0.000");
            dataRow["MachineConsCost"] = System.Convert.ToDecimal(dataTable.Compute("sum(MachineConsCost)", "1>0")).ToString("0.000");
            dataRow["ConsTotal"]       = System.Convert.ToDecimal(dataTable.Compute("sum(ConsTotal)", "1>0")).ToString("0.000");
            dataRow["DiffTotal"]       = System.Convert.ToDecimal(dataTable.Compute("sum(DiffTotal)", "1>0")).ToString("0.000");
            dataTable.Rows.Add(dataRow);
        }
        dataTable = this.GetTitleByTable(dataTable);
        System.Collections.Generic.List <ExcelHeader> list = new System.Collections.Generic.List <ExcelHeader>();
        list.Add(ExcelHeader.Create("目标成本", 1, 4, 3, 0));
        list.Add(ExcelHeader.Create("报量成本", 1, 4, 7, 0));
        System.Collections.Generic.List <int> list2 = new System.Collections.Generic.List <int>();
        foreach (DataColumn dataColumn in dataTable.Columns)
        {
            if (dataColumn.Ordinal >= 3 && dataColumn.Ordinal < 11)
            {
                list2.Add(dataColumn.Ordinal);
            }
            if (dataColumn.Ordinal < 3)
            {
                list.Add(ExcelHeader.Create(dataColumn.ColumnName, 2, 0, 0, 2));
            }
            else
            {
                if (dataColumn.Ordinal > 10)
                {
                    list.Add(ExcelHeader.Create(dataColumn.ColumnName, 2, 0, 0, 2));
                }
                else
                {
                    list.Add(ExcelHeader.Create(dataColumn.ColumnName, 2, 0, 0, 0));
                }
            }
        }
        ExcelHelper.ExportExcel(dataTable, "人材机成本明细表", "人材机成本明细表", "人材机成本明细表.xls", list, null, 2, base.Request.Browser.Browser);
    }