diff --git a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs index a27b9b3b..01ca1662 100644 --- a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs +++ b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs @@ -766,118 +766,121 @@ namespace BLL newList = (from x in newList where x.WBSType != "Installation" && x.WBSType != "CnProfession" && x.OldCnProfessionId.ToString() == cnProfessionId && x.OldUnitProjectCode == unitProjectCode select x).ToList(); var up = newList.FirstOrDefault(x => x.WBSType == "UnitProject" && x.OldUnitProjectCode == unitProjectCode); parentRow = table.NewRow(); - parentRow[0] = up.Id; - parentRow[1] = "0"; - parentRow[2] = up.Name; - parentRow[3] = projectId; - Model.View_WBS_CostControlParentDetail pparentDetail = parentDetails.FirstOrDefault(x => x.ParentId == up.Id && x.Months == months); - if (pparentDetail != null) + if (up != 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 == up.Id); - if (parentLastDetail != null && parentLastDetail.Months <= months) + parentRow[0] = up.Id; + parentRow[1] = "0"; + parentRow[2] = up.Name; + parentRow[3] = projectId; + Model.View_WBS_CostControlParentDetail pparentDetail = parentDetails.FirstOrDefault(x => x.ParentId == up.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; - 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 == up.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; + 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 diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReport/MonthReportEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ManageReport/MonthReportEdit.aspx.cs index 62ead052..acb65b97 100644 --- a/SGGL/FineUIPro.Web/CQMS/ManageReport/MonthReportEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ManageReport/MonthReportEdit.aspx.cs @@ -84,7 +84,7 @@ namespace FineUIPro.Web.CQMS.ManageReport this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.EndDate); } } - this.txtPeriod.ReadOnly = true; + //this.txtPeriod.ReadOnly = true; //this.txtStartDate.Enabled = false; //this.txtEndDate.Enabled = false; GetThisWeekOrMonthContentList(this.ReportId);//本月主要工作内容