修改进度报表
This commit is contained in:
@@ -197,152 +197,219 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
|
||||
table4.Columns.Add(new DataColumn("CPI", typeof(String)));
|
||||
table4.Columns.Add(new DataColumn("SPI", typeof(String)));
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
||||
var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
var unitProjectInits = from x in db.Wbs_UnitProjectInit select x;
|
||||
var unitProjects = from x in db.Wbs_UnitProject where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x;
|
||||
var installationIds = cnProfessions.Select(x => x.InstallationId).Distinct().ToList();
|
||||
var installations = from x in db.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId && installationIds.Contains(x.InstallationId) select x;
|
||||
var unitProjects = from x in db.Wbs_UnitProject where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x;
|
||||
var details = from x in db.View_WBS_CostControlParentDetail
|
||||
where x.Months == Funs.GetNewDateTime(date)
|
||||
select x;
|
||||
DataRow row4;
|
||||
decimal cnACWP, cnBCWP, cnBCWS, cnmACWP, cnmBCWP, cnmBCWS, cnCV, cnSV, cnCPI, cnSPI, cnmCV, cnmSV, cnmCPI, cnmSPI,
|
||||
unACWP, unBCWP, unBCWS, unmACWP, unmBCWP, unmBCWS, unCV, unSV, unCPI, unSPI, unmCV, unmSV, unmCPI, unmSPI;
|
||||
int a = 1, b = 1;
|
||||
foreach (var cn in cnProfessionInits)
|
||||
unACWP, unBCWP, unBCWS, unmACWP, unmBCWP, unmBCWS, unCV, unSV, unCPI, unSPI, unmCV, unmSV, unmCPI, unmSPI,
|
||||
inACWP, inBCWP, inBCWS, inmACWP, inmBCWP, inmBCWS, inCV, inSV, inCPI, inSPI, inmCV, inmSV, inmCPI, inmSPI;
|
||||
int a = 1, b = 1, c = 1;
|
||||
foreach (var item in installations)
|
||||
{
|
||||
cnACWP = 0;
|
||||
cnBCWP = 0;
|
||||
cnBCWS = 0;
|
||||
cnmACWP = 0;
|
||||
cnmBCWP = 0;
|
||||
cnmBCWS = 0;
|
||||
cnCV = 0;
|
||||
cnSV = 0;
|
||||
cnCPI = 0;
|
||||
cnSPI = 0;
|
||||
cnmCV = 0;
|
||||
cnmSV = 0;
|
||||
cnmCPI = 0;
|
||||
cnmSPI = 0;
|
||||
inACWP = 0;
|
||||
inBCWP = 0;
|
||||
inBCWS = 0;
|
||||
inmACWP = 0;
|
||||
inmBCWP = 0;
|
||||
inmBCWS = 0;
|
||||
inCV = 0;
|
||||
inSV = 0;
|
||||
inCPI = 0;
|
||||
inSPI = 0;
|
||||
inmCV = 0;
|
||||
inmSV = 0;
|
||||
inmCPI = 0;
|
||||
inmSPI = 0;
|
||||
row4 = table4.NewRow();
|
||||
row4[0] = a;
|
||||
row4[0] = c.ToString();
|
||||
row4[1] = "0";
|
||||
row4[2] = cn.CnProfessionName;
|
||||
var cnDetails = (from x in details
|
||||
join y in cnProfessions on x.ParentId equals y.CnProfessionId
|
||||
where y.OldId == cn.CnProfessionId
|
||||
row4[2] = item.InstallationName;
|
||||
var inDetails = (from x in details
|
||||
where x.ParentId == item.InstallationId
|
||||
select x).ToList();
|
||||
cnmACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
|
||||
cnmBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
|
||||
cnmBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
|
||||
cnmCV = cnmBCWP - cnmACWP;
|
||||
cnmSV = cnmBCWP - cnmBCWS;
|
||||
if (cnmACWP > 0)
|
||||
inmACWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
|
||||
inmBCWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
|
||||
inmBCWS = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
|
||||
inmCV = inmBCWP - inmACWP;
|
||||
inmSV = inmBCWP - inmBCWS;
|
||||
if (inmACWP > 0)
|
||||
{
|
||||
cnmCPI = cnmBCWP / cnmACWP;
|
||||
inmCPI = inmBCWP / inmACWP;
|
||||
}
|
||||
if (cnmBCWS > 0)
|
||||
if (inmBCWS > 0)
|
||||
{
|
||||
cnmSPI = cnmBCWP / cnmBCWS;
|
||||
inmSPI = inmBCWP / inmBCWS;
|
||||
}
|
||||
row4[3] = cnmBCWP.ToString("0.####");
|
||||
row4[4] = cnmBCWS.ToString("0.####");
|
||||
row4[5] = cnmACWP.ToString("0.####");
|
||||
row4[6] = cnmCV.ToString("0.####");
|
||||
row4[7] = cnmSV.ToString("0.####");
|
||||
row4[8] = cnmCPI.ToString("0.####");
|
||||
row4[9] = cnmSPI.ToString("0.####");
|
||||
cnACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
|
||||
cnBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
|
||||
cnBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
|
||||
cnCV = cnBCWP - cnACWP;
|
||||
cnSV = cnBCWP - cnBCWS;
|
||||
if (cnACWP > 0)
|
||||
row4[3] = inmBCWP.ToString("0.####");
|
||||
row4[4] = inmBCWS.ToString("0.####");
|
||||
row4[5] = inmACWP.ToString("0.####");
|
||||
row4[6] = inmCV.ToString("0.####");
|
||||
row4[7] = inmSV.ToString("0.####");
|
||||
row4[8] = inmCPI.ToString("0.####");
|
||||
row4[9] = inmSPI.ToString("0.####");
|
||||
inACWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
|
||||
inBCWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
|
||||
inBCWS = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
|
||||
inCV = inBCWP - inACWP;
|
||||
inSV = inBCWP - inBCWS;
|
||||
if (inACWP > 0)
|
||||
{
|
||||
cnCPI = cnBCWP / cnACWP;
|
||||
inCPI = inBCWP / inACWP;
|
||||
}
|
||||
if (cnBCWS > 0)
|
||||
if (inBCWS > 0)
|
||||
{
|
||||
cnSPI = cnBCWP / cnBCWS;
|
||||
inSPI = inBCWP / inBCWS;
|
||||
}
|
||||
row4[10] = cnBCWP.ToString("0.####");
|
||||
row4[11] = cnBCWS.ToString("0.####");
|
||||
row4[12] = cnACWP.ToString("0.####");
|
||||
row4[13] = cnCV.ToString("0.####");
|
||||
row4[14] = cnSV.ToString("0.####");
|
||||
row4[15] = cnCPI.ToString("0.####");
|
||||
row4[16] = cnSPI.ToString("0.####");
|
||||
row4[10] = inBCWP.ToString("0.####");
|
||||
row4[11] = inBCWS.ToString("0.####");
|
||||
row4[12] = inACWP.ToString("0.####");
|
||||
row4[13] = inCV.ToString("0.####");
|
||||
row4[14] = inSV.ToString("0.####");
|
||||
row4[15] = inCPI.ToString("0.####");
|
||||
row4[16] = inSPI.ToString("0.####");
|
||||
table4.Rows.Add(row4);
|
||||
b = 1;
|
||||
var unLists = (from x in unitProjectInits where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x).ToList();
|
||||
foreach (var un in unLists)
|
||||
a = 1;
|
||||
var icnProfessions = cnProfessions.Where(x => x.InstallationId == item.InstallationId);
|
||||
foreach (var cn in icnProfessions)
|
||||
{
|
||||
unACWP = 0;
|
||||
unBCWP = 0;
|
||||
unBCWS = 0;
|
||||
unmACWP = 0;
|
||||
unmBCWP = 0;
|
||||
unmBCWS = 0;
|
||||
unCV = 0;
|
||||
unSV = 0;
|
||||
unCPI = 0;
|
||||
unSPI = 0;
|
||||
unmCV = 0;
|
||||
unmSV = 0;
|
||||
unmCPI = 0;
|
||||
unmSPI = 0;
|
||||
cnACWP = 0;
|
||||
cnBCWP = 0;
|
||||
cnBCWS = 0;
|
||||
cnmACWP = 0;
|
||||
cnmBCWP = 0;
|
||||
cnmBCWS = 0;
|
||||
cnCV = 0;
|
||||
cnSV = 0;
|
||||
cnCPI = 0;
|
||||
cnSPI = 0;
|
||||
cnmCV = 0;
|
||||
cnmSV = 0;
|
||||
cnmCPI = 0;
|
||||
cnmSPI = 0;
|
||||
row4 = table4.NewRow();
|
||||
row4[0] = a.ToString() + "." + b.ToString();
|
||||
row4[1] = a;
|
||||
row4[2] = un.UnitProjectName;
|
||||
var unDetails = from x in details
|
||||
join y in unitProjects on x.ParentId equals y.UnitProjectId
|
||||
where y.UnitProjectCode == un.UnitProjectCode
|
||||
select x;
|
||||
unmACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
|
||||
unmBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
|
||||
unmBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
|
||||
unmCV = unmBCWP - unmACWP;
|
||||
unmSV = unmBCWP - unmBCWS;
|
||||
if (unmACWP > 0)
|
||||
row4[0] = c.ToString() + "." + a.ToString();
|
||||
row4[1] = c;
|
||||
row4[2] = cn.CnProfessionName;
|
||||
var cnDetails = (from x in details
|
||||
where x.ParentId == cn.CnProfessionId
|
||||
select x).ToList();
|
||||
cnmACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
|
||||
cnmBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
|
||||
cnmBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
|
||||
cnmCV = cnmBCWP - cnmACWP;
|
||||
cnmSV = cnmBCWP - cnmBCWS;
|
||||
if (cnmACWP > 0)
|
||||
{
|
||||
unmCPI = unmBCWP / unmACWP;
|
||||
cnmCPI = cnmBCWP / cnmACWP;
|
||||
}
|
||||
if (unmBCWS > 0)
|
||||
if (cnmBCWS > 0)
|
||||
{
|
||||
unmSPI = unmBCWP / unmBCWS;
|
||||
cnmSPI = cnmBCWP / cnmBCWS;
|
||||
}
|
||||
row4[3] = unmBCWP.ToString("0.####");
|
||||
row4[4] = unmBCWS.ToString("0.####");
|
||||
row4[5] = unmACWP.ToString("0.####");
|
||||
row4[6] = unmCV.ToString("0.####");
|
||||
row4[7] = unmSV.ToString("0.####");
|
||||
row4[8] = unmCPI.ToString("0.####");
|
||||
row4[9] = unmSPI.ToString("0.####");
|
||||
unACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
|
||||
unBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
|
||||
unBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
|
||||
unCV = unBCWP - unACWP;
|
||||
unSV = unBCWP - unBCWS;
|
||||
if (unACWP > 0)
|
||||
row4[3] = cnmBCWP.ToString("0.####");
|
||||
row4[4] = cnmBCWS.ToString("0.####");
|
||||
row4[5] = cnmACWP.ToString("0.####");
|
||||
row4[6] = cnmCV.ToString("0.####");
|
||||
row4[7] = cnmSV.ToString("0.####");
|
||||
row4[8] = cnmCPI.ToString("0.####");
|
||||
row4[9] = cnmSPI.ToString("0.####");
|
||||
cnACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
|
||||
cnBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
|
||||
cnBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
|
||||
cnCV = cnBCWP - cnACWP;
|
||||
cnSV = cnBCWP - cnBCWS;
|
||||
if (cnACWP > 0)
|
||||
{
|
||||
unCPI = unBCWP / unACWP;
|
||||
cnCPI = cnBCWP / cnACWP;
|
||||
}
|
||||
if (unBCWS > 0)
|
||||
if (cnBCWS > 0)
|
||||
{
|
||||
unSPI = unBCWP / unBCWS;
|
||||
cnSPI = cnBCWP / cnBCWS;
|
||||
}
|
||||
row4[10] = unBCWP.ToString("0.####");
|
||||
row4[11] = unBCWS.ToString("0.####");
|
||||
row4[12] = unACWP.ToString("0.####");
|
||||
row4[13] = unCV.ToString("0.####");
|
||||
row4[14] = unSV.ToString("0.####");
|
||||
row4[15] = unCPI.ToString("0.####");
|
||||
row4[16] = unSPI.ToString("0.####");
|
||||
row4[10] = cnBCWP.ToString("0.####");
|
||||
row4[11] = cnBCWS.ToString("0.####");
|
||||
row4[12] = cnACWP.ToString("0.####");
|
||||
row4[13] = cnCV.ToString("0.####");
|
||||
row4[14] = cnSV.ToString("0.####");
|
||||
row4[15] = cnCPI.ToString("0.####");
|
||||
row4[16] = cnSPI.ToString("0.####");
|
||||
table4.Rows.Add(row4);
|
||||
b++;
|
||||
b = 1;
|
||||
var unLists = from x in unitProjects where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x;
|
||||
foreach (var un in unLists)
|
||||
{
|
||||
unACWP = 0;
|
||||
unBCWP = 0;
|
||||
unBCWS = 0;
|
||||
unmACWP = 0;
|
||||
unmBCWP = 0;
|
||||
unmBCWS = 0;
|
||||
unCV = 0;
|
||||
unSV = 0;
|
||||
unCPI = 0;
|
||||
unSPI = 0;
|
||||
unmCV = 0;
|
||||
unmSV = 0;
|
||||
unmCPI = 0;
|
||||
unmSPI = 0;
|
||||
row4 = table4.NewRow();
|
||||
row4[0] = c.ToString() + "." + a.ToString() + "." + b.ToString();
|
||||
row4[1] = c.ToString() + "." + a.ToString();
|
||||
row4[2] = un.UnitProjectName;
|
||||
var unDetails = from x in details
|
||||
where x.ParentId == un.UnitProjectId
|
||||
select x;
|
||||
unmACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
|
||||
unmBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
|
||||
unmBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
|
||||
unmCV = unmBCWP - unmACWP;
|
||||
unmSV = unmBCWP - unmBCWS;
|
||||
if (unmACWP > 0)
|
||||
{
|
||||
unmCPI = unmBCWP / unmACWP;
|
||||
}
|
||||
if (unmBCWS > 0)
|
||||
{
|
||||
unmSPI = unmBCWP / unmBCWS;
|
||||
}
|
||||
row4[3] = unmBCWP.ToString("0.####");
|
||||
row4[4] = unmBCWS.ToString("0.####");
|
||||
row4[5] = unmACWP.ToString("0.####");
|
||||
row4[6] = unmCV.ToString("0.####");
|
||||
row4[7] = unmSV.ToString("0.####");
|
||||
row4[8] = unmCPI.ToString("0.####");
|
||||
row4[9] = unmSPI.ToString("0.####");
|
||||
unACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
|
||||
unBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
|
||||
unBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
|
||||
unCV = unBCWP - unACWP;
|
||||
unSV = unBCWP - unBCWS;
|
||||
if (unACWP > 0)
|
||||
{
|
||||
unCPI = unBCWP / unACWP;
|
||||
}
|
||||
if (unBCWS > 0)
|
||||
{
|
||||
unSPI = unBCWP / unBCWS;
|
||||
}
|
||||
row4[10] = unBCWP.ToString("0.####");
|
||||
row4[11] = unBCWS.ToString("0.####");
|
||||
row4[12] = unACWP.ToString("0.####");
|
||||
row4[13] = unCV.ToString("0.####");
|
||||
row4[14] = unSV.ToString("0.####");
|
||||
row4[15] = unCPI.ToString("0.####");
|
||||
row4[16] = unSPI.ToString("0.####");
|
||||
table4.Rows.Add(row4);
|
||||
b++;
|
||||
}
|
||||
a++;
|
||||
}
|
||||
a++;
|
||||
c++;
|
||||
}
|
||||
if (table4.Rows.Count > 0)
|
||||
{
|
||||
@@ -350,7 +417,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
|
||||
this.Grid4.DataBind();
|
||||
}
|
||||
|
||||
//按专业统计
|
||||
//按设备材料分类统计
|
||||
DataTable table5 = new DataTable();
|
||||
table5.Columns.Add(new DataColumn("Id", typeof(String)));
|
||||
table5.Columns.Add(new DataColumn("Name", typeof(String)));
|
||||
|
||||
Reference in New Issue
Block a user