|
|
|
@@ -2787,7 +2787,7 @@ namespace BLL
|
|
|
|
|
if (wbsSet != null)
|
|
|
|
|
{
|
|
|
|
|
list.Add(wbsSetId);
|
|
|
|
|
GetAllWbsIds(list,wbsSet.SuperWbsSetId);
|
|
|
|
|
GetAllWbsIds(list, wbsSet.SuperWbsSetId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2822,17 +2822,7 @@ namespace BLL
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static IQueryable<Model.WBS_CostControl> getCostControls = from x in db.WBS_CostControl select x;
|
|
|
|
|
private static IQueryable<Model.View_WBS_CostControlDetail> getDetails = from x in db.View_WBS_CostControlDetail select x;
|
|
|
|
|
private static IQueryable<Model.View_WBS_CostControlParentDetail> getParentDetails = from x in db.View_WBS_CostControlParentDetail select x;
|
|
|
|
|
private static IQueryable<Model.Wbs_WbsSet> getWbsSets = from x in db.Wbs_WbsSet select x;
|
|
|
|
|
private static IQueryable<Model.WBS_WbsSetInit> getWbsSetInits = from x in db.WBS_WbsSetInit select x;
|
|
|
|
|
private static IQueryable<Model.Wbs_UnitProject> getUnitProjects = from x in db.Wbs_UnitProject select x;
|
|
|
|
|
private static IQueryable<Model.Wbs_UnitProjectInit> getUnitProjectInits = from x in db.Wbs_UnitProjectInit select x;
|
|
|
|
|
private static IQueryable<Model.WBS_CnProfession> getCnProfessions = from x in db.WBS_CnProfession select x;
|
|
|
|
|
private static IQueryable<Model.WBS_CnProfessionInit> getCnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
|
|
|
|
private static IQueryable<Model.Project_Installation> getInstallations = from x in db.Project_Installation select x;
|
|
|
|
|
private static IQueryable<Model.View_WBS_CostControlDetailStatistics> getCostControlDetailStatisticss = from x in db.View_WBS_CostControlDetailStatistics select x;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@@ -2841,178 +2831,192 @@ namespace BLL
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static DataTable GetAllTreeDataTable(string projectId, string IsOut)
|
|
|
|
|
{
|
|
|
|
|
List<Model.View_WBS_CostControlDetailStatistics> CostControlDetailStatisticsList = new List<Model.View_WBS_CostControlDetailStatistics>();
|
|
|
|
|
DataTable table = new DataTable();
|
|
|
|
|
var installation = Funs.DB.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == projectId);
|
|
|
|
|
if (installation != null)
|
|
|
|
|
using (var db = new Model.SGGLDB(Funs.ConnString))
|
|
|
|
|
{
|
|
|
|
|
DateTime startDate, endDate, startMonth, endMonth;
|
|
|
|
|
List<DateTime> months = new List<DateTime>();
|
|
|
|
|
if (installation.StartDate != null && installation.EndDate != null)
|
|
|
|
|
IQueryable<Model.WBS_CostControl> getCostControls = from x in db.WBS_CostControl select x;
|
|
|
|
|
IQueryable<Model.View_WBS_CostControlDetail> getDetails = from x in db.View_WBS_CostControlDetail select x;
|
|
|
|
|
IQueryable<Model.View_WBS_CostControlParentDetail> getParentDetails = from x in db.View_WBS_CostControlParentDetail select x;
|
|
|
|
|
IQueryable<Model.Wbs_WbsSet> getWbsSets = from x in db.Wbs_WbsSet select x;
|
|
|
|
|
IQueryable<Model.WBS_WbsSetInit> getWbsSetInits = from x in db.WBS_WbsSetInit select x;
|
|
|
|
|
IQueryable<Model.Wbs_UnitProject> getUnitProjects = from x in db.Wbs_UnitProject select x;
|
|
|
|
|
IQueryable<Model.Wbs_UnitProjectInit> getUnitProjectInits = from x in db.Wbs_UnitProjectInit select x;
|
|
|
|
|
IQueryable<Model.WBS_CnProfession> getCnProfessions = from x in db.WBS_CnProfession select x;
|
|
|
|
|
IQueryable<Model.WBS_CnProfessionInit> getCnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
|
|
|
|
IQueryable<Model.Project_Installation> getInstallations = from x in db.Project_Installation select x;
|
|
|
|
|
IQueryable<Model.View_WBS_CostControlDetailStatistics> getCostControlDetailStatisticss = from x in db.View_WBS_CostControlDetailStatistics select x;
|
|
|
|
|
List<Model.View_WBS_CostControlDetailStatistics> CostControlDetailStatisticsList = new List<Model.View_WBS_CostControlDetailStatistics>();
|
|
|
|
|
DataTable table = new DataTable();
|
|
|
|
|
var installation = db.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == projectId);
|
|
|
|
|
if (installation != null)
|
|
|
|
|
{
|
|
|
|
|
startDate = Convert.ToDateTime(installation.StartDate);
|
|
|
|
|
endDate = Convert.ToDateTime(installation.EndDate);
|
|
|
|
|
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
|
|
|
|
|
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
|
|
|
|
|
do
|
|
|
|
|
DateTime startDate, endDate, startMonth, endMonth;
|
|
|
|
|
List<DateTime> months = new List<DateTime>();
|
|
|
|
|
if (installation.StartDate != null && installation.EndDate != null)
|
|
|
|
|
{
|
|
|
|
|
months.Add(startMonth);
|
|
|
|
|
startMonth = startMonth.AddMonths(1);
|
|
|
|
|
} while (startMonth <= endMonth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
table.Columns.Add(new DataColumn("Id", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("SupId", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("Name", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("Unit", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("TotalNum", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealPrice", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanPrice", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime)));
|
|
|
|
|
for (int i = 0; i < months.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
|
|
|
|
|
}
|
|
|
|
|
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
|
|
|
|
|
|
|
|
|
|
var costControls = getCostControls.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var details = getDetails.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var parentDetails = getParentDetails;
|
|
|
|
|
var wbsSets = getWbsSets.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var wbsSetInits = getWbsSetInits;
|
|
|
|
|
|
|
|
|
|
var unitProjects = getUnitProjects.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var unitProjectInits = getUnitProjectInits;
|
|
|
|
|
var cnProfessions = getCnProfessions.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var cnProfessionInits = getCnProfessionInits;
|
|
|
|
|
var installations = getInstallations.Where(x => x.ProjectId == projectId);
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
newList.Add(item);
|
|
|
|
|
if (string.IsNullOrEmpty(IsOut))
|
|
|
|
|
{
|
|
|
|
|
AddDetail(newList, CostControlDetailStatisticsList, item.Id);
|
|
|
|
|
startDate = Convert.ToDateTime(installation.StartDate);
|
|
|
|
|
endDate = Convert.ToDateTime(installation.EndDate);
|
|
|
|
|
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
|
|
|
|
|
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
months.Add(startMonth);
|
|
|
|
|
startMonth = startMonth.AddMonths(1);
|
|
|
|
|
} while (startMonth <= endMonth);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
table.Columns.Add(new DataColumn("Id", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("SupId", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("Name", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("Unit", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("TotalNum", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealPrice", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanPrice", typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime)));
|
|
|
|
|
table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime)));
|
|
|
|
|
for (int i = 0; i < months.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty);
|
|
|
|
|
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
|
|
|
|
|
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DataRow row;
|
|
|
|
|
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
|
|
|
|
|
|
|
|
|
|
var costControls = getCostControls.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var details = getDetails.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var parentDetails = getParentDetails;
|
|
|
|
|
var wbsSets = getWbsSets.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var wbsSetInits = getWbsSetInits;
|
|
|
|
|
|
|
|
|
|
var unitProjects = getUnitProjects.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var unitProjectInits = getUnitProjectInits;
|
|
|
|
|
var cnProfessions = getCnProfessions.Where(x => x.ProjectId == projectId);
|
|
|
|
|
var cnProfessionInits = getCnProfessionInits;
|
|
|
|
|
var installations = getInstallations.Where(x => x.ProjectId == projectId);
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
row[4] = costControl.Unit;//单位
|
|
|
|
|
if (costControl.TotalNum != null)
|
|
|
|
|
newList.Add(item);
|
|
|
|
|
if (string.IsNullOrEmpty(IsOut))
|
|
|
|
|
{
|
|
|
|
|
row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量
|
|
|
|
|
AddDetail(newList, CostControlDetailStatisticsList, item.Id);
|
|
|
|
|
}
|
|
|
|
|
if (costControl.RealPrice != null)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
row[6] = decimal.Round(Convert.ToDecimal(costControl.RealPrice), 2);//成本单价
|
|
|
|
|
AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty);
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanPrice != null)
|
|
|
|
|
}
|
|
|
|
|
DataRow row;
|
|
|
|
|
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
|
|
|
|
|
{
|
|
|
|
|
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[7] = decimal.Round(Convert.ToDecimal(costControl.PlanPrice), 2);//控制预算单价
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanStartDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[8] = costControl.PlanStartDate;//计划开始时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanEndDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[9] = costControl.PlanEndDate;//计划完成时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.RealStartDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[10] = costControl.RealStartDate;//实际开始时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.RealEndDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[11] = costControl.RealEndDate;//实际完成时间
|
|
|
|
|
}
|
|
|
|
|
var detail = details.Where(x => x.CostControlId == item.Id).ToList();
|
|
|
|
|
foreach (var item1 in detail)
|
|
|
|
|
{
|
|
|
|
|
var index = months.FindIndex(x => x.Equals(item1.Months));
|
|
|
|
|
if (item1.PlanNum != 0)
|
|
|
|
|
row[4] = costControl.Unit;//单位
|
|
|
|
|
if (costControl.TotalNum != null)
|
|
|
|
|
{
|
|
|
|
|
row[12 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2);
|
|
|
|
|
row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量
|
|
|
|
|
}
|
|
|
|
|
if (item1.ThisNum != 0)
|
|
|
|
|
if (costControl.RealPrice != null)
|
|
|
|
|
{
|
|
|
|
|
row[13 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2);
|
|
|
|
|
row[6] = decimal.Round(Convert.ToDecimal(costControl.RealPrice), 2);//成本单价
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanPrice != null)
|
|
|
|
|
{
|
|
|
|
|
row[7] = decimal.Round(Convert.ToDecimal(costControl.PlanPrice), 2);//控制预算单价
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanStartDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[8] = costControl.PlanStartDate;//计划开始时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.PlanEndDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[9] = costControl.PlanEndDate;//计划完成时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.RealStartDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[10] = costControl.RealStartDate;//实际开始时间
|
|
|
|
|
}
|
|
|
|
|
if (costControl.RealEndDate != null)
|
|
|
|
|
{
|
|
|
|
|
row[11] = costControl.RealEndDate;//实际完成时间
|
|
|
|
|
}
|
|
|
|
|
var detail = details.Where(x => x.CostControlId == item.Id).ToList();
|
|
|
|
|
foreach (var item1 in detail)
|
|
|
|
|
{
|
|
|
|
|
var index = months.FindIndex(x => x.Equals(item1.Months));
|
|
|
|
|
if (item1.PlanNum != 0)
|
|
|
|
|
{
|
|
|
|
|
row[12 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2);
|
|
|
|
|
}
|
|
|
|
|
if (item1.ThisNum != 0)
|
|
|
|
|
{
|
|
|
|
|
row[13 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//for (int i = 0; i < months.Count; i++)
|
|
|
|
|
//{
|
|
|
|
|
// Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]);
|
|
|
|
|
// if (detail != null)
|
|
|
|
|
// {
|
|
|
|
|
// if (detail.PlanNum != 0)
|
|
|
|
|
// {
|
|
|
|
|
// row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2);
|
|
|
|
|
// }
|
|
|
|
|
// if (detail.ThisNum != 0)
|
|
|
|
|
// {
|
|
|
|
|
// row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
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);//本月完成预算
|
|
|
|
|
//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);//累计完成预算
|
|
|
|
|
}
|
|
|
|
|
//for (int i = 0; i < months.Count; i++)
|
|
|
|
|
//{
|
|
|
|
|
// Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]);
|
|
|
|
|
// if (detail != null)
|
|
|
|
|
// {
|
|
|
|
|
// if (detail.PlanNum != 0)
|
|
|
|
|
// {
|
|
|
|
|
// row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2);
|
|
|
|
|
// }
|
|
|
|
|
// if (detail.ThisNum != 0)
|
|
|
|
|
// {
|
|
|
|
|
// row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
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);//本月完成预算
|
|
|
|
|
//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_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);//累计完成预算
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
table.Rows.Add(row);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//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);//累计完成预算
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
table.Rows.Add(row);
|
|
|
|
|
}
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|