0118-gaofei
This commit is contained in:
		
							parent
							
								
									d02cd7ff74
								
							
						
					
					
						commit
						74f7cd5c17
					
				|  | @ -0,0 +1,48 @@ | |||
| 
 | ||||
| ALTER VIEW [dbo].[View_WBS_CostControlDetailStatistics] | ||||
| AS | ||||
| select InstallationId as Id,null as SupId ,InstallationCode as Code, InstallationName as Name,'Installation' as WBSType,null as OldCnProfessionId,null as OldUnitProjectCode,null as OldWbsSetCode, | ||||
| ProjectId from dbo.Project_Installation where SuperInstallationId is null | ||||
| Union | ||||
| select InstallationId as Id,SuperInstallationId as SupId ,InstallationCode as Code, '['+InstallationCode+']'+InstallationName as Name,'Installation' as WBSType,null as OldCnProfessionId,null as OldUnitProjectCode,null as OldWbsSetCode, | ||||
| ProjectId from dbo.Project_Installation where SuperInstallationId is not null | ||||
| Union | ||||
| select CnProfessionId as Id , InstallationId as SupId,CnProfessionCode as Code, CnProfessionName as Name,'CnProfession' as WBSType,OldId as OldCnProfessionId,null as OldUnitProjectCode,null as OldWbsSetCode, | ||||
| ProjectId from dbo.WBS_CnProfession where IsApprove=1 | ||||
| Union all | ||||
| select UnitProjectId as Id, isnull(CnProfessionId,InstallationId) as SupId,UnitProjectCode as Code,UnitProjectName as Name,'UnitProject' as WBSType, | ||||
| (case when u.CnProfessionId is null then (select CnProfessionId from WBS_CnProfessionInit where CnProfessionName like (select '%'+substring(InstallationName,0,2)+'%' from Project_Installation where InstallationId=u.InstallationId)) else (select OldId from WBS_CnProfession c where c.CnProfessionId=u.CnProfessionId) end) as OldCnProfessionId,UnitProjectCode as OldUnitProjectCode,null as OldWbsSetCode,  | ||||
| ProjectId from dbo.Wbs_UnitProject u where IsApprove=1 | ||||
| Union all | ||||
| select WbsSetId as id,UnitProjectId as SupId,WbsSetCode as Code, WbsSetName as Name,'WbsSet' as WBSType, | ||||
| (case when w.CnProfessionId is null then (select CnProfessionId from WBS_CnProfessionInit where CnProfessionName like (select '%'+substring(InstallationName,0,2)+'%' from Project_Installation where InstallationId=w.InstallationId)) else (select OldId from WBS_CnProfession c where c.CnProfessionId=w.CnProfessionId) end) as OldCnProfessionId,(select UnitProjectCode from Wbs_UnitProject c where c.UnitProjectId=w.UnitProjectId) as OldUnitProjectCode, | ||||
| WbsSetCode as OldWbsSetCode, | ||||
| ProjectId from dbo.Wbs_WbsSet w where IsApprove=1 and SuperWbsSetId is null | ||||
| Union all | ||||
| select WbsSetId as id,SuperWbsSetId as SupId,WbsSetCode as Code, WbsSetName as Name,'WbsSet' as WBSType, | ||||
| (case when w.CnProfessionId is null then (select CnProfessionId from WBS_CnProfessionInit where CnProfessionName like (select '%'+substring(InstallationName,0,2)+'%' from Project_Installation where InstallationId=w.InstallationId)) else (select OldId from WBS_CnProfession c where c.CnProfessionId=w.CnProfessionId) end) as OldCnProfessionId,(select UnitProjectCode from Wbs_UnitProject c where c.UnitProjectId=w.UnitProjectId) as OldUnitProjectCode, | ||||
| (select WbsSetCode from Wbs_WbsSet ws where ws.WbsSetId=w.SuperWbsSetId) as OldWbsSetCode, | ||||
| ProjectId from dbo.Wbs_WbsSet w where IsApprove=1 and SuperWbsSetId is not null | ||||
| Union all | ||||
| select c.CostControlId as id,c.WbsSetId as SupId,CostControlCode as Code,c.CostControlName as Name,'CostControl' as WBSType, | ||||
| (case when ws.CnProfessionId is null then (select CnProfessionId from WBS_CnProfessionInit where CnProfessionName like (select '%'+substring(InstallationName,0,2)+'%' from Project_Installation where InstallationId=ws.InstallationId)) else (select OldId from WBS_CnProfession cn where cn.CnProfessionId=(select top 1 CnProfessionId from Wbs_WbsSet w where w.WbsSetId=c.WbsSetId)) end) as OldCnProfessionId, | ||||
| (select UnitProjectCode from Wbs_UnitProject u where u.UnitProjectId=(select top 1  UnitProjectId from Wbs_WbsSet w where w.WbsSetId=c.WbsSetId)) as OldUnitProjectCode, | ||||
| (select WbsSetCode from Wbs_WbsSet u where u.WbsSetId=(select top 1 w.SuperWbsSetId from Wbs_WbsSet w where w.WbsSetId=c.WbsSetId)) as OldWbsSetCode, | ||||
| c.ProjectId from dbo.WBS_CostControl c  | ||||
| left join dbo.Wbs_WbsSet ws on ws.WbsSetId=c.WbsSetId | ||||
| where c.IsSelected=1 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| GO | ||||
| 
 | ||||
| 
 | ||||
|  | @ -344,24 +344,35 @@ namespace BLL | |||
|         /// <returns></returns> | ||||
|         public static List<string> GetWbsSetIdByInstallationIdAndCNCodeAndUnitProjectCodeAndWbsSetCode(string installationId, string cnCode, string unitProjectCode, string wbsSetCode) | ||||
|         { | ||||
|             List<string> ids = new List<string>(); | ||||
|             Model.SGGLDB db = Funs.DB; | ||||
|             string inId = string.Empty; | ||||
|             Model.Project_Installation ins = db.Project_Installation.FirstOrDefault(x => x.InstallationId == installationId); | ||||
|             if (ins.IsEnd == true) | ||||
|             var childInss = from x in db.Project_Installation where x.SuperInstallationId == installationId select x; | ||||
|             if (childInss.Count() == 0) | ||||
|             { | ||||
|                 inId = installationId; | ||||
|                 var cn = (from x in db.WBS_CnProfession where x.InstallationId == inId && x.OldId.ToString() == cnCode select x).FirstOrDefault(); | ||||
|                 if (cn != null) | ||||
|                 { | ||||
|                     var list = (from x in db.Wbs_WbsSet | ||||
|                                 join y in db.Wbs_UnitProject | ||||
|                                 on x.UnitProjectId equals y.UnitProjectId | ||||
|                                 where x.CnProfessionId == cn.CnProfessionId && y.UnitProjectCode == unitProjectCode && x.WbsSetCode == wbsSetCode | ||||
|                                 select x.WbsSetId).ToList(); | ||||
|                     ids.AddRange(list); | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 inId = Project_InstallationService.GetEndInstallationId(installationId); | ||||
|                 var childIns = from x in db.Project_Installation where x.SuperInstallationId == installationId select x; | ||||
|                 foreach (var childIn in childIns) | ||||
|                 { | ||||
|                     ids.AddRange(GetWbsSetIdByInstallationIdAndCNCodeAndUnitProjectCodeAndWbsSetCode(childIn.InstallationId, cnCode, unitProjectCode, wbsSetCode)); | ||||
|                 } | ||||
|             } | ||||
|             var cn = (from x in db.WBS_CnProfession where x.InstallationId == inId && x.OldId.ToString() == cnCode select x).FirstOrDefault(); | ||||
|             var list = (from x in db.Wbs_WbsSet | ||||
|                         join y in db.Wbs_UnitProject | ||||
|                         on x.UnitProjectId equals y.UnitProjectId | ||||
|                         where x.CnProfessionId == cn.CnProfessionId && y.UnitProjectCode == unitProjectCode && x.WbsSetCode == wbsSetCode | ||||
|                         select x.WbsSetId).ToList(); | ||||
|             return list; | ||||
|              | ||||
|             return ids; | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue