3522 lines
		
	
	
		
			225 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			3522 lines
		
	
	
		
			225 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Data;
 | ||
| using System.Data.SqlClient;
 | ||
| using System.IO;
 | ||
| using System.Linq;
 | ||
| using System.Text;
 | ||
| using Aspose.Words;
 | ||
| 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
 | ||
| {
 | ||
|     public partial class JDReport : PageBase
 | ||
|     {
 | ||
|         #region 加载页面
 | ||
|         protected void Page_Load(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (!IsPostBack)
 | ||
|             {
 | ||
|                 this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
 | ||
|                 GetValue();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         private void SetEmpty()
 | ||
|         {
 | ||
|             this.SimpleForm1.Title = string.Empty;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 获取记录值
 | ||
|         private void GetValue()
 | ||
|         {
 | ||
|             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);
 | ||
|                 decimal lastbcws = 0, bcws = 0, lastacwp = 0, acwp = 0, lastbcwp = 0, bcwp = 0;
 | ||
|                 for (int i = 0; i < dt.Rows.Count; i++)
 | ||
|                 {
 | ||
|                     dt.Rows[i]["本月已完工作实际费用-ACWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作实际费用-ACWP"].ToString()) / 10000;
 | ||
|                     dt.Rows[i]["本月已完工作预算费用-BCWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作预算费用-BCWP"].ToString()) / 10000;
 | ||
|                     dt.Rows[i]["本月计划工作预算费用-BCWS"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月计划工作预算费用-BCWS"].ToString()) / 10000;
 | ||
|                     bcws = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计计划工作预算费用-BCWS"].ToString());
 | ||
|                     acwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作实际费用-ACWP"].ToString());
 | ||
|                     bcwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作预算费用-BCWP"].ToString());
 | ||
|                     if (bcws == lastbcws)
 | ||
|                     {
 | ||
|                         if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计计划工作预算费用-BCWS"] = DBNull.Value;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000;
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000;
 | ||
|                     }
 | ||
|                     if (acwp == lastacwp)
 | ||
|                     {
 | ||
|                         if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计已完工作实际费用-ACWP"] = DBNull.Value;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000;
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000;
 | ||
|                     }
 | ||
|                     if (bcwp == lastbcwp)
 | ||
|                     {
 | ||
|                         if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计已完工作预算费用-BCWP"] = DBNull.Value;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000;
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000;
 | ||
|                     }
 | ||
|                     lastbcws = bcws;
 | ||
|                     lastacwp = acwp;
 | ||
|                     lastbcwp = bcwp;
 | ||
|                 }
 | ||
|                 if (dt.Rows.Count > 0)
 | ||
|                 {
 | ||
|                     this.ChartEV.CreateMaryChart(dt, 1220, 420, null);
 | ||
|                     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 - ACWP;
 | ||
|                     decimal SV = BCWP - BCWS;
 | ||
|                     decimal CPI = 0;
 | ||
|                     if (ACWP > 0)
 | ||
|                     {
 | ||
|                         CPI = BCWP / ACWP;
 | ||
|                     }
 | ||
|                     decimal SPI = 0;
 | ||
|                     if (BCWS > 0)
 | ||
|                     {
 | ||
|                         SPI = BCWP / BCWS;
 | ||
|                     }
 | ||
|                     decimal mCV = mBCWP - mACWP;
 | ||
|                     decimal mSV = mBCWP - mBCWS;
 | ||
|                     decimal mCPI = 0;
 | ||
|                     if (mACWP > 0)
 | ||
|                     {
 | ||
|                         mCPI = mBCWP / mACWP;
 | ||
|                     }
 | ||
|                     decimal mSPI = 0;
 | ||
|                     if (mBCWS > 0)
 | ||
|                     {
 | ||
|                         mSPI = mBCWP / mBCWS;
 | ||
|                     }
 | ||
|                     //总体进度
 | ||
|                     DataTable table2 = new DataTable();
 | ||
|                     table2.Columns.Add(new DataColumn("Id", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("BCWP", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("BCWS", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("ACWP", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("CV", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("SV", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("CPI", typeof(String)));
 | ||
|                     table2.Columns.Add(new DataColumn("SPI", typeof(String)));
 | ||
|                     DataRow row2;
 | ||
|                     row2 = table2.NewRow();
 | ||
|                     row2[0] = SQLHelper.GetNewID();
 | ||
|                     row2[1] = BCWP.ToString("0.####");
 | ||
|                     row2[2] = BCWS.ToString("0.####");
 | ||
|                     row2[3] = ACWP.ToString("0.####");
 | ||
|                     row2[4] = CV.ToString("0.####");
 | ||
|                     row2[5] = SV.ToString("0.####");
 | ||
|                     row2[6] = CPI.ToString("0.####");
 | ||
|                     row2[7] = SPI.ToString("0.####");
 | ||
|                     table2.Rows.Add(row2);
 | ||
|                     this.Grid2.DataSource = table2;
 | ||
|                     this.Grid2.DataBind();
 | ||
|                     //本月进度
 | ||
|                     table2.Rows.Clear();
 | ||
|                     row2[0] = SQLHelper.GetNewID();
 | ||
|                     row2[1] = mBCWP.ToString("0.####");
 | ||
|                     row2[2] = mBCWS.ToString("0.####");
 | ||
|                     row2[3] = mACWP.ToString("0.####");
 | ||
|                     row2[4] = mCV.ToString("0.####");
 | ||
|                     row2[5] = mSV.ToString("0.####");
 | ||
|                     row2[6] = mCPI.ToString("0.####");
 | ||
|                     row2[7] = mSPI.ToString("0.####");
 | ||
|                     table2.Rows.Add(row2);
 | ||
|                     this.Grid3.DataSource = table2;
 | ||
|                     this.Grid3.DataBind();
 | ||
|                     //按专业统计
 | ||
|                     DataTable table4 = new DataTable();
 | ||
|                     table4.Columns.Add(new DataColumn("Id", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("SupId", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("Name", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mBCWP", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mBCWS", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mACWP", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mCV", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mSV", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mCPI", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("mSPI", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("BCWP", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("BCWS", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("ACWP", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("CV", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("SV", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("CPI", typeof(String)));
 | ||
|                     table4.Columns.Add(new DataColumn("SPI", typeof(String)));
 | ||
|                     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;
 | ||
|                     DataRow row4;
 | ||
|                     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)
 | ||
|                     {
 | ||
|                         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;
 | ||
|                         row4 = table4.NewRow();
 | ||
|                         row4[0] = c.ToString();
 | ||
|                         row4[1] = "0";
 | ||
|                         row4[2] = item.InstallationName;
 | ||
|                         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;
 | ||
|                         }
 | ||
|                         row4[3] = inmBCWP.ToString("0.####");
 | ||
|                         row4[4] = inmBCWS.ToString("0.####");
 | ||
|                         row4[5] = inmACWP.ToString("0.####");
 | ||
|                         row4[6] = inmCV.ToString("0.####");
 | ||
|                         row4[7] = inmSV.ToString("0.####");
 | ||
|                         row4[8] = inmCPI.ToString("0.####");
 | ||
|                         row4[9] = 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;
 | ||
|                         }
 | ||
|                         row4[10] = inBCWP.ToString("0.####");
 | ||
|                         row4[11] = inBCWS.ToString("0.####");
 | ||
|                         row4[12] = inACWP.ToString("0.####");
 | ||
|                         row4[13] = inCV.ToString("0.####");
 | ||
|                         row4[14] = inSV.ToString("0.####");
 | ||
|                         row4[15] = inCPI.ToString("0.####");
 | ||
|                         row4[16] = inSPI.ToString("0.####");
 | ||
|                         table4.Rows.Add(row4);
 | ||
|                         a = 1;
 | ||
|                         var icnProfessions = cnProfessions.Where(x => x.InstallationId == item.InstallationId);
 | ||
|                         foreach (var cn in icnProfessions)
 | ||
|                         {
 | ||
|                             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;
 | ||
|                             row4 = table4.NewRow();
 | ||
|                             row4[0] = c.ToString() + "." + a.ToString();
 | ||
|                             row4[1] = c;
 | ||
|                             row4[2] = cn.CnProfessionName;
 | ||
|                             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;
 | ||
|                             }
 | ||
|                             row4[3] = cnmBCWP.ToString("0.####");
 | ||
|                             row4[4] = cnmBCWS.ToString("0.####");
 | ||
|                             row4[5] = cnmACWP.ToString("0.####");
 | ||
|                             row4[6] = cnmCV.ToString("0.####");
 | ||
|                             row4[7] = cnmSV.ToString("0.####");
 | ||
|                             row4[8] = cnmCPI.ToString("0.####");
 | ||
|                             row4[9] = 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;
 | ||
|                             }
 | ||
|                             row4[10] = cnBCWP.ToString("0.####");
 | ||
|                             row4[11] = cnBCWS.ToString("0.####");
 | ||
|                             row4[12] = cnACWP.ToString("0.####");
 | ||
|                             row4[13] = cnCV.ToString("0.####");
 | ||
|                             row4[14] = cnSV.ToString("0.####");
 | ||
|                             row4[15] = cnCPI.ToString("0.####");
 | ||
|                             row4[16] = cnSPI.ToString("0.####");
 | ||
|                             table4.Rows.Add(row4);
 | ||
|                             b = 1;
 | ||
|                             var unLists = from x in unitProjects where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x;
 | ||
|                             foreach (var un in unLists)
 | ||
|                             {
 | ||
|                                 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;
 | ||
|                                 row4 = table4.NewRow();
 | ||
|                                 row4[0] = c.ToString() + "." + a.ToString() + "." + b.ToString();
 | ||
|                                 row4[1] = c.ToString() + "." + a.ToString();
 | ||
|                                 row4[2] = 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;
 | ||
|                                 }
 | ||
|                                 row4[3] = unmBCWP.ToString("0.####");
 | ||
|                                 row4[4] = unmBCWS.ToString("0.####");
 | ||
|                                 row4[5] = unmACWP.ToString("0.####");
 | ||
|                                 row4[6] = unmCV.ToString("0.####");
 | ||
|                                 row4[7] = unmSV.ToString("0.####");
 | ||
|                                 row4[8] = unmCPI.ToString("0.####");
 | ||
|                                 row4[9] = 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;
 | ||
|                                 }
 | ||
|                                 row4[10] = unBCWP.ToString("0.####");
 | ||
|                                 row4[11] = unBCWS.ToString("0.####");
 | ||
|                                 row4[12] = unACWP.ToString("0.####");
 | ||
|                                 row4[13] = unCV.ToString("0.####");
 | ||
|                                 row4[14] = unSV.ToString("0.####");
 | ||
|                                 row4[15] = unCPI.ToString("0.####");
 | ||
|                                 row4[16] = unSPI.ToString("0.####");
 | ||
|                                 table4.Rows.Add(row4);
 | ||
|                                 b++;
 | ||
|                             }
 | ||
|                             a++;
 | ||
|                         }
 | ||
|                         c++;
 | ||
|                     }
 | ||
|                     if (table4.Rows.Count > 0)
 | ||
|                     {
 | ||
|                         this.Grid4.DataSource = table4;
 | ||
|                         this.Grid4.DataBind();
 | ||
|                     }
 | ||
| 
 | ||
|                     //按设备材料分类统计
 | ||
|                     DataTable table5 = new DataTable();
 | ||
|                     table5.Columns.Add(new DataColumn("Id", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("SupId", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("Name", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("Unit", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("TotalNum", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("mThisNum", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("tThisNum", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("mRate", typeof(String)));
 | ||
|                     table5.Columns.Add(new DataColumn("tRate", typeof(String)));
 | ||
|                     DataRow row5;
 | ||
|                     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)
 | ||
|                     {
 | ||
|                         row5 = table5.NewRow();
 | ||
|                         row5[0] = v.ToString();
 | ||
|                         row5[1] = "0";
 | ||
|                         row5[2] = cn.CnProfessionName;
 | ||
|                         table5.Rows.Add(row5);
 | ||
|                         row5 = table5.NewRow();
 | ||
|                         row5[0] = v.ToString() + ".1";
 | ||
|                         row5[1] = v.ToString();
 | ||
|                         row5[2] = "本专业汇总统计";
 | ||
|                         table5.Rows.Add(row5);
 | ||
|                         d = 1;
 | ||
|                         var bigTypes = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
 | ||
|                         foreach (var bigType in bigTypes)
 | ||
|                         {
 | ||
|                             row5 = table5.NewRow();
 | ||
|                             row5[0] = v.ToString() + ".1." + d.ToString();
 | ||
|                             row5[1] = v.ToString() + ".1";
 | ||
|                             row5[2] = bigType.EquipmentMaterialBigTypeName;
 | ||
|                             var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
 | ||
|                             if (list.Count() > 0)
 | ||
|                             {
 | ||
|                                 row5[3] = list.First().Unit;
 | ||
|                                 row5[4] = list.ToList().Sum(x => x.TotalNum ?? 0);
 | ||
|                                 var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.Months == Funs.GetNewDateTime(date));
 | ||
|                                 row5[5] = list2.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                 var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
 | ||
|                                 row5[6] = list3.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                 if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
 | ||
|                                 {
 | ||
|                                     row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                 }
 | ||
|                                 else
 | ||
|                                 {
 | ||
|                                     row5[7] = "/";
 | ||
|                                 }
 | ||
|                                 if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
 | ||
|                                 {
 | ||
|                                     row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                 }
 | ||
|                                 else
 | ||
|                                 {
 | ||
|                                     row5[8] = "/";
 | ||
|                                 }
 | ||
|                             }
 | ||
|                             table5.Rows.Add(row5);
 | ||
|                             f = 1;
 | ||
|                             var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
 | ||
|                             foreach (var equipmentMaterialType in types)
 | ||
|                             {
 | ||
|                                 row5 = table5.NewRow();
 | ||
|                                 row5[0] = v.ToString() + ".1." + d.ToString() + "." + f.ToString();
 | ||
|                                 row5[1] = v.ToString() + ".1." + d.ToString();
 | ||
|                                 row5[2] = equipmentMaterialType.EquipmentMaterialTypeName;
 | ||
|                                 var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
 | ||
|                                 if (lists.Count() > 0)
 | ||
|                                 {
 | ||
|                                     row5[3] = lists.First().Unit;
 | ||
|                                     row5[4] = lists.ToList().Sum(x => x.TotalNum ?? 0);
 | ||
|                                     var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.Months == Funs.GetNewDateTime(date));
 | ||
|                                     row5[5] = list2s.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                     var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
 | ||
|                                     row5[6] = list3s.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                     if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
 | ||
|                                     {
 | ||
|                                         row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         row5[7] = "/";
 | ||
|                                     }
 | ||
|                                     if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
 | ||
|                                     {
 | ||
|                                         row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         row5[8] = "/";
 | ||
|                                     }
 | ||
|                                 }
 | ||
|                                 table5.Rows.Add(row5);
 | ||
|                                 f++;
 | ||
|                             }
 | ||
|                             d++;
 | ||
|                         }
 | ||
|                         w = 2;
 | ||
|                         foreach (var ins in installations)
 | ||
|                         {
 | ||
|                             row5 = table5.NewRow();
 | ||
|                             row5[0] = v.ToString() + "." + w.ToString();
 | ||
|                             row5[1] = v.ToString();
 | ||
|                             row5[2] = ins.InstallationName;
 | ||
|                             table5.Rows.Add(row5);
 | ||
|                             d = 1;
 | ||
|                             var bigTypes2 = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
 | ||
|                             foreach (var bigType in bigTypes2)
 | ||
|                             {
 | ||
|                                 row5 = table5.NewRow();
 | ||
|                                 row5[0] = v.ToString() + "." + w.ToString() + d.ToString();
 | ||
|                                 row5[1] = v.ToString() + "." + w.ToString();
 | ||
|                                 row5[2] = bigType.EquipmentMaterialBigTypeName;
 | ||
|                                 var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
 | ||
|                                 if (list.Count() > 0)
 | ||
|                                 {
 | ||
|                                     row5[3] = list.First().Unit;
 | ||
|                                     row5[4] = list.ToList().Sum(x => x.TotalNum ?? 0);
 | ||
|                                     var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
 | ||
|                                     row5[5] = list2.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                     var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
 | ||
|                                     row5[6] = list3.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                     if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
 | ||
|                                     {
 | ||
|                                         row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         row5[7] = "/";
 | ||
|                                     }
 | ||
|                                     if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
 | ||
|                                     {
 | ||
|                                         row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         row5[8] = "/";
 | ||
|                                     }
 | ||
|                                 }
 | ||
|                                 table5.Rows.Add(row5);
 | ||
|                                 f = 1;
 | ||
|                                 var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
 | ||
|                                 foreach (var equipmentMaterialType in types)
 | ||
|                                 {
 | ||
|                                     row5 = table5.NewRow();
 | ||
|                                     row5[0] = v.ToString() + "." + w.ToString() + d.ToString() + "." + f.ToString();
 | ||
|                                     row5[1] = v.ToString() + "." + w.ToString() + d.ToString();
 | ||
|                                     row5[2] = equipmentMaterialType.EquipmentMaterialTypeName;
 | ||
|                                     var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
 | ||
|                                     if (lists.Count() > 0)
 | ||
|                                     {
 | ||
|                                         row5[3] = lists.First().Unit;
 | ||
|                                         row5[4] = lists.ToList().Sum(x => x.TotalNum ?? 0);
 | ||
|                                         var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
 | ||
|                                         row5[5] = list2s.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                         var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
 | ||
|                                         row5[6] = list3s.ToList().Sum(x => x.ThisNum ?? 0);
 | ||
|                                         if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
 | ||
|                                         {
 | ||
|                                             row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                         }
 | ||
|                                         else
 | ||
|                                         {
 | ||
|                                             row5[7] = "/";
 | ||
|                                         }
 | ||
|                                         if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
 | ||
|                                         {
 | ||
|                                             row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
 | ||
|                                         }
 | ||
|                                         else
 | ||
|                                         {
 | ||
|                                             row5[8] = "/";
 | ||
|                                         }
 | ||
|                                     }
 | ||
|                                     table5.Rows.Add(row5);
 | ||
|                                     f++;
 | ||
|                                 }
 | ||
|                                 d++;
 | ||
|                             }
 | ||
|                             w++;
 | ||
|                         }
 | ||
|                         v++;
 | ||
|                     }
 | ||
|                     if (table5.Rows.Count > 0)
 | ||
|                     {
 | ||
|                         this.Grid5.DataSource = table5;
 | ||
|                         this.Grid5.DataBind();
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 查询
 | ||
|         /// <summary>
 | ||
|         /// 查询按钮
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnSearch_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             GetValue();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 关闭弹出窗口
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
 | ||
|             {
 | ||
|                 GetValue();
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择月份", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 导出按钮
 | ||
|         /// 导出按钮
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnOut_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)
 | ||
|                     {
 | ||
|                         string rootPath = Server.MapPath("~/");
 | ||
|                         string initTemplatePath = string.Empty;
 | ||
|                         string uploadfilepath = string.Empty;
 | ||
|                         string newUrl = string.Empty;
 | ||
|                         string filePath = string.Empty;
 | ||
|                         Model.SGGLDB db = Funs.DB;
 | ||
|                         initTemplatePath = Const.JDReportTemplateUrl;
 | ||
|                         uploadfilepath = rootPath + initTemplatePath;
 | ||
|                         newUrl = uploadfilepath.Replace(".docx", "(" + this.txtMonths.Text.Trim() + ")" + ".docx");
 | ||
|                         if (File.Exists(newUrl))
 | ||
|                         {
 | ||
|                             File.Delete(newUrl);
 | ||
|                         }
 | ||
|                         File.Copy(uploadfilepath, newUrl);
 | ||
|                         //更新书签内容
 | ||
|                         Document doc = new Aspose.Words.Document(newUrl);
 | ||
|                         DocumentBuilder builder = new DocumentBuilder(doc);
 | ||
|                         string projectName = string.Empty;
 | ||
|                         var project = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
 | ||
|                         if (project != null)
 | ||
|                         {
 | ||
|                             projectName = project.ProjectName;
 | ||
|                         }
 | ||
|                         Bookmark bookmarkProjectName = doc.Range.Bookmarks["ProjectName"];
 | ||
|                         if (bookmarkProjectName != null)
 | ||
|                         {
 | ||
|                             bookmarkProjectName.Text = projectName;
 | ||
|                         }
 | ||
|                         Bookmark bookmarkMonths = doc.Range.Bookmarks["Months"];
 | ||
|                         if (bookmarkMonths != null)
 | ||
|                         {
 | ||
|                             string[] strs = this.txtMonths.Text.Trim().Split('-');
 | ||
|                             bookmarkMonths.Text = strs[0] + "年" + strs[1] + "月";
 | ||
|                         }
 | ||
| 
 | ||
|                         //插入图表
 | ||
|                         builder.MoveToBookmark("Chart");
 | ||
|                         Shape shape = builder.InsertChart(ChartType.Line, 432, 252);
 | ||
|                         Chart chart = shape.Chart;
 | ||
|                         chart.Title.Text = "赢得值曲线";
 | ||
|                         ChartSeriesCollection seriesColl = chart.Series;
 | ||
|                         seriesColl.Clear();
 | ||
| 
 | ||
|                         string[] categories = new string[dt.Rows.Count];
 | ||
|                         double[] d1 = new double[dt.Rows.Count];
 | ||
|                         double[] d2 = new double[dt.Rows.Count];
 | ||
|                         double[] d3 = new double[dt.Rows.Count];
 | ||
|                         for (int i = 0; i < dt.Rows.Count; i++)
 | ||
|                         {
 | ||
|                             categories[i] = dt.Rows[i]["月份"].ToString();
 | ||
|                             d1[i] = Convert.ToDouble(dt.Rows[i]["累计已完工作实际费用-ACWP"].ToString()) / 10000;
 | ||
|                             d2[i] = Convert.ToDouble(dt.Rows[i]["累计已完工作预算费用-BCWP"].ToString()) / 10000;
 | ||
|                             d3[i] = Convert.ToDouble(dt.Rows[i]["累计计划工作预算费用-BCWS"].ToString()) / 10000;
 | ||
|                         }
 | ||
|                         seriesColl.Add("累计已完工作实际费用-ACWP", categories, d1);
 | ||
|                         seriesColl.Add("累计已完工作预算费用-BCWP", categories, d2);
 | ||
|                         seriesColl.Add("累计计划工作预算费用-BCWS", categories, d3);
 | ||
| 
 | ||
|                         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;
 | ||
|                         }
 | ||
|                         #region 项目总体施工进度情况
 | ||
|                         //项目总体施工进度情况
 | ||
|                         builder.MoveToBookmark("Form2");
 | ||
|                         builder.StartTable();
 | ||
|                         builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
 | ||
|                         builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
 | ||
|                         builder.Bold = false;
 | ||
|                         builder.RowFormat.Height = 20;
 | ||
|                         builder.Font.Size = 10;
 | ||
| 
 | ||
|                         //序号
 | ||
|                         //builder.InsertCell();
 | ||
|                         //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         //builder.CellFormat.Width = 30;
 | ||
|                         //builder.Write("序号");
 | ||
|                         //赢得值参数(单位:万元)
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 240;
 | ||
|                         builder.Write("赢得值参数(单位:万元)");
 | ||
|                         //赢得值评价指标
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 320;
 | ||
|                         builder.Write("赢得值评价指标");
 | ||
|                         builder.EndRow();
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("BCWP");
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("BCWS");
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("ACWP");
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("CV");
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("SV");
 | ||
|                         //CPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("CPI");
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("SPI");
 | ||
|                         builder.EndRow();
 | ||
|                         ////序号
 | ||
|                         //builder.InsertCell();
 | ||
|                         //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         //builder.CellFormat.Width = 30;
 | ||
|                         //builder.Write(h.ToString());
 | ||
|                         //问题内容
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((BCWP / 10000).ToString("0.####"));
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((BCWS / 10000).ToString("0.####"));
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((ACWP / 10000).ToString("0.####"));
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(CV.ToString("0.####"));
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(SV.ToString("0.####"));
 | ||
|                         //CPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(CPI.ToString("0.####"));
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(SPI.ToString("0.####"));
 | ||
|                         builder.EndRow();
 | ||
|                         #endregion
 | ||
|                         #region 本月施工进度情况
 | ||
|                         //本月施工进度情况
 | ||
|                         builder.MoveToBookmark("Form3");
 | ||
|                         builder.StartTable();
 | ||
|                         builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
 | ||
|                         builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
 | ||
|                         builder.Bold = false;
 | ||
|                         builder.RowFormat.Height = 20;
 | ||
|                         builder.Font.Size = 10;
 | ||
| 
 | ||
|                         //序号
 | ||
|                         //builder.InsertCell();
 | ||
|                         //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         //builder.CellFormat.Width = 30;
 | ||
|                         //builder.Write("序号");
 | ||
|                         //赢得值参数(单位:万元)
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 240;
 | ||
|                         builder.Write("赢得值参数(单位:万元)");
 | ||
|                         //赢得值评价指标
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 320;
 | ||
|                         builder.Write("赢得值评价指标");
 | ||
|                         builder.EndRow();
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("BCWP");
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("BCWS");
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("ACWP");
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("CV");
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("SV");
 | ||
|                         //CPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("CPI");
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write("SPI");
 | ||
|                         builder.EndRow();
 | ||
|                         //问题内容
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((mBCWP / 10000).ToString("0.####"));
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((mBCWS / 10000).ToString("0.####"));
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write((mACWP / 10000).ToString("0.####"));
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(mCV.ToString("0.####"));
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(mSV.ToString("0.####"));
 | ||
|                         //CPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(mCPI.ToString("0.####"));
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 80;
 | ||
|                         builder.Write(mSPI.ToString("0.####"));
 | ||
|                         builder.EndRow();
 | ||
|                         #endregion
 | ||
|                         #region 专业和分部工程工程施工进度情况
 | ||
|                         //专业和分部工程工程施工进度情况
 | ||
|                         builder.MoveToBookmark("Form4");
 | ||
|                         builder.StartTable();
 | ||
|                         builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
 | ||
|                         builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
 | ||
|                         builder.Bold = false;
 | ||
|                         builder.RowFormat.Height = 20;
 | ||
|                         builder.Font.Size = 10;
 | ||
| 
 | ||
|                         //序号
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 30;
 | ||
|                         builder.Write("序号");
 | ||
|                         //专业
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("专业");
 | ||
|                         //分部工程
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 60;
 | ||
|                         builder.Write("分部工程");
 | ||
|                         //本月赢得值参数(单位:万元)
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 150;
 | ||
|                         builder.Write("本月赢得值参数(单位:万元)");
 | ||
|                         //本月赢得值评价指标
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 200;
 | ||
|                         builder.Write("本月赢得值评价指标");
 | ||
|                         builder.EndRow();
 | ||
|                         //序号
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 30;
 | ||
|                         builder.Write("序号");
 | ||
|                         //专业
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("专业");
 | ||
|                         //分部工程
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 60;
 | ||
|                         builder.Write("分部工程");
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("BCWP");
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("BCWS");
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("ACWP");
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("CV");
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("SV");
 | ||
|                         //CPI 
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("CPI");
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("SPI");
 | ||
|                         builder.EndRow();
 | ||
|                         var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
 | ||
|                         var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == this.CurrUser.LoginProjectId select x;
 | ||
|                         var unitProjectInits = from x in db.Wbs_UnitProjectInit select x;
 | ||
|                         var unitProjects = from x in db.Wbs_UnitProject where x.ProjectId == this.CurrUser.LoginProjectId 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;
 | ||
|                         int a = 1, b = 1;
 | ||
|                         foreach (var cn in cnProfessionInits)
 | ||
|                         {
 | ||
|                             cnmACWP = 0;
 | ||
|                             cnmBCWP = 0;
 | ||
|                             cnmBCWS = 0;
 | ||
|                             cnmCV = 0;
 | ||
|                             cnmSV = 0;
 | ||
|                             cnmCPI = 0;
 | ||
|                             cnmSPI = 0;
 | ||
| 
 | ||
|                             //序号
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 30;
 | ||
|                             builder.Write(a.ToString());
 | ||
|                             //专业
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cn.CnProfessionName);
 | ||
|                             //分部工程
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 60;
 | ||
|                             builder.Write(string.Empty);
 | ||
|                             var cnDetails = (from x in details
 | ||
|                                              join y in cnProfessions on x.ParentId equals y.CnProfessionId
 | ||
|                                              where y.OldId == 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
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmBCWP.ToString("0.####"));
 | ||
|                             //BCWS
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmBCWS.ToString("0.####"));
 | ||
|                             //ACWP
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmACWP.ToString("0.####"));
 | ||
|                             //CV
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmCV.ToString("0.####"));
 | ||
|                             //SV
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmSV.ToString("0.####"));
 | ||
|                             //CPI
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmCPI.ToString("0.####"));
 | ||
|                             //SPI
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnmSPI.ToString("0.####"));
 | ||
|                             builder.EndRow();
 | ||
|                             b = 1;
 | ||
|                             var unLists = (from x in unitProjectInits where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x).ToList();
 | ||
|                             foreach (var un in unLists)
 | ||
|                             {
 | ||
|                                 unmACWP = 0;
 | ||
|                                 unmBCWP = 0;
 | ||
|                                 unmBCWS = 0;
 | ||
|                                 unmCV = 0;
 | ||
|                                 unmSV = 0;
 | ||
|                                 unmCPI = 0;
 | ||
|                                 unmSPI = 0;
 | ||
| 
 | ||
|                                 //序号
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 30;
 | ||
|                                 builder.Write(a.ToString() + "." + b.ToString());
 | ||
|                                 //专业
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(string.Empty);
 | ||
|                                 //分部工程
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 60;
 | ||
|                                 builder.Write(un.UnitProjectName);
 | ||
|                                 var unDetails = from x in details
 | ||
|                                                 join y in unitProjects on x.ParentId equals y.UnitProjectId
 | ||
|                                                 where y.UnitProjectCode == un.UnitProjectCode
 | ||
|                                                 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
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmBCWP.ToString("0.####"));
 | ||
|                                 //BCWS
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmBCWS.ToString("0.####"));
 | ||
|                                 //ACWP
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmACWP.ToString("0.####"));
 | ||
|                                 //CV
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmCV.ToString("0.####"));
 | ||
|                                 //SV
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmSV.ToString("0.####"));
 | ||
|                                 //CPI
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmCPI.ToString("0.####"));
 | ||
|                                 //SPI
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unmSPI.ToString("0.####"));
 | ||
|                                 builder.EndRow();
 | ||
|                                 b++;
 | ||
|                             }
 | ||
|                             a++;
 | ||
|                         }
 | ||
| 
 | ||
| 
 | ||
|                         builder.MoveToBookmark("Form42");
 | ||
|                         builder.StartTable();
 | ||
|                         builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
 | ||
|                         builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
 | ||
|                         builder.Bold = false;
 | ||
|                         builder.RowFormat.Height = 20;
 | ||
|                         builder.Font.Size = 10;
 | ||
| 
 | ||
|                         //序号
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 30;
 | ||
|                         builder.Write("序号");
 | ||
|                         //专业
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("专业");
 | ||
|                         //分部工程
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 60;
 | ||
|                         builder.Write("分部工程");
 | ||
|                         //累计赢得值参数(单位:万元)
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.CellFormat.VerticalMerge = CellMerge.None;
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 150;
 | ||
|                         builder.Write("累计赢得值参数(单位:万元)");
 | ||
|                         //累计赢得值评价指标
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.CellFormat.VerticalMerge = CellMerge.None;
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 200;
 | ||
|                         builder.Write("累计赢得值评价指标");
 | ||
|                         builder.EndRow();
 | ||
|                         //序号
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 30;
 | ||
|                         builder.Write("序号");
 | ||
|                         //专业
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("专业");
 | ||
|                         //分部工程
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 60;
 | ||
|                         builder.Write("分部工程");
 | ||
|                         //BCWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("BCWP");
 | ||
|                         //BCWS
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("BCWS");
 | ||
|                         //ACWP
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("ACWP");
 | ||
|                         //CV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("CV");
 | ||
|                         //SV
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("SV");
 | ||
|                         //CPI 
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("CPI");
 | ||
|                         //SPI
 | ||
|                         builder.InsertCell();
 | ||
|                         builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                         builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                         builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                         builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                         builder.CellFormat.Width = 50;
 | ||
|                         builder.Write("SPI");
 | ||
|                         builder.EndRow();
 | ||
|                         a = 1;
 | ||
|                         b = 1;
 | ||
|                         foreach (var cn in cnProfessionInits)
 | ||
|                         {
 | ||
|                             cnACWP = 0;
 | ||
|                             cnBCWP = 0;
 | ||
|                             cnBCWS = 0;
 | ||
|                             cnCV = 0;
 | ||
|                             cnSV = 0;
 | ||
|                             cnCPI = 0;
 | ||
|                             cnSPI = 0;
 | ||
|                             //序号
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 30;
 | ||
|                             builder.Write(a.ToString());
 | ||
|                             //专业
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cn.CnProfessionName);
 | ||
|                             //分部工程
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 60;
 | ||
|                             builder.Write(string.Empty);
 | ||
|                             var cnDetails = (from x in details
 | ||
|                                              join y in cnProfessions on x.ParentId equals y.CnProfessionId
 | ||
|                                              where y.OldId == 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;
 | ||
|                             }
 | ||
|                             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
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnBCWP.ToString("0.####"));
 | ||
|                             //BCWS
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnBCWS.ToString("0.####"));
 | ||
|                             //ACWP
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnACWP.ToString("0.####"));
 | ||
|                             //CV
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnCV.ToString("0.####"));
 | ||
|                             //SV
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnSV.ToString("0.####"));
 | ||
|                             //CPI
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnCPI.ToString("0.####"));
 | ||
|                             //SPI
 | ||
|                             builder.InsertCell();
 | ||
|                             builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                             builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                             builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                             builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                             builder.CellFormat.Width = 50;
 | ||
|                             builder.Write(cnSPI.ToString("0.####"));
 | ||
|                             builder.EndRow();
 | ||
|                             b = 1;
 | ||
|                             var unLists = (from x in unitProjectInits where x.CnProfessionId == cn.CnProfessionId orderby x.SortIndex select x).ToList();
 | ||
|                             foreach (var un in unLists)
 | ||
|                             {
 | ||
|                                 unACWP = 0;
 | ||
|                                 unBCWP = 0;
 | ||
|                                 unBCWS = 0;
 | ||
|                                 unCV = 0;
 | ||
|                                 unSV = 0;
 | ||
|                                 unCPI = 0;
 | ||
|                                 unSPI = 0;
 | ||
|                                 //序号
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 30;
 | ||
|                                 builder.Write(a.ToString() + "." + b.ToString());
 | ||
|                                 //专业
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(string.Empty);
 | ||
|                                 //分部工程
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 60;
 | ||
|                                 builder.Write(un.UnitProjectName);
 | ||
|                                 var unDetails = from x in details
 | ||
|                                                 join y in unitProjects on x.ParentId equals y.UnitProjectId
 | ||
|                                                 where y.UnitProjectCode == un.UnitProjectCode
 | ||
|                                                 select x;
 | ||
|                                 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
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unBCWP.ToString("0.####"));
 | ||
|                                 //BCWS
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unBCWS.ToString("0.####"));
 | ||
|                                 //ACWP
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unACWP.ToString("0.####"));
 | ||
|                                 //CV
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unCV.ToString("0.####"));
 | ||
|                                 //SV
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unSV.ToString("0.####"));
 | ||
|                                 //CPI
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unCPI.ToString("0.####"));
 | ||
|                                 //SPI
 | ||
|                                 builder.InsertCell();
 | ||
|                                 builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
 | ||
|                                 builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
 | ||
|                                 builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
 | ||
|                                 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
 | ||
|                                 builder.CellFormat.Width = 50;
 | ||
|                                 builder.Write(unSPI.ToString("0.####"));
 | ||
|                                 builder.EndRow();
 | ||
|                                 b++;
 | ||
|                             }
 | ||
|                             a++;
 | ||
|                         }
 | ||
|                         #endregion
 | ||
|                         doc.Save(newUrl);
 | ||
|                         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);
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         ShowNotify("没有数据,无法导出!", MessageBoxIcon.Warning);
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择月份!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
|         #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(".xls", "(" + this.txtMonths.Text.Trim() + ")" + ".xls");
 | ||
|                             File.Copy(uploadfilepath, newUrl);
 | ||
|                             // 第一步:读取文件流
 | ||
|                             NPOI.SS.UserModel.IWorkbook workbook;
 | ||
|                             using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
 | ||
|                             {
 | ||
|                                 workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(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);//
 | ||
|         //                }
 | ||
|         //            }
 | ||
| 
 | ||
|         //        }
 | ||
|         //    }
 | ||
|         //}
 | ||
| 
 | ||
|     }
 | ||
| } |