diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs
index e3a2ef11..ad16f081 100644
--- a/SGGL/BLL/Common/Const.cs
+++ b/SGGL/BLL/Common/Const.cs
@@ -3141,6 +3141,10 @@ namespace BLL
/// 分支机构人员模版文件原始的虚拟路径
///
public const string BranchPersonTemplateUrl = "File\\Excel\\DataIn\\分支机构人员信息模版.xls";
+ ///
+ /// 施工进度报表模板文件原始虚拟路径
+ ///
+ public const string JDreportReportTemplateUrl = "File\\Excel\\DataIn\\施工进度报表.xlsx";
#endregion
#region 绩效考核模板文件路径
diff --git a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs
index 1c46c45c..640adfea 100644
--- a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs
+++ b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs
@@ -13,7 +13,7 @@ namespace BLL
/// 获取模拟树表格
///
///
- 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 CostControlDetailStatisticsList = new List();
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 newList = new List();
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 ids = new List();
+ 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 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 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 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 newList, List 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 newList = new List();
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);//本月完成预算
diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/施工进度报表.xlsx b/SGGL/FineUIPro.Web/File/Excel/DataIn/施工进度报表.xlsx
new file mode 100644
index 00000000..7f6b26be
Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/施工进度报表.xlsx differ
diff --git a/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx b/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx
index 852ef3b9..d61b4784 100644
--- a/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx
+++ b/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx
@@ -28,7 +28,7 @@
-
diff --git a/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx.cs b/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx.cs
index ec6db98e..1bc3a02f 100644
--- a/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx.cs
+++ b/SGGL/FineUIPro.Web/JDGL/CostAnalysis/JDReport.aspx.cs
@@ -10,6 +10,10 @@ using Aspose.Words.Drawing;
using Aspose.Words.Drawing.Charts;
using Aspose.Words.Tables;
using BLL;
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.SS.Util;
+using NPOI.XSSF.UserModel;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.JDGL.CostAnalysis
@@ -792,7 +796,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
//项目总体施工进度情况
builder.MoveToBookmark("Form2");
builder.StartTable();
- builder.CellFormat.Borders.LineStyle = LineStyle.Single;
+ builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
@@ -951,7 +955,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
//本月施工进度情况
builder.MoveToBookmark("Form3");
builder.StartTable();
- builder.CellFormat.Borders.LineStyle = LineStyle.Single;
+ builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
@@ -1102,7 +1106,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
//专业和分部工程工程施工进度情况
builder.MoveToBookmark("Form4");
builder.StartTable();
- builder.CellFormat.Borders.LineStyle = LineStyle.Single;
+ builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
@@ -1466,7 +1470,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
builder.MoveToBookmark("Form42");
builder.StartTable();
- builder.CellFormat.Borders.LineStyle = LineStyle.Single;
+ builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
builder.Bold = false;
builder.RowFormat.Height = 20;
@@ -1857,5 +1861,1661 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
}
}
#endregion
+
+ #region 导出(excel按钮)
+ protected void btnOutExcel_Click(object sender, EventArgs e)
+ {
+ if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
+ {
+ Model.Project_Installation installation = BLL.Project_InstallationService.GetProjectInstallationByProjectId(this.CurrUser.LoginProjectId);
+ if (installation != null && !string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
+ {
+ string id = installation.InstallationId;
+ string date = this.txtMonths.Text.Trim() + "-01";
+ string strSql = "select distinct (cast(YEAR(Months) as varchar(4))+'.'+cast(MONTH(Months) as varchar(2))) as 月份,t.Months," +
+ "ThisRealCost as '本月已完工作实际费用-ACWP',ThisPlanCost as '本月已完工作预算费用-BCWP',ThisPlanValue as '本月计划工作预算费用-BCWS',TotalPlanValue as '累计计划工作预算费用-BCWS',TotalRealCost as '累计已完工作实际费用-ACWP',TotalPlanCost as '累计已完工作预算费用-BCWP' " +
+ "from dbo.View_WBS_CostControlParentDetail as t where ParentId=@Id and t.Months<=@Months order by t.Months";
+ //string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-01";
+ SqlParameter[] parameter = new SqlParameter[]
+ {
+ new SqlParameter("@Id",id),
+ new SqlParameter("@Months",date),
+ };
+ DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
+ if (dt.Rows.Count > 0)
+ {
+ try
+ {
+ decimal BCWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计已完工作预算费用-BCWP"].ToString());
+ decimal BCWS = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计计划工作预算费用-BCWS"].ToString());
+ decimal ACWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计已完工作实际费用-ACWP"].ToString());
+ decimal mBCWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["本月已完工作预算费用-BCWP"].ToString());
+ decimal mBCWS = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["本月计划工作预算费用-BCWS"].ToString());
+ decimal mACWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["本月已完工作实际费用-ACWP"].ToString());
+ decimal CV = BCWP / 10000 - ACWP / 10000;
+ decimal SV = BCWP / 10000 - BCWS / 10000;
+ decimal CPI = 0;
+ if (ACWP > 0)
+ {
+ CPI = BCWP / ACWP;
+ }
+ decimal SPI = 0;
+ if (BCWS > 0)
+ {
+ SPI = BCWP / BCWS;
+ }
+ decimal mCV = mBCWP / 10000 - mACWP / 10000;
+ decimal mSV = mBCWP / 10000 - mBCWS / 10000;
+ decimal mCPI = 0;
+ if (mACWP > 0)
+ {
+ mCPI = mBCWP / mACWP;
+ }
+ decimal mSPI = 0;
+ if (mBCWS > 0)
+ {
+ mSPI = mBCWP / mBCWS;
+ }
+ string rootPath = Server.MapPath("~/");
+ string initTemplatePath = string.Empty;
+ string uploadfilepath = string.Empty;
+ string newUrl = string.Empty;
+ string filePath = string.Empty;
+ initTemplatePath = Const.JDreportReportTemplateUrl;
+ uploadfilepath = rootPath + initTemplatePath;
+
+ newUrl = uploadfilepath.Replace(".xlsx", "(" + this.txtMonths.Text.Trim() + ")" + ".xlsx");
+ File.Copy(uploadfilepath, newUrl);
+ // 第一步:读取文件流
+ NPOI.SS.UserModel.IWorkbook workbook;
+ using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
+ {
+ workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
+ }
+
+ // 创建单元格样式
+ NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
+ cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
+ cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
+ var font = workbook.CreateFont();
+ font.FontHeightInPoints = 12;
+ font.IsBold = true;
+ //font.FontHeightInPoints = (short)8.5;字号为小数时要转为short
+ cellStyle0.SetFont(font);
+
+ // 第二步:创建新数据行
+ NPOI.SS.UserModel.ISheet sheet = workbook.GetSheet("Sheet1");
+ NPOI.SS.UserModel.IRow row1 = sheet.CreateRow(1);
+ NPOI.SS.UserModel.ICell cell2;
+ // 添加测试数据
+ cell2 = row1.CreateCell(14);
+ cell2.CellStyle = cellStyle0;
+ cell2.SetCellValue("123");
+ var font2 = workbook.CreateFont();
+ font2.FontHeightInPoints = 10;
+
+
+
+ // 创建单元格样式
+ NPOI.SS.UserModel.ICellStyle cellStyle1 = workbook.CreateCellStyle();
+ cellStyle1.BorderTop = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle1.BorderRight = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle1.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
+ cellStyle1.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
+ var font3 = workbook.CreateFont();
+ font3.FontHeightInPoints = 14;
+ cellStyle1.SetFont(font3);
+
+ NPOI.SS.UserModel.ICellStyle cellStyle2 = workbook.CreateCellStyle();
+ cellStyle2.BorderTop = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle2.BorderRight = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle2.BorderBottom = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle2.BorderLeft = NPOI.SS.UserModel.BorderStyle.None;
+ cellStyle2.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
+ cellStyle2.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
+ cellStyle2.SetFont(font3);
+
+ int rowCount = 1;
+
+ #region 一、项目赢得值曲线
+ NPOI.SS.UserModel.IRow row = sheet.CreateRow(rowCount);
+ NPOI.SS.UserModel.ICell cell;
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle2;
+ cell.SetCellValue("一、项目赢得值曲线");
+ CellRangeAddress region = new CellRangeAddress(rowCount, rowCount, 0, 16);
+ sheet.AddMergedRegion(region);
+ cell = row.CreateCell(38);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("月份");
+ cell = row.CreateCell(39);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("累计已完工作实际费用-ACWP");
+ cell = row.CreateCell(40);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("累计已完工作预算费用-BCWP");
+ cell = row.CreateCell(41);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("累计计划工作预算费用-BCWS");
+
+ rowCount += 1;
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ //获取当前行row = sheet.Row(nowRowNum);
+ row = sheet.CreateRow(rowCount);
+ //给行的单元格填充数据
+ row.CreateCell(38).SetCellValue(dt.Rows[i]["月份"].ToString());
+ row.CreateCell(39).SetCellValue(Convert.ToDouble(dt.Rows[i]["累计已完工作实际费用-ACWP"].ToString()) / 10000);
+ row.CreateCell(40).SetCellValue(Convert.ToDouble(dt.Rows[i]["累计已完工作预算费用-BCWP"].ToString()) / 10000);
+ row.CreateCell(41).SetCellValue(Convert.ToDouble(dt.Rows[i]["累计计划工作预算费用-BCWS"].ToString()) / 10000);
+ rowCount++;
+ }
+
+ rowCount = 29;
+
+
+ #endregion
+
+ #region 二、项目总体施工进度情况
+ //项目总体施工进度情况
+ row = sheet.CreateRow(rowCount);
+
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("二、项目总体施工进度情况");
+
+ region = new CellRangeAddress(rowCount, rowCount, 0, 6);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+
+ // 创建单元格样式
+ NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
+ cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
+ cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
+ cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
+ cellStyle.SetFont(font2);
+ //赢得值参数(单位:万元)
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("赢得值参数(单位:万元)");
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ region = new CellRangeAddress(rowCount, rowCount, 0, 2);
+ sheet.AddMergedRegion(region);
+
+
+ //赢得值评价指标
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("赢得值评价指标");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ region = new CellRangeAddress(rowCount, rowCount, 3, 6);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+
+ //BCWP
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWP");
+ //BCWS
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWS");
+ //ACWP
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("ACWP");
+ //CV
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CV");
+ //SV
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SV");
+ //CPI
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CPI");
+ //SPI
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SPI");
+
+ //数值
+ //BCWP
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((BCWP / 10000).ToString("0.####"));
+ //BCWS
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((BCWS / 10000).ToString("0.####"));
+ //ACWP
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((ACWP / 10000).ToString("0.####"));
+ //CV
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(CV.ToString("0.####"));
+ //SV
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(SV.ToString("0.####"));
+ //CPI
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(CPI.ToString("0.####"));
+ //SPI
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(SPI.ToString("0.####"));
+ rowCount += 2;
+ #endregion
+ #region 三、本月施工进度情况
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("三、本月施工进度情况");
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("");
+ region = new CellRangeAddress(rowCount, rowCount, 0, 6);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+
+ //赢得值参数(单位:万元)
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("赢得值参数(单位:万元)");
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ region = new CellRangeAddress(rowCount, rowCount, 0, 2);
+ sheet.AddMergedRegion(region);
+
+ //赢得值评价指标
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("赢得值评价指标");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ region = new CellRangeAddress(rowCount, rowCount, 3, 6);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+
+ //BCWP
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWP");
+ //BCWS
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWS");
+ //ACWP
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("ACWP");
+ //CV
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CV");
+ //SV
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SV");
+ //CPI
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CPI");
+ //SPI
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SPI");
+
+ //数值
+ //BCWP
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((mBCWP / 10000).ToString("0.####"));
+ //BCWS
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((mBCWS / 10000).ToString("0.####"));
+ //ACWP
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue((mACWP / 10000).ToString("0.####"));
+ //CV
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(mCV.ToString("0.####"));
+ //SV
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(mSV.ToString("0.####"));
+ //CPI
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(mCPI.ToString("0.####"));
+ //SPI
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(mSPI.ToString("0.####"));
+ rowCount += 2;
+
+ #endregion
+ #region 四、专业和分部工程工程施工进度情况
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("四、专业和分部工程工程施工进度情况");
+
+ region = new CellRangeAddress(rowCount, rowCount, 0, 17);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("序号");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount + 1, 0, 0));
+
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("装置");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount + 1, 1, 1));
+
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("专业");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount + 1, 2, 2));
+
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("分部工程");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount + 1, 3, 3));
+
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("本月赢得值参数(单位:万元)");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 4, 6));
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("本月赢得值评价指标");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 7, 10));
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ cell = row.CreateCell(11);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("累计赢得值参数(单位:万元)");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 11, 13));
+ cell = row.CreateCell(12);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(13);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ cell = row.CreateCell(14);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("累计赢得值评价指标");
+ // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+ sheet.AddMergedRegion(new CellRangeAddress(rowCount, rowCount, 14, 17));
+ cell = row.CreateCell(15);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(16);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(17);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWP");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWS");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("ACWP");
+
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CV");
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SV");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CPI");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SPI");
+
+ cell = row.CreateCell(11);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWP");
+ cell = row.CreateCell(12);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("BCWS");
+ cell = row.CreateCell(13);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("ACWP");
+
+ cell = row.CreateCell(14);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CV");
+ cell = row.CreateCell(15);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SV");
+ cell = row.CreateCell(16);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("CPI");
+ cell = row.CreateCell(17);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("SPI");
+
+ //导出数据
+
+ Model.SGGLDB db = Funs.DB;
+ var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x;
+ var installationIds = cnProfessions.Select(x => x.InstallationId).Distinct().ToList();
+ var installations = from x in db.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId && installationIds.Contains(x.InstallationId) select x;
+ var unitProjects = from x in db.Wbs_UnitProject where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x;
+ var details = from x in db.View_WBS_CostControlParentDetail
+ where x.Months == Funs.GetNewDateTime(date)
+ select x;
+ decimal cnACWP, cnBCWP, cnBCWS, cnmACWP, cnmBCWP, cnmBCWS, cnCV, cnSV, cnCPI, cnSPI, cnmCV, cnmSV, cnmCPI, cnmSPI,
+ unACWP, unBCWP, unBCWS, unmACWP, unmBCWP, unmBCWS, unCV, unSV, unCPI, unSPI, unmCV, unmSV, unmCPI, unmSPI,
+ inACWP, inBCWP, inBCWS, inmACWP, inmBCWP, inmBCWS, inCV, inSV, inCPI, inSPI, inmCV, inmSV, inmCPI, inmSPI;
+ int a = 1, b = 1, c = 1;
+ foreach (var item in installations)
+ {
+ rowCount += 1;
+ inACWP = 0;
+ inBCWP = 0;
+ inBCWS = 0;
+ inmACWP = 0;
+ inmBCWP = 0;
+ inmBCWS = 0;
+ inCV = 0;
+ inSV = 0;
+ inCPI = 0;
+ inSPI = 0;
+ inmCV = 0;
+ inmSV = 0;
+ inmCPI = 0;
+ inmSPI = 0;
+
+ //序号
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(c.ToString());
+ //装置
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(item.InstallationName);
+ //专业
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+ //分部工程
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+ var inDetails = (from x in details
+ where x.ParentId == item.InstallationId
+ select x).ToList();
+ inmACWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
+ inmBCWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
+ inmBCWS = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
+ inmCV = inmBCWP - inmACWP;
+ inmSV = inmBCWP - inmBCWS;
+ if (inmACWP > 0)
+ {
+ inmCPI = inmBCWP / inmACWP;
+ }
+ if (inmBCWS > 0)
+ {
+ inmSPI = inmBCWP / inmBCWS;
+ }
+ //BCWP
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmBCWP.ToString("0.####"));
+ //BCWS
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmBCWS.ToString("0.####"));
+ //ACWP
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmACWP.ToString("0.####"));
+ //CV
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmCV.ToString("0.####"));
+ //SV
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmSV.ToString("0.####"));
+ //CPI
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmCPI.ToString("0.####"));
+ //SPI
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inmSPI.ToString("0.####"));
+
+
+ inACWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
+ inBCWP = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
+ inBCWS = Funs.GetNewDecimalOrZero(inDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
+ inCV = inBCWP - inACWP;
+ inSV = inBCWP - inBCWS;
+ if (inACWP > 0)
+ {
+ inCPI = inBCWP / inACWP;
+ }
+ if (inBCWS > 0)
+ {
+ inSPI = inBCWP / inBCWS;
+ }
+ //BCWP
+ cell = row.CreateCell(11);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inBCWP.ToString("0.####"));
+
+ //BCWS
+ cell = row.CreateCell(12);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inBCWS.ToString("0.####"));
+
+ //ACWP
+ cell = row.CreateCell(13);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inACWP.ToString("0.####"));
+
+ //CV
+ cell = row.CreateCell(14);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inCV.ToString("0.####"));
+
+ //SV
+ cell = row.CreateCell(15);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inSV.ToString("0.####"));
+
+ //CPI
+ cell = row.CreateCell(16);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inCPI.ToString("0.####"));
+
+ //SPI
+ cell = row.CreateCell(17);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(inSPI.ToString("0.####"));
+
+ a = 1;
+ var icnProfessions = cnProfessions.Where(x => x.InstallationId == item.InstallationId);
+ foreach (var cn in icnProfessions)
+ {
+ rowCount += 1;
+ cnACWP = 0;
+ cnBCWP = 0;
+ cnBCWS = 0;
+ cnmACWP = 0;
+ cnmBCWP = 0;
+ cnmBCWS = 0;
+ cnCV = 0;
+ cnSV = 0;
+ cnCPI = 0;
+ cnSPI = 0;
+ cnmCV = 0;
+ cnmSV = 0;
+ cnmCPI = 0;
+ cnmSPI = 0;
+ //序号
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(c.ToString() + "." + a.ToString());
+ //装置
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+ //专业
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cn.CnProfessionName);
+ //分部工程
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+
+ var cnDetails = (from x in details
+ where x.ParentId == cn.CnProfessionId
+ select x).ToList();
+ cnmACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
+ cnmBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
+ cnmBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
+ cnmCV = cnmBCWP - cnmACWP;
+ cnmSV = cnmBCWP - cnmBCWS;
+ if (cnmACWP > 0)
+ {
+ cnmCPI = cnmBCWP / cnmACWP;
+ }
+ if (cnmBCWS > 0)
+ {
+ cnmSPI = cnmBCWP / cnmBCWS;
+ }
+ //BCWP
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmBCWP.ToString("0.####"));
+ //BCWS
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmBCWS.ToString("0.####"));
+ //ACWP
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmACWP.ToString("0.####"));
+ //CV
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmCV.ToString("0.####"));
+ //SV
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmSV.ToString("0.####"));
+ //CPI
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmCPI.ToString("0.####"));
+ //SPI
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnmSPI.ToString("0.####"));
+
+ cnACWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
+ cnBCWP = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
+ cnBCWS = Funs.GetNewDecimalOrZero(cnDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
+ cnCV = cnBCWP - cnACWP;
+ cnSV = cnBCWP - cnBCWS;
+ if (cnACWP > 0)
+ {
+ cnCPI = cnBCWP / cnACWP;
+ }
+ if (cnBCWS > 0)
+ {
+ cnSPI = cnBCWP / cnBCWS;
+ }
+ //BCWP
+ cell = row.CreateCell(11);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnBCWP.ToString("0.####"));
+
+ //BCWS
+ cell = row.CreateCell(12);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnBCWS.ToString("0.####"));
+
+ //ACWP
+ cell = row.CreateCell(13);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnACWP.ToString("0.####"));
+
+ //CV
+ cell = row.CreateCell(14);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnCV.ToString("0.####"));
+
+ //SV
+ cell = row.CreateCell(15);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnSV.ToString("0.####"));
+
+ //CPI
+ cell = row.CreateCell(16);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnCPI.ToString("0.####"));
+
+ //SPI
+ cell = row.CreateCell(17);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnSPI.ToString("0.####"));
+ b = 1;
+ var unLists = from x in unitProjects where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x;
+ foreach (var un in unLists)
+ {
+ rowCount += 1;
+ unACWP = 0;
+ unBCWP = 0;
+ unBCWS = 0;
+ unmACWP = 0;
+ unmBCWP = 0;
+ unmBCWS = 0;
+ unCV = 0;
+ unSV = 0;
+ unCPI = 0;
+ unSPI = 0;
+ unmCV = 0;
+ unmSV = 0;
+ unmCPI = 0;
+ unmSPI = 0;
+ //序号
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(c.ToString() + "." + a.ToString() + "." + b.ToString());
+ //装置
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+ //专业
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(string.Empty);
+ //分部工程
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(un.UnitProjectName);
+ var unDetails = from x in details
+ where x.ParentId == un.UnitProjectId
+ select x;
+ unmACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisRealCost).Sum().ToString()) / 10000;
+ unmBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanCost).Sum().ToString()) / 10000;
+ unmBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.ThisPlanValue).Sum().ToString()) / 10000;
+ unmCV = unmBCWP - unmACWP;
+ unmSV = unmBCWP - unmBCWS;
+ if (unmACWP > 0)
+ {
+ unmCPI = unmBCWP / unmACWP;
+ }
+ if (unmBCWS > 0)
+ {
+ unmSPI = unmBCWP / unmBCWS;
+ }
+
+ //BCWP
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmBCWP.ToString("0.####"));
+ //BCWS
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmBCWS.ToString("0.####"));
+ //ACWP
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmACWP.ToString("0.####"));
+ //CV
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmCV.ToString("0.####"));
+ //SV
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmSV.ToString("0.####"));
+ //CPI
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmCPI.ToString("0.####"));
+ //SPI
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unmSPI.ToString("0.####"));
+ unACWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalRealCost).Sum().ToString()) / 10000;
+ unBCWP = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanCost).Sum().ToString()) / 10000;
+ unBCWS = Funs.GetNewDecimalOrZero(unDetails.Select(x => x.TotalPlanValue).Sum().ToString()) / 10000;
+ unCV = unBCWP - unACWP;
+ unSV = unBCWP - unBCWS;
+ if (unACWP > 0)
+ {
+ unCPI = unBCWP / unACWP;
+ }
+ if (unBCWS > 0)
+ {
+ unSPI = unBCWP / unBCWS;
+ }
+ //BCWP
+ cell = row.CreateCell(11);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cnBCWP.ToString("0.####"));
+
+ //BCWS
+ cell = row.CreateCell(12);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unBCWP.ToString("0.####"));
+
+ //ACWP
+ cell = row.CreateCell(13);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unACWP.ToString("0.####"));
+
+ //CV
+ cell = row.CreateCell(14);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unCV.ToString("0.####"));
+
+ //SV
+ cell = row.CreateCell(15);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unSV.ToString("0.####"));
+
+ //CPI
+ cell = row.CreateCell(16);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unCPI.ToString("0.####"));
+
+ //SPI
+ cell = row.CreateCell(17);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(unSPI.ToString("0.####"));
+ b++;
+ }
+ a++;
+ }
+ c++;
+ }
+ #endregion
+ rowCount += 2;
+ #region 五、设备/材料施工进度情况
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle1;
+ cell.SetCellValue("五、设备/材料施工进度情况");
+
+ region = new CellRangeAddress(rowCount, rowCount, 0, 10);
+ sheet.AddMergedRegion(region);
+ rowCount += 1;
+ //表头
+ row = sheet.CreateRow(rowCount);
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("序号");
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("专业");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("设备材料大类");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("设备材料分类");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("单位");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("合同工作量");
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("本月完成量");
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("累计完成量");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("本月完成率");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("累计完成率");
+
+ //数据
+ #region 加载数据
+ var cnProfessionInits = from x in db.WBS_CnProfessionInit orderby x.SortIndex select x;
+ var costControls = from x in db.WBS_CostControl
+ join z in db.WBS_EquipmentMaterialType on x.EquipmentMaterialTypeId equals z.EquipmentMaterialTypeId
+ join t in db.Wbs_WbsSet on x.WbsSetId equals t.WbsSetId
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ select new
+ {
+ x.Unit,
+ x.TotalNum,
+ z.EquipmentMaterialBigTypeId,
+ z.EquipmentMaterialTypeId,
+ t.InstallationId,
+ };
+ var costControlDetails = from x in db.WBS_CostControlDetail
+ join y in db.WBS_CostControl on x.CostControlId equals y.CostControlId
+ join z in db.WBS_EquipmentMaterialType on y.EquipmentMaterialTypeId equals z.EquipmentMaterialTypeId
+ join t in db.Wbs_WbsSet on y.WbsSetId equals t.WbsSetId
+ where x.Months <= Funs.GetNewDateTime(date) && y.ProjectId == this.CurrUser.LoginProjectId
+ orderby x.Months descending
+ select new
+ {
+ x.CostControlDetailId,
+ t.InstallationId,
+ y.EquipmentMaterialTypeId,
+ z.EquipmentMaterialBigTypeId,
+ z.EquipmentMaterialTypeName,
+ x.Months,
+ x.ThisNum,
+ };
+ var equipmentMaterialBigTypes = from x in db.WBS_EquipmentMaterialBigType orderby x.EquipmentMaterialBigTypeCode select x;
+ var equipmentMaterialTypes = from x in db.WBS_EquipmentMaterialType orderby x.EquipmentMaterialTypeCode select x;
+ int v = 1, w = 2, d = 1, f = 1;
+ foreach (var cn in cnProfessionInits)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ #region 加载数据
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString());
+ //专业
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cn.CnProfessionName);
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ #endregion
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ #region 加载数据
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + ".1");
+ //专业
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("本专业汇总统计");
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ #endregion
+ d = 1;
+ var bigTypes = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
+ foreach (var bigType in bigTypes)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ #region 加载数据
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + ".1." + d.ToString());
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料大类
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(bigType.EquipmentMaterialBigTypeName);
+ //设备材料分类
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
+ if (list.Count() > 0)
+ {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(list.First().Unit);
+ //合同工作量row5[4]
+ var cellValue1 = list.ToList().Sum(x => x.TotalNum ?? 0).ToString();
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue1);
+ //本月完成量row5[5]
+ var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.Months == Funs.GetNewDateTime(date));
+ var cellValue2 = list2.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue2);
+ //累计完成量row5[6]
+ var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
+ var cellValue3 = list3.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue3);
+ //本月完成率
+ var cellValue4 = "";
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+
+ if (cellValue1 != "0" && cellValue2 != "0")
+ {
+ cellValue4 = (Funs.GetNewDecimalOrZero(cellValue2) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue4 = "/";
+ }
+ cell.SetCellValue(cellValue4);
+ //累计完成率
+ var cellValue5 = "";
+ if (cellValue1 != "0" && cellValue3 != "0")
+ {
+ cellValue5 = (Funs.GetNewDecimalOrZero(cellValue3) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue5 = "/";
+ }
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue5);
+ }
+ else
+ {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //合同工作量row5[4]
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成量row5[5]
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成量row5[6]
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成率
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成率
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ }
+ f = 1;
+ var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
+ foreach (var equipmentMaterialType in types)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + ".1." + d.ToString() + "." + f.ToString());
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料大类
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料分类
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(equipmentMaterialType.EquipmentMaterialTypeName);
+ var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
+ if (lists.Count() > 0)
+ {
+ var cellValue1 = "";
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(lists.First().Unit);
+ //合同工作量row5[4]
+ cellValue1 = lists.ToList().Sum(x => x.TotalNum ?? 0).ToString();
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue1);
+ //本月完成量row5[5]
+ var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.Months == Funs.GetNewDateTime(date));
+ var cellValue2 = list2s.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue2);
+ //累计完成量row5[6]
+ var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
+ var cellValue3 = list3s.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue3);
+ //本月完成率
+ var cellValue4 = "";
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+
+ if (cellValue1 != "0" && cellValue2 != "0")
+ {
+ cellValue4 = (Funs.GetNewDecimalOrZero(cellValue2) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue4 = "/";
+ }
+ cell.SetCellValue(cellValue4);
+ //累计完成率
+ var cellValue5 = "";
+ if (cellValue1 != "0" && cellValue3 != "0")
+ {
+ cellValue5 = (Funs.GetNewDecimalOrZero(cellValue3) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue5 = "/";
+ }
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue5);
+ }
+ else
+ {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //合同工作量row5[4]
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成量row5[5]
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成量row5[6]
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成率
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成率
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ }
+ f++;
+ }
+ d++;
+ #endregion
+ }
+ w = 2;
+ foreach (var ins in installations)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ //加载本专业汇总统计以下的
+ #region 加载数据
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + "." + w.ToString());
+ //专业
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(ins.InstallationName);
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ #endregion
+ d = 1;
+ var bigTypes2 = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
+ foreach (var bigType in bigTypes2)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ //设备材料大类
+ #region 加载数据
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + "." + w.ToString() + d.ToString());
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料大类
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(bigType.EquipmentMaterialBigTypeName);
+ //设备材料分类
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+
+ var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
+ if (list.Count() > 0)
+ {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(list.First().Unit);
+ //合同工作量row5[4]
+ var cellValue1 = list.ToList().Sum(x => x.TotalNum ?? 0).ToString();
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue1);
+ //本月完成量row5[5]
+ var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
+ var cellValue2 = list2.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue2);
+ //累计完成量row5[6]
+ var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
+ var cellValue3 = list3.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue3);
+ //本月完成率
+ var cellValue4 = "";
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+
+ if (cellValue1 != "0" && cellValue2 != "0")
+ {
+ cellValue4 = (Funs.GetNewDecimalOrZero(cellValue2) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue4 = "/";
+ }
+ cell.SetCellValue(cellValue4);
+ //累计完成率
+ var cellValue5 = "";
+ if (cellValue1 != "0" && cellValue3 != "0")
+ {
+ cellValue5 = (Funs.GetNewDecimalOrZero(cellValue3) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue5 = "/";
+ }
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue5);
+ }
+ else {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //合同工作量row5[4]
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成量row5[5]
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成量row5[6]
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成率
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成率
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ }
+ f = 1;
+ var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
+ foreach (var equipmentMaterialType in types)
+ {
+ rowCount += 1;
+ row = sheet.CreateRow(rowCount);
+ //序号
+ cell = row.CreateCell(0);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(v.ToString() + "." + w.ToString() + d.ToString() + "." + f.ToString());
+ cell = row.CreateCell(1);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ cell = row.CreateCell(2);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料大类
+ cell = row.CreateCell(3);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //设备材料分类
+ cell = row.CreateCell(4);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(equipmentMaterialType.EquipmentMaterialTypeName);
+ var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
+ if (lists.Count() > 0)
+ {
+ var cellValue1 = "";
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(lists.First().Unit);
+ //合同工作量row5[4]
+ cellValue1 = lists.ToList().Sum(x => x.TotalNum ?? 0).ToString();
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue1);
+ //本月完成量row5[5]
+ var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
+ var cellValue2 = list2s.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue2);
+ //累计完成量row5[6]
+ var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
+ var cellValue3 = list3s.ToList().Sum(x => x.ThisNum ?? 0).ToString();
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue3);
+ //本月完成率
+ var cellValue4 = "";
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+
+ if (cellValue1 != "0" && cellValue2 != "0")
+ {
+ cellValue4 = (Funs.GetNewDecimalOrZero(cellValue2) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue4 = "/";
+ }
+ cell.SetCellValue(cellValue4);
+ //累计完成率
+ var cellValue5 = "";
+ if (cellValue1 != "0" && cellValue3 != "0")
+ {
+ cellValue5 = (Funs.GetNewDecimalOrZero(cellValue3) / Funs.GetNewDecimalOrZero(cellValue1) * 100).ToString("0.##") + "%";
+ }
+ else
+ {
+ cellValue5 = "/";
+ }
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue(cellValue5);
+ }
+ else
+ {
+ //单位
+ cell = row.CreateCell(5);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //合同工作量row5[4]
+ cell = row.CreateCell(6);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成量row5[5]
+ cell = row.CreateCell(7);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成量row5[6]
+ cell = row.CreateCell(8);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //本月完成率
+ cell = row.CreateCell(9);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ //累计完成率
+ cell = row.CreateCell(10);
+ cell.CellStyle = cellStyle;
+ cell.SetCellValue("");
+ }
+ f++;
+ }
+ d++;
+
+ }
+ w++;
+ #endregion
+ }
+ v++;
+ }
+ #endregion
+ #endregion
+ // 第三步:写入文件流
+ using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
+ {
+ workbook.Write(stream);
+ workbook.Close();
+ }
+ string fileName = Path.GetFileName(newUrl);
+ FileInfo info = new FileInfo(newUrl);
+ long fileSize = info.Length;
+ Response.Clear();
+ Response.ContentType = "application/x-zip-compressed";
+ Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
+ Response.AddHeader("Content-Length", fileSize.ToString());
+ Response.TransmitFile(newUrl, 0, fileSize);
+ Response.Flush();
+ Response.Close();
+ File.Delete(newUrl);
+ }
+ catch (Exception ex)
+ {
+
+ throw ex;
+ }
+
+ }
+ else
+ {
+ ShowNotify("没有数据,无法导出!", MessageBoxIcon.Warning);
+ }
+ }
+ }
+ else
+ {
+ ShowNotify("请选择月份!", MessageBoxIcon.Warning);
+ }
+ }
+ #endregion
+
+ //public void AutoColumnWidth(HSSFSheet sheet, int cols)
+ //{
+ // for (int col = 0; col <= cols; col++)
+ // {
+ // sheet.AutoSizeColumn(col);//自适应宽度,但是其实还是比实际文本要宽
+ // int columnWidth = sheet.GetColumnWidth(col) / 256;//获取当前列宽度
+ // for (int rowIndex = 0; rowIndex <= sheet.LastRowNum; rowIndex++)
+ // {
+ // HSSFRow row = sheet.GetRow(rowIndex);
+ // if (row!=null)
+ // {
+ // HSSFCell cell = row.GetCell(col);
+ // if (cell!=null)
+ // {
+ // int contextLength = Encoding.UTF8.GetBytes(cell.ToString()).Length;//获取当前单元格的内容宽度
+ // columnWidth = columnWidth < contextLength ? contextLength : columnWidth;
+ // sheet.SetColumnWidth(col, columnWidth * 200);//
+ // }
+ // }
+
+ // }
+ // }
+ //}
+
}
}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx
index db991219..6881e642 100644
--- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx
+++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx
@@ -36,11 +36,7 @@
-
-
-
-
+
@@ -50,6 +46,17 @@
+
+
+
+
+
+
+
+
+
+
@@ -59,7 +66,7 @@
+ HeaderText="" />
diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.cs b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.cs
index ddef2c40..5cad5094 100644
--- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.cs
+++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.cs
@@ -84,7 +84,7 @@ namespace FineUIPro.Web.JDGL.WBS
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
//if (this.rblStatisticsType.SelectedValue == "1")
//{
- DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, BLL.Const._Null, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
+ DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, BLL.Const._Null, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue, this.txtEquipmentMaterialType.Text.Trim());
Grid1.DataSource = table;
Grid1.DataBind();
//}
@@ -142,7 +142,7 @@ namespace FineUIPro.Web.JDGL.WBS
ppsId = 3,
ppsName = "施工",
performanceDate = this.txtMonths.Text.Trim() + "-25",
- pv = Math.Round((thisDetail.ThisPlanValue??0) / baseMoney,4),
+ pv = Math.Round((thisDetail.ThisPlanValue ?? 0) / baseMoney, 4),
ev = Math.Round((thisDetail.ThisPlanCost ?? 0) / baseMoney, 4),
ac = Math.Round((thisDetail.ThisRealCost ?? 0) / baseMoney, 4),
totalPv = Math.Round((thisDetail.TotalPlanValue ?? 0) / baseMoney, 4),
@@ -298,7 +298,7 @@ namespace FineUIPro.Web.JDGL.WBS
Response.Write(GetGridTableHtml2(Grid1));
Response.End();
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
- DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, BLL.Const._Null, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
+ DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, BLL.Const._Null, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue, this.txtEquipmentMaterialType.Text.Trim());
Grid1.DataSource = table;
Grid1.DataBind();
}
diff --git a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.designer.cs b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.designer.cs
index dbf63af5..35afea09 100644
--- a/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.designer.cs
@@ -75,24 +75,6 @@ namespace FineUIPro.Web.JDGL.WBS {
///
protected global::FineUIPro.DropDownList drpUnitProject;
- ///
- /// drpWbsSet 控件。
- ///
- ///
- /// 自动生成的字段。
- /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
- ///
- protected global::FineUIPro.DropDownList drpWbsSet;
-
- ///
- /// btnSearch 控件。
- ///
- ///
- /// 自动生成的字段。
- /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
- ///
- protected global::FineUIPro.Button btnSearch;
-
///
/// btnSend 控件。
///
@@ -120,6 +102,42 @@ namespace FineUIPro.Web.JDGL.WBS {
///
protected global::FineUIPro.Button btnCheck;
+ ///
+ /// Toolbar1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar1;
+
+ ///
+ /// drpWbsSet 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DropDownList drpWbsSet;
+
+ ///
+ /// txtEquipmentMaterialType 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtEquipmentMaterialType;
+
+ ///
+ /// btnSearch 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnSearch;
+
///
/// btnOut 控件。
///