Esempio n. 1
0
    public void BindRpt()
    {
        string    cbsCode = this.txtTaskCode.Text.Trim();
        string    cbsName = this.txtTaskName.Text.Trim();
        DataTable dataTable;

        if (this.year == "zzjg")
        {
            dataTable = EReport.GetOrganizationCosts(this.prjId, cbsCode, cbsName);
        }
        else
        {
            dataTable = EReport.GetIndirectCosts(this.prjId, cbsCode, cbsName);
        }
        this.ViewState["costs"]       = dataTable;
        this.AspNetPager1.RecordCount = dataTable.Rows.Count;
        this.AspNetPager1.PageSize    = NBasePage.pagesize;
        this.rptBudget.DataSource     = EReport.GetPageDataTable(dataTable, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize);
        this.rptBudget.DataBind();
        if (this.rptBudget.Items.Count == 0)
        {
            base.RegisterScript("$('#rptBudget tr:last-child').remove();");
        }
    }
Esempio n. 2
0
    private DataTable GetFormatDataTable()
    {
        DataTable dataTable = new DataTable();

        dataTable.Columns.Add("序号");
        dataTable.Columns.Add("CBS编码");
        dataTable.Columns.Add("成本科目");
        dataTable.Columns.Add("目标成本");
        dataTable.Columns.Add("实际成本");
        dataTable.Columns.Add("降低额");
        dataTable.Columns.Add("降低率");
        dataTable.Columns.Add("目标成本 ");
        dataTable.Columns.Add("实际成本 ");
        dataTable.Columns.Add("降低额 ");
        dataTable.Columns.Add("降低率 ");
        int       num     = 0;
        string    cbsCode = this.txtTaskCode.Text.Trim();
        string    cbsName = this.txtTaskName.Text.Trim();
        DataTable dataTable2;

        if (this.year == "zzjg")
        {
            dataTable2 = EReport.GetOrganizationCosts(this.prjId, cbsCode, cbsName);
        }
        else
        {
            dataTable2 = EReport.GetIndirectCosts(this.prjId, cbsCode, cbsName);
        }
        foreach (DataRow dataRow in dataTable2.Rows)
        {
            num++;
            DataRow dataRow2 = dataTable.NewRow();
            dataRow2["序号"]    = num.ToString();
            dataRow2["CBS编码"] = dataRow["CBSCode"];
            dataRow2["成本科目"]  = dataRow["CBSName"];
            dataRow2["目标成本"]  = dataRow["MonthTarget"];
            dataRow2["实际成本"]  = dataRow["MonthReality"];
            dataRow2["降低额"]   = decimal.Parse(dataRow["MonthTarget"].ToString()) - decimal.Parse(dataRow["MonthReality"].ToString());
            string text = 0m.ToString("P2");
            text              = ((decimal.Parse(dataRow["MonthTarget"].ToString()) == 0m) ? text : (decimal.Parse(dataRow2["降低额"].ToString()) / decimal.Parse(dataRow["MonthTarget"].ToString())).ToString("P2"));
            dataRow2["降低率"]   = text;
            dataRow2["目标成本 "] = dataRow["TotalTarget"];
            dataRow2["实际成本 "] = dataRow["TotalReality"];
            dataRow2["降低额 "]  = decimal.Parse(dataRow["TotalTarget"].ToString()) - decimal.Parse(dataRow["TotalReality"].ToString());
            text              = 0m.ToString("P2");
            text              = ((decimal.Parse(dataRow["TotalTarget"].ToString()) == 0m) ? text : (decimal.Parse(dataRow2["降低额 "].ToString()) / decimal.Parse(dataRow["TotalTarget"].ToString())).ToString("P2"));
            dataRow2["降低率 "]  = text;
            dataTable.Rows.Add(dataRow2);
        }
        if (this.ViewState["sum"] != null)
        {
            System.Collections.Generic.Dictionary <string, decimal> dictionary = this.ViewState["sum"] as System.Collections.Generic.Dictionary <string, decimal>;
            DataRow dataRow3 = dataTable.NewRow();
            dataRow3["序号"]    = "合 计";
            dataRow3["CBS编码"] = string.Empty;
            dataRow3["成本科目"]  = string.Empty;
            dataRow3["目标成本"]  = dictionary["MonthTarget"];
            dataRow3["实际成本"]  = dictionary["MonthReality"];
            dataRow3["降低额"]   = dictionary["MonthLower"];
            dataRow3["降低率"]   = dictionary["MonthLowerRate"].ToString("P2");
            dataRow3["目标成本 "] = dictionary["TotalTarget"];
            dataRow3["实际成本 "] = dictionary["TotalReality"];
            dataRow3["降低额 "]  = dictionary["TotalLower"];
            dataRow3["降低率 "]  = dictionary["TotalLowerRate"].ToString("P2");
            dataTable.Rows.Add(dataRow3);
        }
        return(dataTable);
    }