0118-gaofei
This commit is contained in:
@@ -372,8 +372,8 @@ namespace BLL
|
||||
else
|
||||
{
|
||||
Model.WBS_CnProfessionInit cnInit = BLL.CnProfessionInitService.GetCnProfessionInitByCnProfessionId(cnProfessionId);
|
||||
newList = (from x in newList where (x.WBSType == "Installation" && x.Name == cnInit.CnProfessionName) || (x.WBSType != "Installation" && x.OldCnProfessionId.ToString() == cnProfessionId) select x).ToList();
|
||||
var cn = newList.FirstOrDefault(x => x.Name == cnInit.CnProfessionName);
|
||||
newList = (from x in newList where (x.WBSType == "Installation" && x.Name.Contains(cnInit.CnProfessionName.Substring(0, 2))) || (x.WBSType != "Installation" && x.OldCnProfessionId.ToString() == cnProfessionId) select x).ToList();
|
||||
var cn = newList.FirstOrDefault(x => x.Name.Contains(cnInit.CnProfessionName.Substring(0, 2)) && x.WBSType == "Installation");
|
||||
parentRow = table.NewRow();
|
||||
parentRow[0] = cn.Id;
|
||||
parentRow[1] = "0";
|
||||
@@ -1169,119 +1169,122 @@ namespace BLL
|
||||
newList = (from x in newList where x.WBSType != "Installation" && x.WBSType != "CnProfession" && x.WBSType != "UnitProject" && x.OldCnProfessionId.ToString() == cnProfessionId && x.OldUnitProjectCode == unitProjectCode && x.OldWbsSetCode == wbsSetCode select x).ToList();
|
||||
var wb = newList.FirstOrDefault(x => x.WBSType == "WbsSet" && x.OldWbsSetCode == wbsSetCode);
|
||||
parentRow = table.NewRow();
|
||||
parentRow[0] = wb.Id;
|
||||
parentRow[1] = "0";
|
||||
parentRow[2] = wb.Name;
|
||||
parentRow[3] = projectId;
|
||||
Model.View_WBS_CostControlParentDetail pparentDetail = parentDetails.FirstOrDefault(x => x.ParentId == wb.Id && x.Months == months);
|
||||
if (pparentDetail != null)
|
||||
if (wb != null)
|
||||
{
|
||||
d10 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisRealCost), 2);
|
||||
d11 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisPlanValue), 2);
|
||||
d12 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisPlanCost), 2);
|
||||
d15 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalRealCost), 2);
|
||||
d16 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalPlanValue), 2);
|
||||
d17 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalPlanCost), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == wb.Id);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
parentRow[0] = wb.Id;
|
||||
parentRow[1] = "0";
|
||||
parentRow[2] = wb.Name;
|
||||
parentRow[3] = projectId;
|
||||
Model.View_WBS_CostControlParentDetail pparentDetail = parentDetails.FirstOrDefault(x => x.ParentId == wb.Id && x.Months == months);
|
||||
if (pparentDetail != null)
|
||||
{
|
||||
d15 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);
|
||||
d16 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);
|
||||
d17 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);
|
||||
d10 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisRealCost), 2);
|
||||
d11 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisPlanValue), 2);
|
||||
d12 += decimal.Round(Convert.ToDecimal(pparentDetail.ThisPlanCost), 2);
|
||||
d15 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalRealCost), 2);
|
||||
d16 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalPlanValue), 2);
|
||||
d17 += decimal.Round(Convert.ToDecimal(pparentDetail.TotalPlanCost), 2);
|
||||
}
|
||||
}
|
||||
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.ProjectId;
|
||||
if (item.WBSType == "WbsSet")
|
||||
else
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
var wbsSet = wbsSets.FirstOrDefault(x => x.WbsSetId == item.Id);
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == wb.Id);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
{
|
||||
row[10] = decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);//本月实际成本
|
||||
row[11] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);//本月计划完成预算
|
||||
row[12] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);//本月完成预算
|
||||
row[15] = decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);//累计完成预算
|
||||
d15 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);
|
||||
d16 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);
|
||||
d17 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);
|
||||
}
|
||||
else
|
||||
}
|
||||
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.ProjectId;
|
||||
if (item.WBSType == "WbsSet")
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
row[1] = item.SupId;
|
||||
var wbsSet = wbsSets.FirstOrDefault(x => x.WbsSetId == item.Id);
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
row[15] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);//累计完成预算
|
||||
row[10] = decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);//本月实际成本
|
||||
row[11] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);//本月计划完成预算
|
||||
row[12] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);//本月完成预算
|
||||
row[15] = decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
{
|
||||
row[15] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);//累计完成预算
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.WBSType == "CostControl")
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months);
|
||||
if (detail != null)
|
||||
else if (item.WBSType == "CostControl")
|
||||
{
|
||||
row[4] = detail.Unit;//单位
|
||||
row[5] = decimal.Round(Convert.ToDecimal(detail.TotalNum), 2);//合同工作量
|
||||
row[6] = decimal.Round(Convert.ToDecimal(detail.RealPrice), 2);//成本单价
|
||||
row[7] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2);//本月计划完成量
|
||||
row[8] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2);//本月完成量
|
||||
row[9] = decimal.Round(Convert.ToDecimal(detail.PlanPrice), 2);//控制预算单价
|
||||
row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本
|
||||
row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算
|
||||
row[12] = decimal.Round(Convert.ToDecimal(detail.ThisPlanCost), 2);//本月完成预算
|
||||
row[13] = decimal.Round(Convert.ToDecimal(detail.TotalPlanNum), 2);//累计计划完成量
|
||||
row[14] = decimal.Round(Convert.ToDecimal(detail.TotalThisNum), 2);//累计完成量
|
||||
row[15] = decimal.Round(Convert.ToDecimal(detail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(detail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(detail.TotalPlanCost), 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlDetail lastDetail = details.OrderByDescending(x => x.Months).FirstOrDefault(x => x.CostControlId == item.Id);
|
||||
if (lastDetail != null && lastDetail.Months <= months)
|
||||
row[1] = item.SupId;
|
||||
Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months);
|
||||
if (detail != null)
|
||||
{
|
||||
row[4] = lastDetail.Unit;//单位
|
||||
row[5] = decimal.Round(Convert.ToDecimal(lastDetail.TotalNum), 2);//合同工作量
|
||||
row[6] = decimal.Round(Convert.ToDecimal(lastDetail.RealPrice), 2);//成本单价
|
||||
row[7] = decimal.Round(Convert.ToDecimal(lastDetail.PlanNum), 2);//本月计划完成量
|
||||
row[8] = decimal.Round(Convert.ToDecimal(lastDetail.ThisNum), 2);//本月完成量
|
||||
row[9] = decimal.Round(Convert.ToDecimal(lastDetail.PlanPrice), 2);//控制预算单价
|
||||
row[13] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanNum), 2);//累计计划完成量
|
||||
row[14] = decimal.Round(Convert.ToDecimal(lastDetail.TotalThisNum), 2);//累计完成量
|
||||
row[15] = decimal.Round(Convert.ToDecimal(lastDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanCost), 2);//累计完成预算
|
||||
row[4] = detail.Unit;//单位
|
||||
row[5] = decimal.Round(Convert.ToDecimal(detail.TotalNum), 2);//合同工作量
|
||||
row[6] = decimal.Round(Convert.ToDecimal(detail.RealPrice), 2);//成本单价
|
||||
row[7] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2);//本月计划完成量
|
||||
row[8] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2);//本月完成量
|
||||
row[9] = decimal.Round(Convert.ToDecimal(detail.PlanPrice), 2);//控制预算单价
|
||||
row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本
|
||||
row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算
|
||||
row[12] = decimal.Round(Convert.ToDecimal(detail.ThisPlanCost), 2);//本月完成预算
|
||||
row[13] = decimal.Round(Convert.ToDecimal(detail.TotalPlanNum), 2);//累计计划完成量
|
||||
row[14] = decimal.Round(Convert.ToDecimal(detail.TotalThisNum), 2);//累计完成量
|
||||
row[15] = decimal.Round(Convert.ToDecimal(detail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(detail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(detail.TotalPlanCost), 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlDetail lastDetail = details.OrderByDescending(x => x.Months).FirstOrDefault(x => x.CostControlId == item.Id);
|
||||
if (lastDetail != null && lastDetail.Months <= months)
|
||||
{
|
||||
row[4] = lastDetail.Unit;//单位
|
||||
row[5] = decimal.Round(Convert.ToDecimal(lastDetail.TotalNum), 2);//合同工作量
|
||||
row[6] = decimal.Round(Convert.ToDecimal(lastDetail.RealPrice), 2);//成本单价
|
||||
row[7] = decimal.Round(Convert.ToDecimal(lastDetail.PlanNum), 2);//本月计划完成量
|
||||
row[8] = decimal.Round(Convert.ToDecimal(lastDetail.ThisNum), 2);//本月完成量
|
||||
row[9] = decimal.Round(Convert.ToDecimal(lastDetail.PlanPrice), 2);//控制预算单价
|
||||
row[13] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanNum), 2);//累计计划完成量
|
||||
row[14] = decimal.Round(Convert.ToDecimal(lastDetail.TotalThisNum), 2);//累计完成量
|
||||
row[15] = decimal.Round(Convert.ToDecimal(lastDetail.TotalRealCost), 2);//累计完成成本
|
||||
row[16] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanValue), 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(Convert.ToDecimal(lastDetail.TotalPlanCost), 2);//累计完成预算
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
if (d10 != 0)
|
||||
{
|
||||
parentRow[10] = decimal.Round(d10, 2);//本月实际成本
|
||||
parentRow[11] = decimal.Round(d11, 2);//本月计划完成预算
|
||||
parentRow[12] = decimal.Round(d12, 2);//本月完成预算
|
||||
parentRow[15] = decimal.Round(d15, 2);//累计完成成本
|
||||
parentRow[16] = decimal.Round(d16, 2);//累计计划完成预算
|
||||
parentRow[17] = decimal.Round(d17, 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
parentRow[15] = decimal.Round(d15, 2);//累计完成成本
|
||||
parentRow[16] = decimal.Round(d16, 2);//累计计划完成预算
|
||||
parentRow[17] = decimal.Round(d17, 2);//累计完成预算
|
||||
}
|
||||
table.Rows.Add(parentRow);
|
||||
}
|
||||
if (d10 != 0)
|
||||
{
|
||||
parentRow[10] = decimal.Round(d10, 2);//本月实际成本
|
||||
parentRow[11] = decimal.Round(d11, 2);//本月计划完成预算
|
||||
parentRow[12] = decimal.Round(d12, 2);//本月完成预算
|
||||
parentRow[15] = decimal.Round(d15, 2);//累计完成成本
|
||||
parentRow[16] = decimal.Round(d16, 2);//累计计划完成预算
|
||||
parentRow[17] = decimal.Round(d17, 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
parentRow[15] = decimal.Round(d15, 2);//累计完成成本
|
||||
parentRow[16] = decimal.Round(d16, 2);//累计计划完成预算
|
||||
parentRow[17] = decimal.Round(d17, 2);//累计完成预算
|
||||
}
|
||||
table.Rows.Add(parentRow);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user