修改进度报表导出
This commit is contained in:
@@ -13,7 +13,7 @@ namespace BLL
|
||||
/// 获取模拟树表格
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetTreeDataTable(string projectId, DateTime months, string startDate, string cnProfessionId, string unitProjectCode, string wbsSetCode)
|
||||
public static DataTable GetTreeDataTable(string projectId, DateTime months, string startDate, string cnProfessionId, string unitProjectCode, string wbsSetCode, string equipmentMaterialType)
|
||||
{
|
||||
List<Model.View_WBS_CostControlDetailStatistics> CostControlDetailStatisticsList = new List<Model.View_WBS_CostControlDetailStatistics>();
|
||||
DataTable table = new DataTable();
|
||||
@@ -36,7 +36,7 @@ namespace BLL
|
||||
table.Columns.Add(new DataColumn("TotalPlanValue", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("TotalPlanCost", typeof(String)));
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var costControls = from x in db.WBS_CostControl where x.ProjectId == projectId select x;
|
||||
var costControls = from x in db.WBS_CostControl where x.ProjectId == projectId where x.IsSelected == true select x;
|
||||
var details = from x in db.View_WBS_CostControlDetail where x.ProjectId == projectId select x;
|
||||
var parentDetails = from x in db.View_WBS_CostControlParentDetail select x;
|
||||
var wbsSets = from x in db.Wbs_WbsSet where x.ProjectId == projectId select x;
|
||||
@@ -46,6 +46,17 @@ namespace BLL
|
||||
var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == projectId select x;
|
||||
var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
||||
var installations = from x in db.Project_Installation where x.ProjectId == projectId select x;
|
||||
var totalEquipmentMaterialTypes = from x in db.WBS_EquipmentMaterialType
|
||||
join y in db.WBS_EquipmentMaterialBigType
|
||||
on x.EquipmentMaterialBigTypeId equals y.EquipmentMaterialBigTypeId
|
||||
orderby x.EquipmentMaterialTypeCode
|
||||
select new
|
||||
{
|
||||
x.EquipmentMaterialTypeId,
|
||||
x.EquipmentMaterialTypeName,
|
||||
x.EquipmentMaterialBigTypeId,
|
||||
y.CnProfessionId,
|
||||
};
|
||||
CostControlDetailStatisticsList = (from x in db.View_WBS_CostControlDetailStatistics where x.ProjectId == projectId select x).Distinct().ToList();
|
||||
List<Model.View_WBS_CostControlDetailStatistics> newList = new List<Model.View_WBS_CostControlDetailStatistics>();
|
||||
var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0");
|
||||
@@ -61,77 +72,312 @@ namespace BLL
|
||||
#region 全部统计
|
||||
if (cnProfessionId == BLL.Const._Null) //全部统计
|
||||
{
|
||||
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
||||
if (string.IsNullOrEmpty(equipmentMaterialType))
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = item.SupId;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.ProjectId;
|
||||
Model.WBS_CostControl costControl = costControls.FirstOrDefault(x => x.CostControlId == item.Id);
|
||||
if (costControl != null)
|
||||
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
||||
{
|
||||
Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months);
|
||||
if (detail != null)
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = item.SupId;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.ProjectId;
|
||||
Model.WBS_CostControl costControl = costControls.FirstOrDefault(x => x.CostControlId == item.Id);
|
||||
if (costControl != null)
|
||||
{
|
||||
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);//累计完成预算
|
||||
Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months);
|
||||
if (detail != null)
|
||||
{
|
||||
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);//累计完成预算
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlDetail lastDetail = details.OrderByDescending(x => x.Months).FirstOrDefault(x => x.CostControlId == item.Id);
|
||||
if (lastDetail != null && lastDetail.Months <= months)
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != 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[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);//累计完成预算
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
var equipmentMaterialTypes = totalEquipmentMaterialTypes.Where(x => x.EquipmentMaterialTypeName.Contains(equipmentMaterialType));
|
||||
var equipmentMaterialTypeList = newList.Where(x => x.EquipmentMaterialTypeName.Contains(equipmentMaterialType));
|
||||
if (equipmentMaterialTypeList.Count() > 0)
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
parentRow = table.NewRow();
|
||||
parentRow[0] = equipmentMaterialType;
|
||||
parentRow[1] = "0";
|
||||
parentRow[2] = equipmentMaterialType;
|
||||
parentRow[3] = projectId;
|
||||
var costControl = costControls.FirstOrDefault(x => x.CostControlId == equipmentMaterialTypeList.First().Id);
|
||||
if (costControl != null)
|
||||
{
|
||||
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);//累计完成预算
|
||||
parentRow[4] = costControl.Unit;//单位
|
||||
}
|
||||
else
|
||||
var costControlList = from x in costControls
|
||||
join y in db.WBS_EquipmentMaterialType
|
||||
on x.EquipmentMaterialTypeId equals y.EquipmentMaterialTypeId
|
||||
where y.EquipmentMaterialTypeName.Contains(equipmentMaterialType)
|
||||
select x;
|
||||
var costControlIdList = costControlList.Select(x => x.CostControlId).ToList();
|
||||
List<string> ids = new List<string>();
|
||||
foreach (var costControlItem in costControlList) //获取所有关联费控清单的父级节点Id
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(costControlItem.WbsSetId);
|
||||
GetAllWbsIds(ids, costControlItem.WbsSetId);
|
||||
ids.Add(wbsSet.UnitProjectId);
|
||||
ids.Add(wbsSet.CnProfessionId);
|
||||
GetAllInsIds(ids, wbsSet.InstallationId);
|
||||
}
|
||||
ids.AddRange(costControlIdList);
|
||||
var parDetails = details.Where(x => costControlIdList.Contains(x.CostControlId) && x.Months == months);
|
||||
parentRow[5] = decimal.Round(costControlList.Sum(x => Convert.ToDecimal(x.TotalNum ?? 0)), 2);//合同工作量
|
||||
//parentRow[6] = decimal.Round(Convert.ToDecimal(detail.RealPrice), 2);//成本单价
|
||||
parentRow[7] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.PlanNum ?? 0)), 2);//本月计划完成量
|
||||
parentRow[8] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.ThisNum ?? 0)), 2);//本月完成量
|
||||
//parentRow[9] = decimal.Round(Convert.ToDecimal(detail.PlanPrice), 2);//控制预算单价
|
||||
parentRow[10] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.ThisRealCost ?? 0)), 2);//本月实际成本
|
||||
parentRow[11] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.ThisPlanValue ?? 0)), 2);//本月计划完成预算
|
||||
parentRow[12] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.ThisPlanCost ?? 0)), 2);//本月完成预算
|
||||
parentRow[13] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.TotalPlanNum ?? 0)), 2);//累计计划完成量
|
||||
parentRow[14] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.TotalThisNum ?? 0)), 2);//累计完成量
|
||||
parentRow[15] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.TotalRealCost ?? 0)), 2);//累计完成成本
|
||||
parentRow[16] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.TotalPlanValue ?? 0)), 2);//累计计划完成预算
|
||||
parentRow[17] = decimal.Round(parDetails.Sum(x => Convert.ToDecimal(x.TotalPlanCost ?? 0)), 2);//累计完成预算
|
||||
table.Rows.Add(parentRow);
|
||||
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
||||
{
|
||||
if (ids.Contains(item.Id))
|
||||
{
|
||||
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 = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.ProjectId;
|
||||
if (item.WBSType == "Installation")
|
||||
{
|
||||
decimal ind10 = 0, ind11 = 0, ind12 = 0, ind15 = 0, ind16 = 0, ind17 = 0;
|
||||
if (item.SupId == "0")
|
||||
{
|
||||
row[1] = equipmentMaterialType;
|
||||
}
|
||||
else
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
}
|
||||
List<string> cnIds = BLL.CnProfessionService.GetCnProfessionIdsByInstallationIdAndOldId(item.Id, cnProfessionId);
|
||||
foreach (var cnId in cnIds)
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == cnId && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
ind10 += decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);
|
||||
ind11 += decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);
|
||||
ind12 += decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);
|
||||
ind15 += decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);
|
||||
ind16 += decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);
|
||||
ind17 += decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == cnId);
|
||||
if (parentLastDetail != null && parentLastDetail.Months <= months)
|
||||
{
|
||||
ind15 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);
|
||||
ind16 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);
|
||||
ind17 += decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ind10 != 0)
|
||||
{
|
||||
row[10] = decimal.Round(ind10, 2);//本月实际成本
|
||||
row[11] = decimal.Round(ind11, 2);//本月计划完成预算
|
||||
row[12] = decimal.Round(ind12, 2);//本月完成预算
|
||||
row[15] = decimal.Round(ind15, 2);//累计完成成本
|
||||
row[16] = decimal.Round(ind16, 2);//累计计划完成预算
|
||||
row[17] = decimal.Round(ind17, 2);//累计完成预算
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ind15 > 0)
|
||||
{
|
||||
row[15] = decimal.Round(ind15, 2);//累计完成成本
|
||||
}
|
||||
if (ind16 > 0)
|
||||
{
|
||||
row[16] = decimal.Round(ind16, 2);//累计计划完成预算
|
||||
}
|
||||
if (ind17 > 0)
|
||||
{
|
||||
row[17] = decimal.Round(ind17, 2);//累计完成预算
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.WBSType == "CnProfession")
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
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 == "UnitProject")
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
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 == "WbsSet")
|
||||
{
|
||||
row[1] = item.SupId;
|
||||
Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
|
||||
if (parentDetail != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -2535,6 +2781,26 @@ namespace BLL
|
||||
return table;
|
||||
}
|
||||
|
||||
private static void GetAllWbsIds(List<string> list, string wbsSetId)
|
||||
{
|
||||
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(wbsSetId);
|
||||
if (wbsSet != null)
|
||||
{
|
||||
list.Add(wbsSetId);
|
||||
GetAllWbsIds(list,wbsSet.SuperWbsSetId);
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetAllInsIds(List<string> list, string installationId)
|
||||
{
|
||||
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(installationId);
|
||||
if (installation != null)
|
||||
{
|
||||
list.Add(installationId);
|
||||
GetAllInsIds(list, installation.SuperInstallationId);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDetail(List<Model.View_WBS_CostControlDetailStatistics> newList, List<Model.View_WBS_CostControlDetailStatistics> oldList, string id)
|
||||
{
|
||||
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
|
||||
@@ -2626,7 +2892,7 @@ namespace BLL
|
||||
var cnProfessionInits = getCnProfessionInits;
|
||||
var installations = getInstallations.Where(x => x.ProjectId == projectId);
|
||||
|
||||
CostControlDetailStatisticsList = getCostControlDetailStatisticss.Where(x=> x.ProjectId == projectId).Distinct().ToList();
|
||||
CostControlDetailStatisticsList = getCostControlDetailStatisticss.Where(x => x.ProjectId == projectId).Distinct().ToList();
|
||||
List<Model.View_WBS_CostControlDetailStatistics> newList = new List<Model.View_WBS_CostControlDetailStatistics>();
|
||||
var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0");
|
||||
foreach (var item in installationList)
|
||||
@@ -2710,7 +2976,7 @@ namespace BLL
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
row[14 + (months.Count-1) * 2] = item.Id;
|
||||
row[14 + (months.Count - 1) * 2] = item.Id;
|
||||
//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);//本月完成预算
|
||||
|
||||
Reference in New Issue
Block a user