private DataTable getnewdt1(DataTable dt)
    {
        DataTable datNew = dt.DefaultView.ToTable();

        datNew.Columns.Add("ProProper");
        for (int i = 0; i < datNew.Rows.Count; i++)
        {
            DataTable dtbppjm = BGPayProjectManager.GetPayProjectByPPID(common.IntSafeConvert(datNew.Rows[i]["PPID"]));
            if (dtbppjm.Rows.Count > 0)
            {
                datNew.Rows[i]["ProProper"] = dtbppjm.Rows[0]["PayPrjName"].ToString();
                datNew.Rows[i]["BIFunSub"]  = BGDepartmentManager.GetDepBydepid(dt.Rows[i]["DepID"].ToString()).DepName;
            }
            else
            {
                datNew.Rows[i]["ProProper"] = 0;
                datNew.Rows[i]["BIFunSub"]  = 0;
            }
        }
        return(datNew);
    }
    public DataTable GetProtypeDt(DataTable dt)
    {
        decimal TotalMoney = 0;

        dt.Columns.Add("IsRed");

        List <string> listTmp      = new List <string>();
        List <string> listIndexTmp = new List <string>();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow drNew       = dt.NewRow();
            string  year        = dt.Rows[i]["StaYear"].ToString();
            string  YearProType = year + dt.Rows[i]["BIProType"].ToString();
            dt.Rows[i]["BIFunSub"] = BGDepartmentManager.GetDepBydepid(dt.Rows[i]["DepID"].ToString()).DepName;

            DataRow[] dr = dt.Select("BIProType ='" + dt.Rows[i]["BIProType"].ToString() + "' and StaYear=" + year);


            if (dr.Length > 1)
            {
                TotalMoney = 0;
                for (int j = 0; j < dr.Length; j++)
                {
                    TotalMoney += ParseUtil.ToDecimal(dr[j]["BIMon"].ToString(), 0);
                }
                if (!listTmp.Contains(YearProType))
                {
                    drNew["BICode"]    = "项目类型汇总";
                    drNew["BIProType"] = dt.Rows[i]["BIProType"].ToString();
                    drNew["BIProName"] = "";
                    drNew["BIFunSub"]  = "";
                    drNew["BIMon"]     = TotalMoney;
                    drNew["BIStaTime"] = dt.Rows[i]["BIStaTime"].ToString();
                    drNew["BudSta"]    = dt.Rows[i]["BudSta"].ToString();
                    drNew["BudID"]     = "-1";
                    drNew["IsRed"]     = "-1";
                    dt.Rows.InsertAt(drNew, i);
                    listTmp.Add(YearProType);
                }
            }

            else
            {
                dt.Rows[i]["IsRed"] = "-1";
            }
        }
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["IsRed"] == "-1")
            {
                total += ParseUtil.ToDecimal(dt.Rows[i]["BIMon"].ToString(), 0);
            }
        }
        DataRow drNew1 = dt.NewRow();

        drNew1["BICode"]    = "汇总统计";
        drNew1["BIStaTime"] = Convert.ToDateTime(CurrentYear + "-10-10");
        drNew1["BudSta"]    = "合计";
        drNew1["BudID"]     = "-2";
        dt.Rows.Add(drNew1);
        return(dt);
    }