Beispiel #1
0
    protected void ComputeTotal()
    {
        this.AspNetPager1.CurrentPageIndex = 1;
        DataTable majorStuffDiffAnalysis = ConstructReport.GetMajorStuffDiffAnalysis(this.txtResourceCode.Text.Trim(), this.txtResourceName.Text.Trim(), this.prjId, 0, 0);

        string[] array = new string[9];
        if (majorStuffDiffAnalysis.Rows.Count != 0)
        {
            array[0] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(CurrentBudCost)", "1>0")).ToString("0.000");
            array[1] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(CurrentConsCost)", "1>0")).ToString("0.000");
            array[2] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(CurrentDiffPrice)", "1>0")).ToString("0.000");
            array[3] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(CurrentReductionAmount)", "1>0")).ToString("0.000");
            array[4] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(BudCost)", "1>0")).ToString("0.000");
            array[5] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(ConsCost)", "1>0")).ToString("0.000");
            array[6] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(DiffQuantity)", "1>0")).ToString("0.000");
            array[7] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(DiffPrice)", "1>0")).ToString("0.000");
            array[8] = System.Convert.ToDecimal(majorStuffDiffAnalysis.Compute("sum(ReductionAmount)", "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;
    }
Beispiel #2
0
 public void BindGv()
 {
     this.AspNetPager1.RecordCount = ConstructReport.GetStuffCount(this.txtResourceCode.Text.Trim(), this.txtResourceName.Text.Trim(), string.Empty, string.Empty, this.prjId);
     this.dt = ConstructReport.GetMajorStuffDiffAnalysis(this.txtResourceCode.Text.Trim(), this.txtResourceName.Text.Trim(), this.prjId, this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex);
     this.gvMajorStuff.DataSource = this.dt;
     this.gvMajorStuff.DataBind();
 }
Beispiel #3
0
    protected void btnExcel_Click(object sender, System.EventArgs e)
    {
        DataTable dataTable = new DataTable();

        dataTable = ConstructReport.GetMajorStuffDiffAnalysis(this.txtResourceCode.Text.Trim(), this.txtResourceName.Text.Trim(), this.prjId, 0, 0);
        if (dataTable.Rows.Count > 0)
        {
            DataRow dataRow = dataTable.NewRow();
            dataRow["Num"]                    = "合计";
            dataRow["CurrentBudCost"]         = dataTable.Compute("sum(CurrentBudCost)", "1>0");
            dataRow["CurrentConsCost"]        = dataTable.Compute("sum(CurrentConsCost)", "1>0");
            dataRow["CurrentDiffPrice"]       = dataTable.Compute("sum(CurrentDiffPrice)", "1>0");
            dataRow["CurrentReductionAmount"] = dataTable.Compute("sum(CurrentReductionAmount)", "1>0");
            dataRow["BudCost"]                = dataTable.Compute("sum(BudCost)", "1>0");
            dataRow["ConsCost"]               = dataTable.Compute("sum(ConsCost)", "1>0");
            dataRow["DiffQuantity"]           = dataTable.Compute("sum(DiffQuantity)", "1>0");
            dataRow["DiffPrice"]              = dataTable.Compute("sum(DiffPrice)", "1>0");
            dataRow["ReductionAmount"]        = dataTable.Compute("sum(ReductionAmount)", "1>0");
            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, 7, 0));
        list.Add(ExcelHeader.Create("累计数", 1, 5, 11, 0));
        System.Collections.Generic.List <int> list2 = new System.Collections.Generic.List <int>();
        foreach (DataColumn dataColumn in dataTable.Columns)
        {
            if (dataColumn.Ordinal >= 7)
            {
                list2.Add(dataColumn.Ordinal);
            }
            if (dataColumn.Ordinal < 7)
            {
                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);
    }