提交代码

This commit is contained in:
2024-07-15 15:11:50 +08:00
parent 0a8a11e445
commit 81afc4684a
10 changed files with 330 additions and 3 deletions
@@ -45,6 +45,8 @@ namespace FineUIPro.Web.JDGL.Check
Model.SGGLDB db = Funs.DB;
//所有集合
var totalList = from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months == months select x;
//所有集合
var sumTotalList = from x in db.JDGL_MonthPlan where x.ProjectId == this.CurrUser.LoginProjectId && x.Months <= months select x;
if (this.ckType.SelectedValue == "1") //按责任单位
{
var pUnit = from x in db.Project_ProjectUnit
@@ -103,7 +105,7 @@ namespace FineUIPro.Web.JDGL.Check
i++;
}
}
if (StatisticsList.Count() > 0) //增加
if (StatisticsList.Count() > 0) //增加
{
Model.JDGL_MonthPlan StatisticsLast = new Model.JDGL_MonthPlan();
StatisticsLast.NodeContent = "合计";
@@ -121,6 +123,22 @@ namespace FineUIPro.Web.JDGL.Check
}
StatisticsList.Add(StatisticsLast);
}
//增加累计
Model.JDGL_MonthPlan StatisticsSum = new Model.JDGL_MonthPlan();
StatisticsSum.NodeContent = "累计";
int c = sumTotalList.Count();
int d = sumTotalList.Count(x => x.RealDate.HasValue);
StatisticsSum.UnitId = c.ToString();
StatisticsSum.DutyPerson = d.ToString();
if (c != 0)//被除数不能为零
{
StatisticsSum.Remark = Math.Round((double)d / (double)c * 100, 2) + "%";//保留两位小数、后四舍五入
}
else
{
StatisticsSum.Remark = "0%";
}
StatisticsList.Add(StatisticsSum);
this.Grid1.DataSource = StatisticsList;
this.Grid1.DataBind();
}