3877 lines
		
	
	
		
			221 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			3877 lines
		
	
	
		
			221 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						||
using NPOI.HSSF.UserModel;
 | 
						||
using NPOI.HSSF.Util;
 | 
						||
using NPOI.SS.UserModel;
 | 
						||
using NPOI.SS.Util;
 | 
						||
using NPOI.XSSF.UserModel;
 | 
						||
using System;
 | 
						||
using System.Collections.Generic;
 | 
						||
using System.Data;
 | 
						||
using System.Data.SqlClient;
 | 
						||
using System.Globalization;
 | 
						||
using System.IO;
 | 
						||
using System.Linq;
 | 
						||
using System.Web.UI.WebControls;
 | 
						||
using System.Threading;
 | 
						||
using Model;
 | 
						||
 | 
						||
namespace FineUIPro.Web.Report
 | 
						||
{
 | 
						||
    public partial class OverviewReport : PageBase
 | 
						||
    {
 | 
						||
        public static int percent { get; set; }
 | 
						||
        public static string url { get; set; }
 | 
						||
 | 
						||
        [System.Web.Services.WebMethod]
 | 
						||
        public static int getPercent()
 | 
						||
        {
 | 
						||
            return percent;
 | 
						||
        }
 | 
						||
 | 
						||
        [System.Web.Services.WebMethod]
 | 
						||
        public static string getUrl()
 | 
						||
        {
 | 
						||
            return url;
 | 
						||
        }
 | 
						||
 | 
						||
        protected void Page_Load(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            InitGrid();
 | 
						||
            if (!IsPostBack)
 | 
						||
            {
 | 
						||
                percent = 0;
 | 
						||
                url = "";
 | 
						||
 | 
						||
                GetButtonPower();//权限设置                
 | 
						||
                BindGrid1();
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        private void InitGrid()
 | 
						||
        {
 | 
						||
            GregorianCalendar gc = new GregorianCalendar();
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                FineUIPro.GroupField gf = new FineUIPro.GroupField();
 | 
						||
                gf.TextAlign = TextAlign.Center;
 | 
						||
                gf.HeaderText = dateTime.Year + "";
 | 
						||
                for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
                {
 | 
						||
                    FineUIPro.BoundField bf = new FineUIPro.BoundField();
 | 
						||
                    bf.DataField = dateTime.Year + "-" + j;
 | 
						||
                    bf.DataFormatString = "{0}";
 | 
						||
                    bf.HeaderText = "" + j;
 | 
						||
                    bf.Width= Unit.Pixel(50);
 | 
						||
                    gf.Columns.Add(bf);
 | 
						||
                }
 | 
						||
                Grid4.Columns.Add(gf);
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        #region 点击TAB数据切换
 | 
						||
        /// <summary>
 | 
						||
        /// 点击TAB数据切换
 | 
						||
        /// </summary>
 | 
						||
        protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            if (TabStrip1.ActiveTabIndex == 0)
 | 
						||
            {
 | 
						||
                this.txtProjectManger.Hidden = false;
 | 
						||
                this.txtEngineer.Hidden = false;
 | 
						||
                this.txtEngineeringManager.Hidden = false;
 | 
						||
                BindGrid1();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 1)
 | 
						||
            {
 | 
						||
                this.txtProjectManger.Hidden = true;
 | 
						||
                this.txtEngineer.Hidden = true;
 | 
						||
                this.txtEngineeringManager.Hidden = true;
 | 
						||
                BindGrid2();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 2)
 | 
						||
            {
 | 
						||
                this.txtProjectManger.Hidden = true;
 | 
						||
                this.txtEngineer.Hidden = true;
 | 
						||
                this.txtEngineeringManager.Hidden = true;
 | 
						||
                BindGrid3();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 3)
 | 
						||
            {
 | 
						||
                this.txtProjectManger.Hidden = true;
 | 
						||
                this.txtEngineer.Hidden = true;
 | 
						||
                this.txtEngineeringManager.Hidden = true;
 | 
						||
                BindGrid4();
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 查询
 | 
						||
        /// <summary>
 | 
						||
        /// 查询
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void btnSearch_Click(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            if (TabStrip1.ActiveTabIndex == 0)
 | 
						||
            {
 | 
						||
                BindGrid1();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 1)
 | 
						||
            {
 | 
						||
                BindGrid2();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 2)
 | 
						||
            {
 | 
						||
                BindGrid3();
 | 
						||
            }
 | 
						||
            else if (TabStrip1.ActiveTabIndex == 3)
 | 
						||
            {
 | 
						||
                BindGrid4();
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region Over view
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid1()
 | 
						||
        {
 | 
						||
            string strSql = @"SELECT * FROM VIEW_Report_Overview WHERE 1=1 ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtProjectManger.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_ProjectManager LIKE @ProjectManager ";
 | 
						||
                listStr.Add(new SqlParameter("@ProjectManager", "%" + this.txtProjectManger.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtEngineeringManager.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_EMManager LIKE @EngineeringManager ";
 | 
						||
                listStr.Add(new SqlParameter("@EngineeringManager", "%" + this.txtEngineeringManager.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtEngineer.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND Engineer LIKE @Engineer ";
 | 
						||
                listStr.Add(new SqlParameter("@Engineer", "%" + this.txtEngineer.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            // 2.获取当前分页数据
 | 
						||
            //var table = this.GetPagedDataTable(Grid1, tb1);
 | 
						||
            Grid1.RecordCount = tb.Rows.Count;
 | 
						||
            var table = this.GetPagedDataTable(Grid1, tb);
 | 
						||
            Grid1.DataSource = table;
 | 
						||
            Grid1.DataBind();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 排序
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						||
        {
 | 
						||
            Grid1.SortDirection = e.SortDirection;
 | 
						||
            Grid1.SortField = e.SortField;
 | 
						||
            BindGrid1();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            Grid1.PageIndex = e.NewPageIndex;
 | 
						||
            BindGrid1();
 | 
						||
        }
 | 
						||
        #endregion        
 | 
						||
 | 
						||
        #region PermitGeneral
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid2()
 | 
						||
        {
 | 
						||
            string strSql = @"SELECT * FROM View_Report_PermitGeneral WHERE (EnvAssess!='-' OR EnergySaving!='-' 
 | 
						||
                                       OR  ProjectRegistr!='-' OR PlanningPermit!='-'
 | 
						||
                                       OR SafetyConReview!='-' OR SafetyDesginReview !='-' OR FFDesginReview!='-') ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            // 2.获取当前分页数据
 | 
						||
            //var table = this.GetPagedDataTable(Grid1, tb1);
 | 
						||
            Grid2.RecordCount = tb.Rows.Count;
 | 
						||
            var table = this.GetPagedDataTable(Grid2, tb);
 | 
						||
            Grid2.DataSource = table;
 | 
						||
            Grid2.DataBind();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            Grid2.PageIndex = e.NewPageIndex;
 | 
						||
            BindGrid2();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 排序
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid2_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						||
        {
 | 
						||
            Grid2.SortDirection = e.SortDirection;
 | 
						||
            Grid2.SortField = e.SortField;
 | 
						||
            BindGrid2();
 | 
						||
        }        
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region Permit_Pressure Piping & Vesse
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid3()
 | 
						||
        {
 | 
						||
            string strSql = @"SELECT * FROM View_Report_Permit_PressurePipingVesse WHERE 1=1 ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            // 2.获取当前分页数据
 | 
						||
            //var table = this.GetPagedDataTable(Grid1, tb1);
 | 
						||
            Grid3.RecordCount = tb.Rows.Count;
 | 
						||
            var table = this.GetPagedDataTable(Grid3, tb);
 | 
						||
            Grid3.DataSource = table;
 | 
						||
            Grid3.DataBind();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid3_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            Grid3.PageIndex = e.NewPageIndex;
 | 
						||
            BindGrid3();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 排序
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid3_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						||
        {
 | 
						||
            Grid3.SortDirection = e.SortDirection;
 | 
						||
            Grid3.SortField = e.SortField;
 | 
						||
            BindGrid3();
 | 
						||
        }        
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region Schedule_Gantt_Bar
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid4()
 | 
						||
        {
 | 
						||
            string strSql = @"SELECT * FROM View_Report_ScheduleGanttBar WHERE 1=1 ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
           
 | 
						||
            GregorianCalendar gc = new GregorianCalendar();
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
                {
 | 
						||
                    tb.Columns.Add(dateTime.Year + "-" + j, System.Type.GetType("System.String"));
 | 
						||
                }
 | 
						||
            }
 | 
						||
 | 
						||
            for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    var ReceiveDate = tb.Rows[i]["ReceiveDate"];
 | 
						||
                    var ApprovalDate = tb.Rows[i]["ApprovalDate"];
 | 
						||
                    var ConstStart = tb.Rows[i]["ConstMECivilStart"];
 | 
						||
                    var DEMEEnd = tb.Rows[i]["DEMECivilEnd"];
 | 
						||
                    var ConstEnd = tb.Rows[i]["ConstMECivilEnd"];
 | 
						||
                    if (ReceiveDate is DateTime && ApprovalDate is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ReceiveDate;
 | 
						||
                        DateTime end = (DateTime)ApprovalDate;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "A";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (ApprovalDate is DateTime && ConstStart is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ApprovalDate;
 | 
						||
                        DateTime end = (DateTime)ConstStart;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "B";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (ConstStart is DateTime && DEMEEnd is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ConstStart;
 | 
						||
                        DateTime end = (DateTime)DEMEEnd;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "C";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (DEMEEnd is DateTime && ConstEnd is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)DEMEEnd;
 | 
						||
                        DateTime end = (DateTime)ConstEnd;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "D";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception e)
 | 
						||
                {
 | 
						||
 | 
						||
                }
 | 
						||
            }
 | 
						||
            
 | 
						||
           
 | 
						||
          
 | 
						||
            // 2.获取当前分页数据
 | 
						||
            //var table = this.GetPagedDataTable(Grid1, tb1);
 | 
						||
            
 | 
						||
            Grid4.RecordCount = tb.Rows.Count;
 | 
						||
            var table = this.GetPagedDataTable(Grid4, tb);
 | 
						||
            Grid4.DataSource = table;
 | 
						||
            Grid4.DataBind();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid4_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            Grid4.PageIndex = e.NewPageIndex;
 | 
						||
            BindGrid4();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 排序
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid4_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						||
        {
 | 
						||
            Grid4.SortDirection = e.SortDirection;
 | 
						||
            Grid4.SortField = e.SortField;
 | 
						||
            BindGrid4();
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 导出GaExport
 | 
						||
        protected void btnGaExport_Click(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            percent = 0;
 | 
						||
            url = "";
 | 
						||
            string strSql = @"SELECT * FROM View_GaReport_ScheduleGanttBar WHERE 1=1 ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            strSql += " order by ProjectControl_JobNo desc";
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
 | 
						||
            Thread t = new Thread(new ThreadStart(() => { GaExport(strSql, parameter); }));
 | 
						||
            t.Start();
 | 
						||
            PageContext.RegisterStartupScript("showProcessBar()");
 | 
						||
        }
 | 
						||
 | 
						||
        private void GaExport(string strSql, SqlParameter[] parameter)
 | 
						||
        {
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            int totalNum= tb.Rows.Count;
 | 
						||
 | 
						||
            string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
 | 
						||
            //模板文件
 | 
						||
            string TempletFileName = rootPath + "P31_GanttReport.xlsx";
 | 
						||
            //导出文件
 | 
						||
            string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
 | 
						||
            if (!Directory.Exists(filePath))
 | 
						||
            {
 | 
						||
                Directory.CreateDirectory(filePath);
 | 
						||
            }
 | 
						||
            //string ReportFileName = filePath + "out.xlsx";
 | 
						||
            string ReportFileName = filePath + "P31_GanttReport_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
 | 
						||
 | 
						||
            FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
 | 
						||
            XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
 | 
						||
 | 
						||
            XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            cs_content_Font.FontName = "sans-serif";//字体
 | 
						||
            cs_content_Font.FontHeightInPoints = 10; //字体大小     
 | 
						||
 | 
						||
            IDataFormat dataformat = hssfworkbook.CreateDataFormat();
 | 
						||
            ICellStyle styleQfw = hssfworkbook.CreateCellStyle();
 | 
						||
            styleQfw.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            styleQfw.Alignment = HorizontalAlignment.Right;
 | 
						||
            styleQfw.DataFormat = dataformat.GetFormat("#,##0.00");
 | 
						||
            styleQfw.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            ICellStyle styleDate = hssfworkbook.CreateCellStyle();
 | 
						||
            styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
 | 
						||
            styleDate.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            #region 背景色、字体设置
 | 
						||
 | 
						||
            #region 黄底黑字 backgroundstyle1
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle1 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle1.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor1 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbYellow1 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor1.SetRgb(rgbYellow1);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle1.SetFillForegroundColor(xssfcolor1);
 | 
						||
 | 
						||
            //创建字体
 | 
						||
            XSSFFont red_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font.Color = HSSFColor.Black.Index;//黑字
 | 
						||
            backgroundstyle1.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle1.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle1.SetFont(red_content_Font);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 黄底红字 backgroundstyle2
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle2 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle2.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor2 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbYellow2 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor2.SetRgb(rgbYellow2);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle2.SetFillForegroundColor(xssfcolor2);
 | 
						||
 | 
						||
            //创建字体
 | 
						||
            XSSFFont red_content_Font2 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font2.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font2.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font2.Color = HSSFColor.Red.Index;//黑字
 | 
						||
            backgroundstyle2.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle2.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle2.SetFont(red_content_Font2);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底红字 backgroundstyle3
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle3 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle3.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor3 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbRed3 = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor3.SetRgb(rgbRed3);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle3.SetFillForegroundColor(xssfcolor3);
 | 
						||
 | 
						||
            ///创建字体
 | 
						||
            XSSFFont red_content_Font3 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font3.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font3.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font3.Color = HSSFColor.Red.Index;
 | 
						||
            backgroundstyle3.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle3.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle3.SetFont(red_content_Font3);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 白底红字 backgroundstyle4
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle4 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle4.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor4 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbWhite = { (byte)255, (byte)255, (byte)255 };//白色
 | 
						||
                                                                  //写入rgb
 | 
						||
            xssfcolor4.SetRgb(rgbWhite);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle4.SetFillForegroundColor(xssfcolor4);
 | 
						||
 | 
						||
            ///创建字体
 | 
						||
            XSSFFont red_content_Font4 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font4.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font4.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font4.Color = HSSFColor.Red.Index;
 | 
						||
            backgroundstyle4.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle4.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle4.SetFont(red_content_Font4);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle redbackgroundstyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            redbackgroundstyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfredcolor = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbRed = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            xssfredcolor.SetRgb(rgbRed);
 | 
						||
            //设置颜色值
 | 
						||
            redbackgroundstyle.SetFillForegroundColor(xssfredcolor);
 | 
						||
            redbackgroundstyle.SetFont(cs_content_Font);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle redDatestyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            redDatestyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor redDatecolor = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbDateRed = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            redDatecolor.SetRgb(rgbDateRed);
 | 
						||
            //设置颜色值
 | 
						||
            redDatestyle.SetFillForegroundColor(redDatecolor);
 | 
						||
            redDatestyle.DataFormat = dataformat.GetFormat("yyyy/m/d");
 | 
						||
            redDatestyle.SetFont(cs_content_Font);
 | 
						||
            #endregion
 | 
						||
            #endregion
 | 
						||
 | 
						||
            XSSFSheet sgb = (XSSFSheet)hssfworkbook.GetSheet("Schedule_Gantt_Bar");
 | 
						||
            GregorianCalendar gc = new GregorianCalendar();
 | 
						||
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                //for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
                for (int j = 1; j <= gc.GetMonth(dateTime); j++)
 | 
						||
                {
 | 
						||
                    tb.Columns.Add(dateTime.Year + "-" + j, System.Type.GetType("System.String"));
 | 
						||
                }
 | 
						||
            }
 | 
						||
 | 
						||
            for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    var PlanHours_A = tb.Rows[i]["PlanHours_ACP"];
 | 
						||
                    var PlanHours_C = tb.Rows[i]["PlanHours_S"];
 | 
						||
 | 
						||
                    var Detail_Eng_Civil_ReviseStart = tb.Rows[i]["Detail_Eng_Civil_ReviseStart"];
 | 
						||
                    var Detail_Eng_MechEI_ReviseStart = tb.Rows[i]["Detail_Eng_MechEI_ReviseStart"];
 | 
						||
                    var RP_Detail_Eng_Civil_Sch_Start = tb.Rows[i]["RP_Detail_Eng_Civil_Sch_Start"];
 | 
						||
                    var RP_Detail_Eng_Mech_EI_Sch_Start = tb.Rows[i]["RP_Detail_Eng_Mech_EI_Sch_Start"];
 | 
						||
                    var RevisedStartA = tb.Rows[i]["RevisedStartA"];
 | 
						||
 | 
						||
                    var Detail_Eng_Civil_ReviseEnd = tb.Rows[i]["Detail_Eng_Civil_ReviseEnd"];
 | 
						||
                    var Detail_Eng_MechEI_ReviseEnd = tb.Rows[i]["Detail_Eng_MechEI_ReviseEnd"];
 | 
						||
                    var RP_Detail_Eng_Civil_Sch_End = tb.Rows[i]["RP_Detail_Eng_Civil_Sch_End"];
 | 
						||
                    var RP_Detail_Eng_Mech_EI_Sch_End = tb.Rows[i]["RP_Detail_Eng_Mech_EI_Sch_End"];
 | 
						||
                    var RevisedEndA = tb.Rows[i]["RevisedEndA"];
 | 
						||
 | 
						||
                    var RevisedStartCC = tb.Rows[i]["RevisedStartCC"];
 | 
						||
                    var RevisedStartCM = tb.Rows[i]["RevisedStartCM"];
 | 
						||
                    var RevisedEndCC = tb.Rows[i]["RevisedEndCC"];
 | 
						||
                    var RevisedEndCM = tb.Rows[i]["RevisedEndCM"];
 | 
						||
 | 
						||
                    int planHours_A = PlanHours_A.ToString() != "" ? Convert.ToInt32(PlanHours_A) : 0;
 | 
						||
                    int planHours_C = PlanHours_C.ToString() != "" ? Convert.ToInt32(PlanHours_C) : 0;
 | 
						||
 | 
						||
                    DateTime ? civil_ReviseStart = null;
 | 
						||
                    DateTime? eng_MechEI_ReviseStart = null;
 | 
						||
                    DateTime? revisedStartA = null;
 | 
						||
 | 
						||
                    DateTime? civil_ReviseEnd = null;
 | 
						||
                    DateTime? eng_MechEI_ReviseEnd = null;
 | 
						||
                    DateTime? revisedEndA = null;
 | 
						||
 | 
						||
                    if (RevisedStartA.ToString() != "")
 | 
						||
                    {
 | 
						||
                        revisedStartA = (DateTime)RevisedStartA;
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (RP_Detail_Eng_Civil_Sch_Start.ToString() != "")
 | 
						||
                        {
 | 
						||
                            civil_ReviseStart = (DateTime)RP_Detail_Eng_Civil_Sch_Start;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (Detail_Eng_Civil_ReviseStart.ToString() != "")
 | 
						||
                            {
 | 
						||
                                civil_ReviseStart = (DateTime)Detail_Eng_Civil_ReviseStart;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (RP_Detail_Eng_Mech_EI_Sch_Start.ToString() != "")
 | 
						||
                        {
 | 
						||
                            eng_MechEI_ReviseStart = (DateTime)RP_Detail_Eng_Mech_EI_Sch_Start;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (Detail_Eng_MechEI_ReviseStart.ToString() != "")
 | 
						||
                            {
 | 
						||
                                eng_MechEI_ReviseStart = (DateTime)Detail_Eng_MechEI_ReviseStart;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (civil_ReviseStart != null && eng_MechEI_ReviseStart != null)
 | 
						||
                        {
 | 
						||
                            if (civil_ReviseStart < eng_MechEI_ReviseStart)
 | 
						||
                            {
 | 
						||
                                revisedStartA = civil_ReviseStart;
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                revisedStartA = eng_MechEI_ReviseStart;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (civil_ReviseStart != null)
 | 
						||
                            {
 | 
						||
                                revisedStartA = civil_ReviseStart;
 | 
						||
                            }
 | 
						||
                            if (eng_MechEI_ReviseStart != null)
 | 
						||
                            {
 | 
						||
                                revisedStartA = eng_MechEI_ReviseStart;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (RevisedEndA.ToString() != "")
 | 
						||
                    {
 | 
						||
                        revisedEndA = (DateTime)RevisedEndA;
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (RP_Detail_Eng_Civil_Sch_End.ToString() != "")
 | 
						||
                        {
 | 
						||
                            civil_ReviseEnd = (DateTime)RP_Detail_Eng_Civil_Sch_End;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (Detail_Eng_Civil_ReviseEnd.ToString() != "")
 | 
						||
                            {
 | 
						||
                                civil_ReviseEnd = (DateTime)Detail_Eng_Civil_ReviseEnd;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (RP_Detail_Eng_Mech_EI_Sch_End.ToString() != "")
 | 
						||
                        {
 | 
						||
                            eng_MechEI_ReviseEnd = (DateTime)RP_Detail_Eng_Mech_EI_Sch_End;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (Detail_Eng_MechEI_ReviseEnd.ToString() != "")
 | 
						||
                            {
 | 
						||
                                eng_MechEI_ReviseEnd = (DateTime)Detail_Eng_MechEI_ReviseEnd;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (civil_ReviseEnd != null && eng_MechEI_ReviseEnd != null)
 | 
						||
                        {
 | 
						||
                            if (civil_ReviseEnd < eng_MechEI_ReviseEnd)
 | 
						||
                            {
 | 
						||
                                revisedEndA = eng_MechEI_ReviseEnd;
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                revisedEndA = civil_ReviseEnd;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            if (civil_ReviseEnd != null)
 | 
						||
                            {
 | 
						||
                                revisedEndA = civil_ReviseEnd;
 | 
						||
                            }
 | 
						||
                            if (eng_MechEI_ReviseEnd != null)
 | 
						||
                            {
 | 
						||
                                revisedEndA = eng_MechEI_ReviseEnd;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    DateTime? revisedStartC = null;
 | 
						||
                    DateTime? revisedEndC = null;
 | 
						||
 | 
						||
                    if (RevisedStartCC.ToString() != "" && RevisedStartCM.ToString() != "")
 | 
						||
                    {
 | 
						||
                        if ((DateTime)RevisedStartCC < (DateTime)RevisedStartCM)
 | 
						||
                        {
 | 
						||
                            revisedStartC = (DateTime)RevisedStartCC;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            revisedStartC = (DateTime)RevisedStartCM;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (RevisedStartCC.ToString() != "")
 | 
						||
                        {
 | 
						||
                            revisedStartC = (DateTime)RevisedStartCC;
 | 
						||
                        }
 | 
						||
                        if (RevisedStartCM.ToString() != "")
 | 
						||
                        {
 | 
						||
                            revisedStartC = (DateTime)RevisedStartCM;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (RevisedEndCC.ToString() != "" && RevisedEndCM.ToString() != "")
 | 
						||
                    {
 | 
						||
                        if ((DateTime)RevisedEndCC > (DateTime)RevisedEndCM)
 | 
						||
                        {
 | 
						||
                            revisedEndC = (DateTime)RevisedEndCC;
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            revisedEndC = (DateTime)RevisedEndCM;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (RevisedEndCC.ToString() != "")
 | 
						||
                        {
 | 
						||
                            revisedEndC = (DateTime)RevisedEndCC;
 | 
						||
                        }
 | 
						||
                        if (RevisedEndCM.ToString() != "")
 | 
						||
                        {
 | 
						||
                            revisedEndC = (DateTime)RevisedEndCM;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (revisedStartC != null && revisedEndC != null)
 | 
						||
                    {
 | 
						||
                        int monthNum = (revisedEndC.Value.Year - revisedStartC.Value.Year) * 12 + (revisedEndC.Value.Month - revisedStartC.Value.Month) + 1;
 | 
						||
                        if (monthNum != 0)
 | 
						||
                        {
 | 
						||
                            string strnum = Convert.ToInt32(Math.Round((double)(planHours_C / monthNum))).ToString() + "C";
 | 
						||
                            while (revisedStartC.Value.Year <= revisedEndC.Value.Year
 | 
						||
                                && revisedStartC.Value.Month <= (revisedEndC.Value.Year - revisedStartC.Value.Year) * 12 + revisedEndC.Value.Month)
 | 
						||
                            {
 | 
						||
                                if (tb.Columns.Contains(revisedStartC.Value.Year + "-" + revisedStartC.Value.Month))
 | 
						||
                                {
 | 
						||
                                    tb.Rows[i][revisedStartC.Value.Year + "-" + revisedStartC.Value.Month] = strnum;
 | 
						||
                                }
 | 
						||
                                revisedStartC = revisedStartC.Value.AddMonths(1);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (revisedStartA != null && revisedEndA != null && revisedStartA < revisedEndA)
 | 
						||
                    {
 | 
						||
                        int monthNum = (revisedEndA.Value.Year - revisedStartA.Value.Year) * 12 + (revisedEndA.Value.Month - revisedStartA.Value.Month) + 1;
 | 
						||
                        if (monthNum != 0)
 | 
						||
                        {
 | 
						||
                            string strnum = Convert.ToInt32(Math.Round((double)(planHours_A / monthNum))).ToString() + "A";
 | 
						||
                            while (revisedStartA.Value.Year <= revisedEndA.Value.Year
 | 
						||
                                && revisedStartA.Value.Month <= (revisedEndA.Value.Year - revisedStartA.Value.Year) * 12 + revisedEndA.Value.Month)
 | 
						||
                            {
 | 
						||
                                if (tb.Columns.Contains(revisedStartA.Value.Year + "-" + revisedStartA.Value.Month))
 | 
						||
                                {
 | 
						||
                                    tb.Rows[i][revisedStartA.Value.Year + "-" + revisedStartA.Value.Month] = strnum;
 | 
						||
                                }
 | 
						||
                                revisedStartA = revisedStartA.Value.AddMonths(1);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
 | 
						||
                }
 | 
						||
            }
 | 
						||
 | 
						||
            //计算excel表头
 | 
						||
            int index = 1;
 | 
						||
 | 
						||
            cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
            ICellStyle styleToday = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleToday.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Pink.Index;
 | 
						||
 | 
						||
            styleToday.FillPattern = FillPattern.SolidForeground;
 | 
						||
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                ICellStyle styleTitle = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
                switch (i)
 | 
						||
                {
 | 
						||
                    case -3:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.CornflowerBlue.Index;
 | 
						||
                        break;
 | 
						||
                    case -2:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightYellow.Index;
 | 
						||
                        break;
 | 
						||
                    case -1:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Rose.Index;
 | 
						||
                        break;
 | 
						||
                    case 0:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Green.Index;
 | 
						||
                        break;
 | 
						||
                    case 1:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
 | 
						||
                        break;
 | 
						||
                }
 | 
						||
                styleTitle.FillPattern = FillPattern.SolidForeground;
 | 
						||
                for (int j = 1; j <= 12; j++)
 | 
						||
                {
 | 
						||
                    byte[] rgb = new byte[3] { 192, 0, 0 };
 | 
						||
                    sgb.GetRow(0).CreateCell(index + 10);
 | 
						||
                    sgb.GetRow(1).CreateCell(index + 10).SetCellValue(j);
 | 
						||
 | 
						||
                    sgb.GetRow(0).GetCell(index + 10).CellStyle = styleTitle;
 | 
						||
                    if (dateTime.Year == DateTime.Now.Year && DateTime.Now.Month == j)
 | 
						||
                    {
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle = styleToday;
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle.VerticalAlignment = VerticalAlignment.Bottom;
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle = styleTitle;
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    }
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
 | 
						||
                    //sgb.GetRow(0).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
                    //sgb.GetRow(1).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
                    index++;
 | 
						||
                }
 | 
						||
                CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, index + 10 - 12, (index + 9));
 | 
						||
                sgb.AddMergedRegion(cellRangeAddress);
 | 
						||
                sgb.GetRow(0).GetCell(index + 10 - 12).SetCellValue(dateTime.Year);
 | 
						||
                sgb.GetRow(0).GetCell(index + 10 - 12).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            }
 | 
						||
 | 
						||
            ICellStyle style = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            style.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleA = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleA.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
 | 
						||
            styleA.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleB = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleB.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            styleB.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleC = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleC.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Indigo.Index;
 | 
						||
            styleC.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleD = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleD.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            styleD.FillPattern = FillPattern.SolidForeground;
 | 
						||
            if (tb.Rows.Count > 0)
 | 
						||
            {
 | 
						||
                var rowIndex = 2;
 | 
						||
                for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
                {
 | 
						||
                    if (sgb.GetRow(rowIndex) == null) sgb.CreateRow(rowIndex);
 | 
						||
 | 
						||
                    //XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
                    //cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
 | 
						||
                    #region 列赋值
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(0) == null) sgb.GetRow(rowIndex).CreateCell(0);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(0).SetCellValue(tb.Rows[i]["ProjectControl_JobNo"].ToString());
 | 
						||
 | 
						||
                    //sgb.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(1) == null) sgb.GetRow(rowIndex).CreateCell(1);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(1).SetCellValue(tb.Rows[i]["ProjectControl_BUCode"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(2) == null) sgb.GetRow(rowIndex).CreateCell(2);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(2).SetCellValue(tb.Rows[i]["ProjectControl_JobType"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(3) == null) sgb.GetRow(rowIndex).CreateCell(3);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(3).SetCellValue(tb.Rows[i]["ProjectControl_JobTitle"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(4) == null) sgb.GetRow(rowIndex).CreateCell(4);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(4).SetCellValue(tb.Rows[i]["PM_General_Priority"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(5) == null) sgb.GetRow(rowIndex).CreateCell(5);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(5).SetCellValue(tb.Rows[i]["PM_General_Category"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(6) == null) sgb.GetRow(rowIndex).CreateCell(6);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(6).SetCellValue(tb.Rows[i]["PlanHours_ACP"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(7) == null) sgb.GetRow(rowIndex).CreateCell(7);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(7).SetCellValue(tb.Rows[i]["PlanHours_S"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(8) == null) sgb.GetRow(rowIndex).CreateCell(8);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(8).SetCellValue(tb.Rows[i]["ProjectControl_LeadByName"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(9) == null) sgb.GetRow(rowIndex).CreateCell(9);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(9).SetCellValue(tb.Rows[i]["ProjectControl_JobStatus"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(10) == null) sgb.GetRow(rowIndex).CreateCell(10);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(10).SetCellValue(tb.Rows[i]["Schedule"].ToString());
 | 
						||
 | 
						||
                    for (int j = 11; j < tb.Columns.Count - 24; j++)
 | 
						||
                    {
 | 
						||
                        if (sgb.GetRow(rowIndex).GetCell(j) == null) sgb.GetRow(rowIndex).CreateCell(j);
 | 
						||
                        if (tb.Rows[i][j + 15] != null && tb.Rows[i][j + 15].ToString() != "")
 | 
						||
                        {
 | 
						||
                            string cv = tb.Rows[i][j + 15].ToString().Substring(0, tb.Rows[i][j + 15].ToString().Length - 1);
 | 
						||
                            sgb.GetRow(rowIndex).GetCell(j).SetCellValue(cv);
 | 
						||
                            if (tb.Rows[i][j + 15].ToString().Contains("A"))
 | 
						||
                            {
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleA;
 | 
						||
                            }
 | 
						||
                            if (tb.Rows[i][j + 15].ToString().Contains("C"))
 | 
						||
                            {
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleB;
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                       
 | 
						||
                    }
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    if ((int)((95 * (rowIndex - 1)) / totalNum) > percent)
 | 
						||
                    {
 | 
						||
                        percent = (int)(100 * (rowIndex - 1) / totalNum);
 | 
						||
                    }
 | 
						||
 | 
						||
                    rowIndex++;
 | 
						||
                }
 | 
						||
            }
 | 
						||
 | 
						||
            sgb.ForceFormulaRecalculation = true;
 | 
						||
 | 
						||
            using (FileStream filess = File.OpenWrite(ReportFileName))
 | 
						||
            {
 | 
						||
                hssfworkbook.Write(filess);
 | 
						||
                hssfworkbook.Close();
 | 
						||
                filess.Flush();
 | 
						||
                filess.Close();
 | 
						||
            }
 | 
						||
            percent = 100;
 | 
						||
            url = ReportFileName.Replace(Server.MapPath("~/"), "");
 | 
						||
        }
 | 
						||
       #endregion      
 | 
						||
 | 
						||
        #region 导出Excel
 | 
						||
        /// <summary>
 | 
						||
        /// 导出Excel
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void btnExport_Click(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            percent = 0;
 | 
						||
            url = "";
 | 
						||
            
 | 
						||
            var OverviewReport = (from x in Funs.DB.VIEW_Report_Overview orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            if (!string.IsNullOrEmpty(txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                OverviewReport = OverviewReport.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtProjectManger.Text.Trim()))
 | 
						||
            {
 | 
						||
                OverviewReport = OverviewReport.Where(x => x.ProjectControl_ProjectManager != null && x.ProjectControl_ProjectManager.ToLower().Contains(this.txtProjectManger.Text.Trim().ToLower())).ToList();
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtEngineeringManager.Text.Trim()))
 | 
						||
            {
 | 
						||
                OverviewReport = OverviewReport.Where(x => x.ProjectControl_EMManager !=null && x.ProjectControl_EMManager.ToLower().Contains(this.txtEngineeringManager.Text.Trim().ToLower())).ToList();
 | 
						||
            }
 | 
						||
            if (!string.IsNullOrEmpty(this.txtEngineer.Text.Trim()))
 | 
						||
            {
 | 
						||
                OverviewReport = OverviewReport.Where(x => x.Engineer != null && x.Engineer.ToLower().Contains(this.txtEngineer.Text.Trim().ToLower())).ToList();
 | 
						||
            }
 | 
						||
 | 
						||
 | 
						||
            var Permit_General = (from x in Funs.DB.View_Report_PermitGeneral orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                Permit_General = Permit_General.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            }
 | 
						||
 | 
						||
            var PressurePipingVesseReport = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                PressurePipingVesseReport = PressurePipingVesseReport.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            }
 | 
						||
 | 
						||
            string strSql = @"SELECT * FROM View_Report_ScheduleGanttBar WHERE 1=1 ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            {
 | 
						||
                strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
                listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            }
 | 
						||
            strSql += " order by ProjectControl_JobNo desc";
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
 | 
						||
            Thread t = new Thread(new ThreadStart(() => { Export(strSql, parameter, Permit_General, OverviewReport,  PressurePipingVesseReport); }));
 | 
						||
            t.Start();
 | 
						||
            PageContext.RegisterStartupScript("showProcessBar()");
 | 
						||
 | 
						||
            #region 暂不用
 | 
						||
            //string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
 | 
						||
            ////模板文件
 | 
						||
            //string TempletFileName = rootPath + "OverviewReport.xlsx";
 | 
						||
            ////导出文件
 | 
						||
            //string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
 | 
						||
            //if (!Directory.Exists(filePath))
 | 
						||
            //{
 | 
						||
            //    Directory.CreateDirectory(filePath);
 | 
						||
            //}
 | 
						||
            //string ReportFileName = filePath + "out.xlsx";
 | 
						||
 | 
						||
            //FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
 | 
						||
            //XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
 | 
						||
 | 
						||
            //XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //cs_content_Font.FontName = "sans-serif";//字体
 | 
						||
            //cs_content_Font.FontHeightInPoints = 10; //字体大小     
 | 
						||
 | 
						||
            //IDataFormat dataformat = hssfworkbook.CreateDataFormat();
 | 
						||
            //ICellStyle styleQfw = hssfworkbook.CreateCellStyle();
 | 
						||
            //styleQfw.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //styleQfw.Alignment = HorizontalAlignment.Right;
 | 
						||
            //styleQfw.DataFormat = dataformat.GetFormat("#,##0.00");
 | 
						||
            //styleQfw.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            //#region 背景色、字体设置
 | 
						||
            //#region 黄底
 | 
						||
            ////创建单元格样式
 | 
						||
            ////XSSFCellStyle backgroundstyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //////填充模式
 | 
						||
            ////backgroundstyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //////创建颜色
 | 
						||
            ////XSSFColor xssfcolor = new XSSFColor();
 | 
						||
            //////rbg值
 | 
						||
            ////byte[] rgbYellow = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            //////写入rgb
 | 
						||
            ////xssfcolor.SetRgb(rgbYellow);
 | 
						||
            //////设置颜色值
 | 
						||
            ////backgroundstyle.SetFillForegroundColor(xssfcolor);
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region 黄底黑字 backgroundstyle1
 | 
						||
            ////创建单元格样式
 | 
						||
            //XSSFCellStyle backgroundstyle1 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //backgroundstyle1.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfcolor1 = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbYellow1 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            ////写入rgb
 | 
						||
            //xssfcolor1.SetRgb(rgbYellow1);
 | 
						||
            ////设置颜色值
 | 
						||
            //backgroundstyle1.SetFillForegroundColor(xssfcolor1);
 | 
						||
 | 
						||
            ////创建字体
 | 
						||
            //XSSFFont red_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //red_content_Font.FontName = "sans-serif";//字体
 | 
						||
            //red_content_Font.FontHeightInPoints = 10; //字体大小   
 | 
						||
            //red_content_Font.Color = HSSFColor.Black.Index;//黑字
 | 
						||
            //backgroundstyle1.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //backgroundstyle1.Alignment = HorizontalAlignment.Center;
 | 
						||
            //backgroundstyle1.SetFont(red_content_Font);
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region 黄底红字 backgroundstyle2
 | 
						||
            ////创建单元格样式
 | 
						||
            //XSSFCellStyle backgroundstyle2 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //backgroundstyle2.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfcolor2 = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbYellow2 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            ////写入rgb
 | 
						||
            //xssfcolor2.SetRgb(rgbYellow2);
 | 
						||
            ////设置颜色值
 | 
						||
            //backgroundstyle2.SetFillForegroundColor(xssfcolor2);
 | 
						||
 | 
						||
            ////创建字体
 | 
						||
            //XSSFFont red_content_Font2 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //red_content_Font2.FontName = "sans-serif";//字体
 | 
						||
            //red_content_Font2.FontHeightInPoints = 10; //字体大小   
 | 
						||
            //red_content_Font2.Color = HSSFColor.Red.Index;//黑字
 | 
						||
            //backgroundstyle2.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //backgroundstyle2.Alignment = HorizontalAlignment.Center;
 | 
						||
            //backgroundstyle2.SetFont(red_content_Font2);
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region 红底红字 backgroundstyle3
 | 
						||
            ////创建单元格样式
 | 
						||
            //XSSFCellStyle backgroundstyle3 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //backgroundstyle3.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfcolor3 = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbRed3 = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            ////写入rgb
 | 
						||
            //xssfcolor3.SetRgb(rgbRed3);
 | 
						||
            ////设置颜色值
 | 
						||
            //backgroundstyle3.SetFillForegroundColor(xssfcolor3);
 | 
						||
 | 
						||
            /////创建字体
 | 
						||
            //XSSFFont red_content_Font3 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //red_content_Font3.FontName = "sans-serif";//字体
 | 
						||
            //red_content_Font3.FontHeightInPoints = 10; //字体大小   
 | 
						||
            //red_content_Font3.Color = HSSFColor.Red.Index;
 | 
						||
            //backgroundstyle3.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //backgroundstyle3.Alignment = HorizontalAlignment.Center;
 | 
						||
            //backgroundstyle3.SetFont(red_content_Font3);
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region 白底红字 backgroundstyle4
 | 
						||
            ////创建单元格样式
 | 
						||
            //XSSFCellStyle backgroundstyle4 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //backgroundstyle4.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfcolor4 = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbWhite = { (byte)255, (byte)255, (byte)255 };//白色
 | 
						||
            //                                                      //写入rgb
 | 
						||
            //xssfcolor4.SetRgb(rgbWhite);
 | 
						||
            ////设置颜色值
 | 
						||
            //backgroundstyle4.SetFillForegroundColor(xssfcolor4);
 | 
						||
 | 
						||
            /////创建字体
 | 
						||
            //XSSFFont red_content_Font4 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //red_content_Font4.FontName = "sans-serif";//字体
 | 
						||
            //red_content_Font4.FontHeightInPoints = 10; //字体大小   
 | 
						||
            //red_content_Font4.Color = HSSFColor.Red.Index;
 | 
						||
            //backgroundstyle4.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //backgroundstyle4.Alignment = HorizontalAlignment.Center;
 | 
						||
            //backgroundstyle4.SetFont(red_content_Font4);
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region 红底
 | 
						||
            ////创建单元格样式
 | 
						||
            //XSSFCellStyle redbackgroundstyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //redbackgroundstyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfredcolor = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbRed = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            ////写入rgb
 | 
						||
            //xssfredcolor.SetRgb(rgbRed);
 | 
						||
            ////设置颜色值
 | 
						||
            //redbackgroundstyle.SetFillForegroundColor(xssfredcolor);
 | 
						||
            //#endregion
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region Overview
 | 
						||
            //XSSFSheet overview = (XSSFSheet)hssfworkbook.GetSheet("Overview");
 | 
						||
            //var OverviewReport = (from x in Funs.DB.VIEW_Report_Overview orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            //if (!string.IsNullOrEmpty(txtJobNo.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    OverviewReport = OverviewReport.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtProjectManger.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    OverviewReport = OverviewReport.Where(x => x.ProjectControl_ProjectManager.Contains(this.txtProjectManger.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtEngineeringManager.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    OverviewReport = OverviewReport.Where(x => x.ProjectControl_EMManager.Contains(this.txtEngineeringManager.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtEngineer.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    OverviewReport = OverviewReport.Where(x => x.Engineer.Contains(this.txtEngineer.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (OverviewReport.Count > 0)
 | 
						||
            //{
 | 
						||
            //    var rowIndex = 1;
 | 
						||
            //    foreach (var itemOver in OverviewReport)
 | 
						||
            //    {
 | 
						||
            //        if (overview.GetRow(rowIndex) == null) overview.CreateRow(rowIndex);
 | 
						||
 | 
						||
            //        #region 列赋值
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(0) == null) overview.GetRow(rowIndex).CreateCell(0);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_BUCode);
 | 
						||
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(1) == null) overview.GetRow(rowIndex).CreateCell(1);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_JobNo);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(2) == null) overview.GetRow(rowIndex).CreateCell(2);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_JobType);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(3) == null) overview.GetRow(rowIndex).CreateCell(3);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_LeadByName);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(4) == null) overview.GetRow(rowIndex).CreateCell(4);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.ProjectControl_JobTitle);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(5) == null) overview.GetRow(rowIndex).CreateCell(5);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.ProjectControl_OrginalBudget != null ? (double)itemOver.ProjectControl_OrginalBudget.Value : 0);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(5).CellStyle = styleQfw;
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(6) == null) overview.GetRow(rowIndex).CreateCell(6);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ProjectControl_ProjectManager);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(7) == null) overview.GetRow(rowIndex).CreateCell(7);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.ProjectControl_ConstManager);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(8) == null) overview.GetRow(rowIndex).CreateCell(8);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.ProjectControl_EMManager);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(9) == null) overview.GetRow(rowIndex).CreateCell(9);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(9).SetCellValue(itemOver.PM_MA_ProjectApproval);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(10) == null) overview.GetRow(rowIndex).CreateCell(10);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(10).SetCellValue(itemOver.ProjectControl_MS_MC);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(11) == null) overview.GetRow(rowIndex).CreateCell(11);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(11).SetCellValue(itemOver.MCRevised);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(12) == null) overview.GetRow(rowIndex).CreateCell(12);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(12).SetCellValue(itemOver.PM_General_Priority);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(13) == null) overview.GetRow(rowIndex).CreateCell(13);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(13).SetCellValue(itemOver.PM_General_Category);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(14) == null) overview.GetRow(rowIndex).CreateCell(14);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(14).SetCellValue(itemOver.ProjectControl_JobStatus);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(15) == null) overview.GetRow(rowIndex).CreateCell(15);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(15).SetCellValue(itemOver.Schedule);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(16) == null) overview.GetRow(rowIndex).CreateCell(16);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(16).SetCellValue(itemOver.Cost);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(17) == null) overview.GetRow(rowIndex).CreateCell(17);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(17).SetCellValue(itemOver.Scope);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(18) == null) overview.GetRow(rowIndex).CreateCell(18);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(18).SetCellValue(itemOver.PM_MA_JobReveive);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(19) == null) overview.GetRow(rowIndex).CreateCell(19);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(19).SetCellValue(itemOver.EstimatedFinalCost != null ? (double)itemOver.EstimatedFinalCost.Value : 0);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(19).CellStyle = styleQfw;
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(20) == null) overview.GetRow(rowIndex).CreateCell(20);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(20).SetCellValue(itemOver.MCActual);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(21) == null) overview.GetRow(rowIndex).CreateCell(21);
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.MC_Signed))
 | 
						||
            //        {
 | 
						||
            //            overview.GetRow(rowIndex).GetCell(21).SetCellValue(itemOver.MC_Signed);
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(21).SetCellValue("N/A");
 | 
						||
            //            }
 | 
						||
            //            else
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(21).SetCellValue("");
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(22) == null) overview.GetRow(rowIndex).CreateCell(22);
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.RFSU))
 | 
						||
            //        {
 | 
						||
            //            overview.GetRow(rowIndex).GetCell(22).SetCellValue(itemOver.RFSU);
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(22).SetCellValue("N/A");
 | 
						||
            //            }
 | 
						||
            //            else
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(22).SetCellValue("");
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(23) == null) overview.GetRow(rowIndex).CreateCell(23);
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.Punch_C_Killed))
 | 
						||
            //        {
 | 
						||
            //            overview.GetRow(rowIndex).GetCell(23).SetCellValue(itemOver.Punch_C_Killed);
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(23).SetCellValue("N/A");
 | 
						||
            //            }
 | 
						||
            //            else
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(23).SetCellValue("");
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(24) == null) overview.GetRow(rowIndex).CreateCell(24);
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
            //        {
 | 
						||
            //            overview.GetRow(rowIndex).GetCell(24).SetCellValue(itemOver.FC_Signed);
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            if (itemOver.ProjectControl_JobType == "Projects" && itemOver.ProjectControl_OrginalBudget >= 1000000 && !string.IsNullOrEmpty(itemOver.PM_MA_ProjectApproval))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(24).SetCellValue("");
 | 
						||
            //            }
 | 
						||
            //            else
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(24).SetCellValue("N/A");
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(25) == null) overview.GetRow(rowIndex).CreateCell(25);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(25).SetCellValue(itemOver.ProjectControl_BC_CloseDate);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(26) == null) overview.GetRow(rowIndex).CreateCell(26);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(26).SetCellValue(itemOver.IFC_Received);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(27) == null) overview.GetRow(rowIndex).CreateCell(27);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(27).SetCellValue(itemOver.As_built_Received);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(28) == null) overview.GetRow(rowIndex).CreateCell(28);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(28).SetCellValue(itemOver.MD_Received);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(29) == null) overview.GetRow(rowIndex).CreateCell(29);
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.Date_of_Registeration))
 | 
						||
            //        {
 | 
						||
            //            overview.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.Date_of_Registeration);
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            if (itemOver.ProjectControl_JobType == "Other")
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(29).SetCellValue("N/A");
 | 
						||
            //            }
 | 
						||
            //            else
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(29).SetCellValue("");
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(30) == null) overview.GetRow(rowIndex).CreateCell(30);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.ProjectControl_CostEffectvitity);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(31) == null) overview.GetRow(rowIndex).CreateCell(31);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(31).SetCellValue(itemOver.ProjectControl_PVIPrediction.HasValue ? Math.Round(Convert.ToDouble(itemOver.ProjectControl_PVIPrediction), 2) : 0);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(32) == null) overview.GetRow(rowIndex).CreateCell(32);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(32).SetCellValue(itemOver.ProjectControl_PC_CancelDate);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(33) == null) overview.GetRow(rowIndex).CreateCell(33);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(33).SetCellValue(itemOver.ProjectControl_Account);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(34) == null) overview.GetRow(rowIndex).CreateCell(34);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(34).SetCellValue(itemOver.ProjectControl_NetworkNo);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(35) == null) overview.GetRow(rowIndex).CreateCell(35);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(35).SetCellValue(itemOver.StudyWo);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(36) == null) overview.GetRow(rowIndex).CreateCell(36);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(36).SetCellValue(itemOver.CTEInvolved);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(37) == null) overview.GetRow(rowIndex).CreateCell(37);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(37).SetCellValue(itemOver.CAPEXPlanNo);
 | 
						||
 | 
						||
            //        if (overview.GetRow(rowIndex).GetCell(38) == null) overview.GetRow(rowIndex).CreateCell(38);
 | 
						||
            //        overview.GetRow(rowIndex).GetCell(38).SetCellValue(itemOver.PM_General_CDI);
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        #region 填充背景色
 | 
						||
            //        //超出计划MC6个月,仍未有实际MC日期(MC Actual)
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_MC))
 | 
						||
            //        {
 | 
						||
            //            if (Funs.GetNewDateTime(itemOver.ProjectControl_MS_MC).Value.AddMonths(6) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(20).CellStyle = redbackgroundstyle;
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        //超出实际MC10天,仍未签MC证书(MC Signed)
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
            //        {
 | 
						||
            //            if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(10) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.MC_Signed))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(21).CellStyle = redbackgroundstyle;
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        //超出实际MC90天,仍未签FC证书(FC Signed)
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
            //        {
 | 
						||
            //            if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(90) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(22).CellStyle = redbackgroundstyle;
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        //超出FC180天,仍未商务关闭的(Business Closed)
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
            //        {
 | 
						||
            //            if (Funs.GetNewDateTime(itemOver.FC_Signed).Value.AddDays(180) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(23).CellStyle = redbackgroundstyle;
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        //超出实际MC90天,仍未收到AB的(As-built Received)
 | 
						||
            //        if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
            //        {
 | 
						||
            //            if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(90) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) &&string.IsNullOrEmpty(itemOver.As_built_Received))
 | 
						||
            //            {
 | 
						||
            //                overview.GetRow(rowIndex).GetCell(25).CellStyle = redbackgroundstyle;
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        #endregion
 | 
						||
            //        rowIndex++;
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region Permit_General
 | 
						||
            //XSSFSheet pg = (XSSFSheet)hssfworkbook.GetSheet("Permit_General");
 | 
						||
            //var Permit_General = (from x in Funs.DB.View_Report_PermitGeneral orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    Permit_General = Permit_General.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (Permit_General.Count > 0)
 | 
						||
            //{
 | 
						||
            //    var rowIndex = 1;
 | 
						||
            //    foreach (var item in Permit_General)
 | 
						||
            //    {
 | 
						||
            //        if (pg.GetRow(rowIndex) == null) pg.CreateRow(rowIndex);
 | 
						||
 | 
						||
            //        #region 列赋值
 | 
						||
            //        if (item.PType == "计划")
 | 
						||
            //        {
 | 
						||
            //            if (pg.GetRow(rowIndex).GetCell(0) == null) pg.GetRow(rowIndex).CreateCell(0);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(0).SetCellValue(item.ProjectControl_JobNo);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(0).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(0).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //            if (pg.GetRow(rowIndex).GetCell(1) == null) pg.GetRow(rowIndex).CreateCell(1);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(1).SetCellValue(item.ProjectControl_JobTitle);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            //            if (pg.GetRow(rowIndex).GetCell(2) == null) pg.GetRow(rowIndex).CreateCell(2);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(2).SetCellValue(item.ProjectControl_ProjectManager);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(2).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(2).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
            //        }
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(3) == null) pg.GetRow(rowIndex).CreateCell(3);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(3).SetCellValue(item.PType);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(3).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(3).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(4) == null) pg.GetRow(rowIndex).CreateCell(4);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(4).SetCellValue(item.EnvAssess);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(4).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(4).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(5) == null) pg.GetRow(rowIndex).CreateCell(5);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(5).SetCellValue(item.EnergySaving);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(5).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(5).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(5).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(6) == null) pg.GetRow(rowIndex).CreateCell(6);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(6).SetCellValue(item.ProjectRegistr);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(6).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(6).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(6).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(7) == null) pg.GetRow(rowIndex).CreateCell(7);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(7).SetCellValue(item.PlanningPermit);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(7).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(7).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(7).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(8) == null) pg.GetRow(rowIndex).CreateCell(8);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(8).SetCellValue(item.SafetyConReview);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(8).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(8).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(8).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(9) == null) pg.GetRow(rowIndex).CreateCell(9);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(9).SetCellValue(item.SafetyDesginReview);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(9).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(9).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(9).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(10) == null) pg.GetRow(rowIndex).CreateCell(10);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(10).SetCellValue(item.FFDesginReview);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(10).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(10).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(10).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(11) == null) pg.GetRow(rowIndex).CreateCell(11);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(11).SetCellValue(item.ConstPermit);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(11).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(11).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(11).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(12) == null) pg.GetRow(rowIndex).CreateCell(12);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(12).SetCellValue(item.CMStart);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(12).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(12).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(12).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(13) == null) pg.GetRow(rowIndex).CreateCell(13);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(13).SetCellValue(item.MC);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(13).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(13).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(13).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(14) == null) pg.GetRow(rowIndex).CreateCell(14);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(14).SetCellValue(item.SafetyFinalAcc);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(14).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(14).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(14).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(15) == null) pg.GetRow(rowIndex).CreateCell(15);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(15).SetCellValue(item.FFFinalAcc);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(15).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(15).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(15).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(16) == null) pg.GetRow(rowIndex).CreateCell(16);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(16).SetCellValue(item.Usin);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(16).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(16).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(16).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (pg.GetRow(rowIndex).GetCell(17) == null) pg.GetRow(rowIndex).CreateCell(17);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(17).SetCellValue(item.EnvFinalAcc);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(17).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(17).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        pg.GetRow(rowIndex).GetCell(17).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        #region 填充背景色
 | 
						||
            //        if (item.PType == "计划")
 | 
						||
            //        {
 | 
						||
            //            #region 设置计划行背景色
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(0).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(1).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(2).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(3).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;
 | 
						||
            //            pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;
 | 
						||
            //            #endregion
 | 
						||
            //            #region 如果距计划日期还有超过一个月的时间,则计划日期显示黄底黑字
 | 
						||
            //            if (item.EnvAssess != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnvAssess))//环评
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.EnergySaving != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnergySaving))//节能报告
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.ProjectRegistr != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.ProjectRegistr))//项目备案
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.PlanningPermit != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PlanningPermit))//规划许可
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.SafetyConReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyConReview))//安全条件审查
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.SafetyDesginReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyDesginReview))//安全设施设计审查
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.FFDesginReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.FFDesginReview))//消防设计审查
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.ConstPermit != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.ConstPermit))//施工许可
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            //if (item.CMStart != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.CMStart))//施工开始
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;
 | 
						||
            //            //}
 | 
						||
            //            //if (item.MC != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.MC))//机械竣工
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;
 | 
						||
            //            //}
 | 
						||
            //            if (item.SafetyFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyFinalAcc))//安全设施竣工验收
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.FFFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.FFFinalAcc))//消防设施竣工验收
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            //if (item.Usin != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.Usin))//投用
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;
 | 
						||
            //            //}
 | 
						||
            //            if (item.EnvFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnvFinalAcc))//环保设施竣工验收
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region  如果下月须完成,则显示黄底红字
 | 
						||
            //            if (item.EnvAssess != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnvAssess).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnvAssess).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle2;//环评
 | 
						||
            //            }
 | 
						||
            //            if (item.EnergySaving != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnergySaving).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnergySaving).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle2;//节能报告
 | 
						||
            //            }
 | 
						||
            //            if (item.ProjectRegistr != "-" && DateTime.Now.Year == Convert.ToDateTime(item.ProjectRegistr).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.ProjectRegistr).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle2;//项目备案
 | 
						||
            //            }
 | 
						||
            //            if (item.PlanningPermit != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PlanningPermit).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PlanningPermit).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle2;//规划许可
 | 
						||
            //            }
 | 
						||
            //            if (item.SafetyConReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyConReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyConReview).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle2;//安全条件审查
 | 
						||
            //            }
 | 
						||
            //            if (item.SafetyDesginReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyDesginReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyDesginReview).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle2;//安全设施设计审查
 | 
						||
            //            }
 | 
						||
            //            if (item.FFDesginReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.FFDesginReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.FFDesginReview).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle2;//消防设计审查
 | 
						||
            //            }
 | 
						||
            //            if (item.ConstPermit != "-" && DateTime.Now.Year == Convert.ToDateTime(item.ConstPermit).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.ConstPermit).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle2;//施工许可
 | 
						||
            //            }
 | 
						||
            //            //if (item.CMStart != "-" && DateTime.Now.Year == Convert.ToDateTime(item.CMStart).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.CMStart).Month)
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle2;//施工开始
 | 
						||
            //            //}
 | 
						||
            //            //if (item.MC != "-" && DateTime.Now.Year == Convert.ToDateTime(item.MC).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.MC).Month)
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle2;//机械竣工
 | 
						||
            //            //}
 | 
						||
            //            if (item.SafetyFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyFinalAcc).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle2;//安全设施竣工验收
 | 
						||
            //            }
 | 
						||
            //            if (item.FFFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.FFFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.FFFinalAcc).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle2;//消防设施竣工验收
 | 
						||
            //            }
 | 
						||
            //            //if (item.Usin != "-" && DateTime.Now.Year == Convert.ToDateTime(item.Usin).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.Usin).Month)
 | 
						||
            //            //{
 | 
						||
            //            //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle2;//投用
 | 
						||
            //            //}
 | 
						||
            //            if (item.EnvFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnvFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnvFinalAcc).Month)
 | 
						||
            //            {
 | 
						||
            //                pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle2;//环保设施竣工验收
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region 如果已过计划日期一个月,但还未完成,则显示红底红字 
 | 
						||
            //            var actual = (from x in Funs.DB.View_Report_PermitGeneral where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "实际" select x).FirstOrDefault();
 | 
						||
            //            if (actual != null)
 | 
						||
            //            {
 | 
						||
            //                if (item.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess).AddMonths(1) < DateTime.Now)//环评
 | 
						||
            //                {
 | 
						||
            //                    if (actual.EnvAssess == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.EnergySaving != "-" && Convert.ToDateTime(item.EnergySaving).AddMonths(1) < DateTime.Now)//节能报告
 | 
						||
            //                {
 | 
						||
            //                    if (actual.EnergySaving == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.ProjectRegistr != "-" && Convert.ToDateTime(item.ProjectRegistr).AddMonths(1) < DateTime.Now)//项目备案
 | 
						||
            //                {
 | 
						||
            //                    if (actual.ProjectRegistr == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.PlanningPermit != "-" && Convert.ToDateTime(item.PlanningPermit).AddMonths(1) < DateTime.Now)//规划许可
 | 
						||
            //                {
 | 
						||
            //                    if (actual.PlanningPermit == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.SafetyConReview != "-" && Convert.ToDateTime(item.SafetyConReview).AddMonths(1) < DateTime.Now)//安全条件审查
 | 
						||
            //                {
 | 
						||
            //                    if (actual.SafetyConReview == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.SafetyDesginReview != "-" && Convert.ToDateTime(item.SafetyDesginReview).AddMonths(1) < DateTime.Now)//安全设施设计审查
 | 
						||
            //                {
 | 
						||
            //                    if (actual.SafetyDesginReview == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.FFDesginReview != "-" && Convert.ToDateTime(item.FFDesginReview).AddMonths(1) < DateTime.Now)//消防设计审查
 | 
						||
            //                {
 | 
						||
            //                    if (actual.FFDesginReview == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.ConstPermit != "-" && Convert.ToDateTime(item.ConstPermit).AddMonths(1) < DateTime.Now)//施工许可
 | 
						||
            //                {
 | 
						||
            //                    if (actual.ConstPermit == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                //if (item.CMStart != "-" && Convert.ToDateTime(item.CMStart).AddMonths(1) < DateTime.Now )//施工开始
 | 
						||
            //                //{
 | 
						||
            //                //    if (actual.CMStart == "-")
 | 
						||
            //                //    {
 | 
						||
            //                //        pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle3;
 | 
						||
            //                //    }
 | 
						||
            //                //}
 | 
						||
            //                //if (item.MC != "-" && Convert.ToDateTime(item.MC).AddMonths(1) < DateTime.Now )//机械竣工
 | 
						||
            //                //{
 | 
						||
            //                //    if (actual.MC == "-")
 | 
						||
            //                //    {
 | 
						||
            //                //        pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle3;
 | 
						||
            //                //    }
 | 
						||
            //                //}
 | 
						||
            //                if (item.SafetyFinalAcc != "-" && Convert.ToDateTime(item.SafetyFinalAcc).AddMonths(1) < DateTime.Now)//安全设施竣工验收
 | 
						||
            //                {
 | 
						||
            //                    if (actual.SafetyFinalAcc == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.FFFinalAcc != "-" && Convert.ToDateTime(item.FFFinalAcc).AddMonths(1) < DateTime.Now)//消防设施竣工验收
 | 
						||
            //                {
 | 
						||
            //                    if (actual.FFFinalAcc == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                //if (item.Usin != "-" && Convert.ToDateTime(item.Usin).AddMonths(1) < DateTime.Now)//投用
 | 
						||
            //                //{
 | 
						||
            //                //    if (actual.Usin == "-")
 | 
						||
            //                //    {
 | 
						||
            //                //        pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle3;
 | 
						||
            //                //    }
 | 
						||
            //                //}
 | 
						||
            //                if (item.EnvFinalAcc != "-" && Convert.ToDateTime(item.EnvFinalAcc).AddMonths(1) < DateTime.Now)//环保设施竣工验收
 | 
						||
            //                {
 | 
						||
            //                    if (actual.EnvFinalAcc == "-")
 | 
						||
            //                    {
 | 
						||
            //                        pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region 一旦实际日期栏填入数据,则计划日期恢复成黄底黑字
 | 
						||
            //            var eproject = BLL.EProjectService.GeteProjectByJobNO(item.ProjectControl_JobNo);
 | 
						||
            //            if (eproject != null)
 | 
						||
            //            {
 | 
						||
            //                if (eproject.Permit_PPA_EnvAssess.HasValue && item.EnvAssess != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;//环评
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_EnergySaving.HasValue && item.EnergySaving != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;//节能报告
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_ProjectRegistration.HasValue && item.ProjectRegistr != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;//项目备案
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_PlanningPermit.HasValue && item.PlanningPermit != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;//规划许可
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_SafetyConRev.HasValue && item.SafetyConReview != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;//安全条件审查
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_SafetyDesignRev.HasValue && item.SafetyDesginReview != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;//安全设施设计审查
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PPA_FFDesignReview.HasValue && item.FFDesginReview != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;//消防设计审查
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PA_ConstPermit.HasValue && item.ConstPermit != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;//施工许可
 | 
						||
            //                }
 | 
						||
            //                //if (eproject.Permit_PA_ConstPermit.HasValue&&item.CMStart!="-")
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;//施工开始
 | 
						||
            //                //}
 | 
						||
            //                //if (eproject.CM_MA_MC.HasValue && item.MC != "-")
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;//机械竣工
 | 
						||
            //                //}
 | 
						||
            //                if (eproject.Permit_PA_SafetyFinalACC.HasValue && item.SafetyFinalAcc != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;//安全设施竣工验收
 | 
						||
            //                }
 | 
						||
            //                if (eproject.Permit_PA_FFFinalACC.HasValue && item.FFFinalAcc != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;//消防设施竣工验收
 | 
						||
            //                }
 | 
						||
            //                //if (eproject.CM_MA_MC.HasValue && item.Usin != "-")
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;//投用
 | 
						||
            //                //}
 | 
						||
            //                if (eproject.Permit_PA_EnvFinalACC.HasValue && item.EnvFinalAcc != "-")
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;//环保设施竣工验收
 | 
						||
            //                }
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //        }
 | 
						||
            //        if (item.PType == "实际")
 | 
						||
            //        {
 | 
						||
            //            var plan = (from x in Funs.DB.View_Report_PermitGeneral where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "计划" select x).FirstOrDefault();
 | 
						||
            //            if (plan != null)
 | 
						||
            //            {
 | 
						||
            //                //如果提前或按时完成,则显示白底黑字
 | 
						||
            //                //if (!string.IsNullOrEmpty(item.EnvAssess) && !string.IsNullOrEmpty(plan.EnvAssess) && item.EnvAssess != "-" && plan.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess) <= Convert.ToDateTime(plan.EnvAssess))
 | 
						||
            //                //{
 | 
						||
 | 
						||
            //                //}
 | 
						||
            //                #region 如果是在计划日期后完成,则显示白底红字
 | 
						||
            //                if (plan.EnvAssess != "-" && item.EnvAssess != "-" && Convert.ToDateTime(plan.EnvAssess) < Convert.ToDateTime(item.EnvAssess))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle4;//环评
 | 
						||
            //                }
 | 
						||
            //                if (plan.EnergySaving != "-" && item.EnergySaving != "-" && Convert.ToDateTime(plan.EnergySaving) < Convert.ToDateTime(item.EnergySaving))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle4;//节能报告
 | 
						||
            //                }
 | 
						||
            //                if (plan.ProjectRegistr != "-" && item.ProjectRegistr != "-" && Convert.ToDateTime(plan.ProjectRegistr) < Convert.ToDateTime(item.ProjectRegistr))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle4;//项目备案
 | 
						||
            //                }
 | 
						||
            //                if (plan.PlanningPermit != "-" && item.PlanningPermit != "-" && Convert.ToDateTime(plan.PlanningPermit) < Convert.ToDateTime(item.PlanningPermit))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle4;//规划许可
 | 
						||
            //                }
 | 
						||
            //                if (plan.SafetyConReview != "-" && item.SafetyConReview != "-" && Convert.ToDateTime(plan.SafetyConReview) < Convert.ToDateTime(item.SafetyConReview))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle4;//安全条件审查
 | 
						||
            //                }
 | 
						||
            //                if (plan.SafetyDesginReview != "-" && item.SafetyDesginReview != "-" && Convert.ToDateTime(plan.SafetyDesginReview) < Convert.ToDateTime(item.SafetyDesginReview))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle4;//安全设施设计审查
 | 
						||
            //                }
 | 
						||
            //                if (plan.FFDesginReview != "-" && item.FFDesginReview != "-" && Convert.ToDateTime(plan.FFDesginReview) < Convert.ToDateTime(item.FFDesginReview))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle4;//消防设计审查
 | 
						||
            //                }
 | 
						||
            //                if (plan.ConstPermit != "-" && item.ConstPermit != "-" && Convert.ToDateTime(plan.ConstPermit) < Convert.ToDateTime(item.ConstPermit))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle4;//施工许可
 | 
						||
            //                }
 | 
						||
            //                //if (plan.CMStart != "-" && item.CMStart != "-" && Convert.ToDateTime(plan.CMStart) < Convert.ToDateTime(item.CMStart))
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle4;//施工开始
 | 
						||
            //                //}
 | 
						||
            //                //if (plan.MC != "-" && item.MC != "-" && Convert.ToDateTime(plan.MC) < Convert.ToDateTime(item.MC))
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle4;//机械竣工
 | 
						||
            //                //}
 | 
						||
            //                if (plan.SafetyFinalAcc != "-" && item.SafetyFinalAcc != "-" && Convert.ToDateTime(plan.SafetyFinalAcc) < Convert.ToDateTime(item.SafetyFinalAcc))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle4;//安全设施竣工验收
 | 
						||
            //                }
 | 
						||
            //                if (plan.FFFinalAcc != "-" && item.FFFinalAcc != "-" && Convert.ToDateTime(plan.FFFinalAcc) < Convert.ToDateTime(item.FFFinalAcc))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle4;//消防设施竣工验收
 | 
						||
            //                }
 | 
						||
            //                //if (plan.Usin != "-" && item.Usin != "-" && Convert.ToDateTime(plan.Usin) < Convert.ToDateTime(item.Usin))
 | 
						||
            //                //{
 | 
						||
            //                //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle4;//投用
 | 
						||
            //                //}
 | 
						||
            //                if (plan.EnvFinalAcc != "-" && item.EnvFinalAcc != "-" && Convert.ToDateTime(plan.EnvFinalAcc) < Convert.ToDateTime(item.EnvFinalAcc))
 | 
						||
            //                {
 | 
						||
            //                    pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle4;//环保设施竣工验收
 | 
						||
            //                }
 | 
						||
            //                #endregion
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        rowIndex++;
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region Permit_Pressure Piping & Vesse
 | 
						||
            //XSSFSheet ppv = (XSSFSheet)hssfworkbook.GetSheet("Permit_Pressure Piping & Vesse");
 | 
						||
            //var PressurePipingVesseReport = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse orderby x.ProjectControl_JobNo descending select x).ToList();
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    PressurePipingVesseReport = PressurePipingVesseReport.Where(x => x.ProjectControl_JobNo.StartsWith(this.txtJobNo.Text.Trim())).ToList();
 | 
						||
            //}
 | 
						||
            //if (PressurePipingVesseReport.Count > 0)
 | 
						||
            //{
 | 
						||
            //    var rowIndex = 1;
 | 
						||
            //    foreach (var item in PressurePipingVesseReport)
 | 
						||
            //    {
 | 
						||
            //        if (ppv.GetRow(rowIndex) == null) ppv.CreateRow(rowIndex);
 | 
						||
 | 
						||
            //        #region 列赋值
 | 
						||
            //        if (item.PType == "计划")
 | 
						||
            //        {
 | 
						||
            //            if (ppv.GetRow(rowIndex).GetCell(0) == null) ppv.GetRow(rowIndex).CreateCell(0);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(0).SetCellValue(item.ProjectControl_JobNo);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(0).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(0).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //            if (ppv.GetRow(rowIndex).GetCell(1) == null) ppv.GetRow(rowIndex).CreateCell(1);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(1).SetCellValue(item.ProjectControl_JobTitle);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            //            if (ppv.GetRow(rowIndex).GetCell(2) == null) ppv.GetRow(rowIndex).CreateCell(2);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(2).SetCellValue(item.ProjectControl_ProjectManager);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(2).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(2).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        }
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(3) == null) ppv.GetRow(rowIndex).CreateCell(3);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(3).SetCellValue(item.PType);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(3).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(3).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(4) == null) ppv.GetRow(rowIndex).CreateCell(4);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(4).SetCellValue(item.PressurePiping);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(4).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(4).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(5) == null) ppv.GetRow(rowIndex).CreateCell(5);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(5).SetCellValue(item.PressureVessel);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(5).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(5).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(5).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(6) == null) ppv.GetRow(rowIndex).CreateCell(6);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(6).SetCellValue(item.SQIB);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(6).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(6).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(6).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(7) == null) ppv.GetRow(rowIndex).CreateCell(7);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(7).SetCellValue(item.ArchiveAccep);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(7).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(7).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(7).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        if (ppv.GetRow(rowIndex).GetCell(8) == null) ppv.GetRow(rowIndex).CreateCell(8);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(8).SetCellValue(item.ThrdConstJian);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(8).CellStyle.SetFont(cs_content_Font);
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(8).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        ppv.GetRow(rowIndex).GetCell(8).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        #region 填充背景色
 | 
						||
            //        if (item.PType == "计划")
 | 
						||
            //        {
 | 
						||
            //            #region 设置计划行背景色
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(0).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(1).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(2).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(3).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
            //            ppv.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
            //            #endregion
 | 
						||
            //            #region 如果距计划日期还有超过一个月的时间,则计划日期显示黄底黑字
 | 
						||
            //            if (item.PressurePiping != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PressurePiping))//压力管道
 | 
						||
            //            {
 | 
						||
            //                ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            if (item.PressureVessel != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PressureVessel))//压力容器
 | 
						||
            //            {
 | 
						||
            //                ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region  如果下月须完成,则显示黄底红字
 | 
						||
            //            if (item.PressurePiping != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PressurePiping).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PressurePiping).Month)
 | 
						||
            //            {
 | 
						||
            //                ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle2;//压力管道
 | 
						||
            //            }
 | 
						||
            //            if (item.PressureVessel != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PressureVessel).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PressureVessel).Month)
 | 
						||
            //            {
 | 
						||
            //                ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle2;//压力容器
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region 如果已过计划日期一个月,但还未完成,则显示红底红字 
 | 
						||
            //            var actual = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "实际" select x).FirstOrDefault();
 | 
						||
            //            if (actual != null)
 | 
						||
            //            {
 | 
						||
            //                if (item.PressurePiping != "-" && Convert.ToDateTime(item.PressurePiping).AddMonths(1) < DateTime.Now)//压力管道
 | 
						||
            //                {
 | 
						||
            //                    if (actual.PressurePiping == "-")
 | 
						||
            //                    {
 | 
						||
            //                        ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //                if (item.PressureVessel != "-" && Convert.ToDateTime(item.PressureVessel).AddMonths(1) < DateTime.Now)//压力容器
 | 
						||
            //                {
 | 
						||
            //                    if (actual.PressureVessel == "-")
 | 
						||
            //                    {
 | 
						||
            //                        ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle3;
 | 
						||
            //                    }
 | 
						||
            //                }
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //            #region 一旦实际日期栏填入数据,则计划日期恢复成黄底黑字
 | 
						||
            //            var eproject = BLL.EProjectService.GeteProjectByJobNO(item.ProjectControl_JobNo);
 | 
						||
            //            if (eproject != null)
 | 
						||
            //            {
 | 
						||
            //                if (eproject.SQIB_PressurePiping.HasValue && item.PressurePiping != "-")
 | 
						||
            //                {
 | 
						||
            //                    ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;//压力管道
 | 
						||
            //                }
 | 
						||
            //                if (eproject.SQIB_PressureVessel.HasValue && item.PressureVessel != "-")
 | 
						||
            //                {
 | 
						||
            //                    ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;//压力容器
 | 
						||
            //                }
 | 
						||
            //            }
 | 
						||
            //            #endregion
 | 
						||
            //        }
 | 
						||
            //        if (item.PType == "实际")
 | 
						||
            //        {
 | 
						||
            //            var plan = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "计划" select x).FirstOrDefault();
 | 
						||
            //            if (plan != null)
 | 
						||
            //            {
 | 
						||
            //                //如果提前或按时完成,则显示白底黑字
 | 
						||
            //                //if (!string.IsNullOrEmpty(item.EnvAssess) && !string.IsNullOrEmpty(plan.EnvAssess) && item.EnvAssess != "-" && plan.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess) <= Convert.ToDateTime(plan.EnvAssess))
 | 
						||
            //                //{
 | 
						||
 | 
						||
            //                //}
 | 
						||
            //                #region 如果是在计划日期后完成,则显示白底红字
 | 
						||
            //                if (plan.PressurePiping != "-" && item.PressurePiping != "-" && Convert.ToDateTime(plan.PressurePiping) < Convert.ToDateTime(item.PressurePiping))
 | 
						||
            //                {
 | 
						||
            //                    ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle4;//压力管道
 | 
						||
            //                }
 | 
						||
            //                if (plan.PressureVessel != "-" && item.PressureVessel != "-" && Convert.ToDateTime(plan.PressureVessel) < Convert.ToDateTime(item.PressureVessel))
 | 
						||
            //                {
 | 
						||
            //                    ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle4;//压力容器
 | 
						||
            //                }
 | 
						||
            //                #endregion
 | 
						||
            //            }
 | 
						||
            //        }
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        rowIndex++;
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
            //#endregion
 | 
						||
 | 
						||
            //#region Schedule_Gantt_Bar
 | 
						||
            //XSSFSheet sgb = (XSSFSheet)hssfworkbook.GetSheet("Schedule_Gantt_Bar");
 | 
						||
            //string strSql = @"SELECT * FROM View_Report_ScheduleGanttBar WHERE 1=1 ";
 | 
						||
            //List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            //if (!string.IsNullOrEmpty(this.txtJobNo.Text.Trim()))
 | 
						||
            //{
 | 
						||
            //    strSql += " AND ProjectControl_JobNo LIKE @JobNO ";
 | 
						||
            //    listStr.Add(new SqlParameter("@JobNO", this.txtJobNo.Text.Trim() + "%"));
 | 
						||
            //}
 | 
						||
            //strSql += " order by ProjectControl_JobNo desc";
 | 
						||
            //SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            //DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
 | 
						||
            //GregorianCalendar gc = new GregorianCalendar();
 | 
						||
            //for (int i = -3; i < 2; i++)
 | 
						||
            //{
 | 
						||
            //    DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
            //    for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
            //    {
 | 
						||
            //        tb.Columns.Add(dateTime.Year + "-" + j, System.Type.GetType("System.String"));
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
 | 
						||
            //for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
            //{
 | 
						||
            //    try
 | 
						||
            //    {
 | 
						||
            //        var ReceiveDate = tb.Rows[i]["ReceiveDate"];
 | 
						||
            //        var ApprovalDate = tb.Rows[i]["ApprovalDate"];
 | 
						||
            //        var ConstStart = tb.Rows[i]["ConstMECivilStart"];
 | 
						||
            //        var DEMEEnd = tb.Rows[i]["DEMECivilEnd"];
 | 
						||
            //        var ConstEnd = tb.Rows[i]["ConstMECivilEnd"];
 | 
						||
            //        if (ReceiveDate is DateTime && ApprovalDate is DateTime)
 | 
						||
            //        {
 | 
						||
            //            DateTime start = (DateTime)ReceiveDate;
 | 
						||
            //            DateTime end = (DateTime)ApprovalDate;
 | 
						||
            //            for (; start < end; start = start.AddDays(7))
 | 
						||
            //            {
 | 
						||
            //                if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
            //                    tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "A";
 | 
						||
            //            }
 | 
						||
 | 
						||
            //        }
 | 
						||
            //        if (ApprovalDate is DateTime && ConstStart is DateTime)
 | 
						||
            //        {
 | 
						||
            //            DateTime start = (DateTime)ApprovalDate;
 | 
						||
            //            DateTime end = (DateTime)ConstStart;
 | 
						||
            //            for (; start < end; start = start.AddDays(7))
 | 
						||
            //            {
 | 
						||
            //                if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
            //                    tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "B";
 | 
						||
            //            }
 | 
						||
 | 
						||
            //        }
 | 
						||
            //        if (ConstStart is DateTime && DEMEEnd is DateTime)
 | 
						||
            //        {
 | 
						||
            //            DateTime start = (DateTime)ConstStart;
 | 
						||
            //            DateTime end = (DateTime)DEMEEnd;
 | 
						||
            //            for (; start < end; start = start.AddDays(7))
 | 
						||
            //            {
 | 
						||
            //                if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
            //                    tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "C";
 | 
						||
            //            }
 | 
						||
 | 
						||
            //        }
 | 
						||
            //        if (DEMEEnd is DateTime && ConstEnd is DateTime)
 | 
						||
            //        {
 | 
						||
            //            DateTime start = (DateTime)DEMEEnd;
 | 
						||
            //            DateTime end = (DateTime)ConstEnd;
 | 
						||
            //            for (; start < end; start = start.AddDays(7))
 | 
						||
            //            {
 | 
						||
            //                if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
            //                    tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "D";
 | 
						||
            //            }
 | 
						||
 | 
						||
            //        }
 | 
						||
            //    }
 | 
						||
            //    catch (Exception e1)
 | 
						||
            //    {
 | 
						||
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
            ////计算excel表头
 | 
						||
            //int index = 1;
 | 
						||
 | 
						||
            //cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
            //ICellStyle styleToday = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //styleToday.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Pink.Index;
 | 
						||
 | 
						||
            //styleToday.FillPattern = FillPattern.SolidForeground;
 | 
						||
 | 
						||
            //for (int i = -3; i < 2; i++)
 | 
						||
            //{
 | 
						||
 | 
						||
            //    DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
            //    ICellStyle styleTitle = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //    switch (i)
 | 
						||
            //    {
 | 
						||
            //        case -3:
 | 
						||
            //            styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.CornflowerBlue.Index;
 | 
						||
            //            break;
 | 
						||
            //        case -2:
 | 
						||
            //            styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightYellow.Index;
 | 
						||
            //            break;
 | 
						||
            //        case -1:
 | 
						||
            //            styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Rose.Index;
 | 
						||
            //            break;
 | 
						||
            //        case 0:
 | 
						||
            //            styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Green.Index;
 | 
						||
            //            break;
 | 
						||
            //        case 1:
 | 
						||
            //            styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
 | 
						||
            //            break;
 | 
						||
            //    }
 | 
						||
            //    styleTitle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //    for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
            //    {
 | 
						||
            //        byte[] rgb = new byte[3] { 192, 0, 0 };
 | 
						||
            //        sgb.GetRow(0).CreateCell(index + 6);
 | 
						||
            //        sgb.GetRow(1).CreateCell(index + 6).SetCellValue(j);
 | 
						||
 | 
						||
            //        sgb.GetRow(0).GetCell(index + 6).CellStyle = styleTitle;
 | 
						||
            //        if (dateTime.Year == DateTime.Now.Year && gc.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday) ==j)
 | 
						||
            //        {
 | 
						||
            //            sgb.GetRow(1).GetCell(index + 6).CellStyle = styleToday;
 | 
						||
            //            sgb.GetRow(1).GetCell(index + 6).CellStyle.VerticalAlignment = VerticalAlignment.Bottom;
 | 
						||
            //        }
 | 
						||
            //        else
 | 
						||
            //        {
 | 
						||
            //            sgb.GetRow(1).GetCell(index + 6).CellStyle = styleTitle;
 | 
						||
            //            sgb.GetRow(1).GetCell(index + 6).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            //        }
 | 
						||
            //        sgb.GetRow(1).GetCell(index + 6).CellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
            //        sgb.GetRow(1).GetCell(index + 6).CellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
            //        sgb.GetRow(1).GetCell(index + 6).CellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
            //        sgb.GetRow(1).GetCell(index + 6).CellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
 | 
						||
            //        //sgb.GetRow(0).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
            //        //sgb.GetRow(1).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
            //        index++;
 | 
						||
            //    }
 | 
						||
            //    CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, index + 6 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday), (index + 5));
 | 
						||
            //    sgb.AddMergedRegion(cellRangeAddress);
 | 
						||
            //    sgb.GetRow(0).GetCell(index + 6 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday)).SetCellValue(dateTime.Year);
 | 
						||
            //    sgb.GetRow(0).GetCell(index + 6 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday)).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            //}
 | 
						||
 | 
						||
            //ICellStyle style = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //style.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //ICellStyle styleA = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //styleA.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
 | 
						||
            //styleA.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //ICellStyle styleB = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //styleB.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            //styleB.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //ICellStyle styleC = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //styleC.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Indigo.Index;
 | 
						||
            //styleC.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //ICellStyle styleD = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            //styleD.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            //styleD.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //if (tb.Rows.Count > 0)
 | 
						||
            //{
 | 
						||
            //    var rowIndex = 2;
 | 
						||
            //    for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
            //    {
 | 
						||
            //        if (sgb.GetRow(rowIndex) == null) sgb.CreateRow(rowIndex);
 | 
						||
 | 
						||
            //        //XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            //        //cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
 | 
						||
            //        #region 列赋值
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(0) == null) sgb.GetRow(rowIndex).CreateCell(0);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(0).SetCellValue(tb.Rows[i]["ProjectControl_JobNo"].ToString());
 | 
						||
 | 
						||
            //        //sgb.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(1) == null) sgb.GetRow(rowIndex).CreateCell(1);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(1).SetCellValue(tb.Rows[i]["ProjectControl_BUCode"].ToString());
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(2) == null) sgb.GetRow(rowIndex).CreateCell(2);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(2).SetCellValue(tb.Rows[i]["ProjectControl_JobType"].ToString());
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(3) == null) sgb.GetRow(rowIndex).CreateCell(3);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(3).SetCellValue(tb.Rows[i]["ProjectControl_JobTitle"].ToString());
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(4) == null) sgb.GetRow(rowIndex).CreateCell(4);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(4).SetCellValue(tb.Rows[i]["PM_General_Priority"].ToString());
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(5) == null) sgb.GetRow(rowIndex).CreateCell(5);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(5).SetCellValue(tb.Rows[i]["PM_General_Category"].ToString());
 | 
						||
 | 
						||
            //        if (sgb.GetRow(rowIndex).GetCell(6) == null) sgb.GetRow(rowIndex).CreateCell(6);
 | 
						||
            //        sgb.GetRow(rowIndex).GetCell(6).SetCellValue(tb.Rows[i]["Schedule"].ToString());
 | 
						||
 | 
						||
            //        for (int j = 7; j < tb.Columns.Count - 6; j++)
 | 
						||
            //        {
 | 
						||
            //            if (sgb.GetRow(rowIndex).GetCell(j) == null) sgb.GetRow(rowIndex).CreateCell(j);
 | 
						||
            //                sgb.GetRow(rowIndex).GetCell(j).SetCellValue(tb.Rows[i][j + 6].ToString());
 | 
						||
            //            switch (tb.Rows[i][j + 6].ToString())
 | 
						||
            //            {
 | 
						||
            //                case "A":
 | 
						||
            //                    sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleA;
 | 
						||
            //                    break;
 | 
						||
            //                case "B":
 | 
						||
            //                    sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleB;
 | 
						||
            //                    break;
 | 
						||
            //                case "C":
 | 
						||
            //                    sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleC;
 | 
						||
            //                    break;
 | 
						||
            //                case "D":
 | 
						||
            //                    sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleD;
 | 
						||
            //                    break;
 | 
						||
            //            }
 | 
						||
            //    }
 | 
						||
            //        #endregion
 | 
						||
 | 
						||
            //        rowIndex++;
 | 
						||
            //    }
 | 
						||
            //}
 | 
						||
            //#endregion            
 | 
						||
 | 
						||
            //overview.ForceFormulaRecalculation = true;
 | 
						||
            //pg.ForceFormulaRecalculation = true;
 | 
						||
            //ppv.ForceFormulaRecalculation = true;
 | 
						||
            //sgb.ForceFormulaRecalculation = true;
 | 
						||
 | 
						||
            //using (FileStream filess = File.OpenWrite(ReportFileName))
 | 
						||
            //{
 | 
						||
            //    hssfworkbook.Write(filess);
 | 
						||
            //}
 | 
						||
            //FileInfo filet = new FileInfo(ReportFileName);
 | 
						||
            //Response.Clear();
 | 
						||
            //Response.Charset = "GB2312";
 | 
						||
            //Response.ContentEncoding = System.Text.Encoding.UTF8;
 | 
						||
            //// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
 | 
						||
            //Response.AddHeader("Content-Disposition", "attachment; filename=P31_Overview_Report_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
 | 
						||
            //// 添加头信息,指定文件大小,让浏览器能够显示下载进度
 | 
						||
            //Response.AddHeader("Content-Length", filet.Length.ToString());
 | 
						||
            //// 指定返回的是一个不能被客户端读取的流,必须被下载
 | 
						||
            //Response.ContentType = "application/ms-excel";
 | 
						||
            //// 把文件流发送到客户端
 | 
						||
            //Response.WriteFile(filet.FullName);
 | 
						||
            //// 停止页面的执行
 | 
						||
            //Response.End();
 | 
						||
            #endregion
 | 
						||
        }
 | 
						||
 | 
						||
        private void Export(string strSql, SqlParameter[] parameter, List<View_Report_PermitGeneral> Permit_General, List<VIEW_Report_Overview> OverviewReport, List<View_Report_Permit_PressurePipingVesse> PressurePipingVesseReport)
 | 
						||
        {
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            int overNum = OverviewReport.Count();
 | 
						||
            int prepipingNum = PressurePipingVesseReport.Count();
 | 
						||
            int permitNum = Permit_General.Count();
 | 
						||
            int ganttBarNum = tb.Rows.Count;
 | 
						||
            int totalNum = overNum + permitNum + prepipingNum + ganttBarNum;
 | 
						||
 
 | 
						||
            string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
 | 
						||
            //模板文件
 | 
						||
            string TempletFileName = rootPath + "OverviewReport.xlsx";
 | 
						||
            //导出文件
 | 
						||
            string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
 | 
						||
            if (!Directory.Exists(filePath))
 | 
						||
            {
 | 
						||
                Directory.CreateDirectory(filePath);
 | 
						||
            }
 | 
						||
            //string ReportFileName = filePath + "out.xlsx";
 | 
						||
            string ReportFileName = filePath + "P31_Overview_Report_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx";
 | 
						||
 | 
						||
            FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
 | 
						||
            XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
 | 
						||
 | 
						||
            XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            cs_content_Font.FontName = "sans-serif";//字体
 | 
						||
            cs_content_Font.FontHeightInPoints = 10; //字体大小     
 | 
						||
 | 
						||
            IDataFormat dataformat = hssfworkbook.CreateDataFormat();
 | 
						||
            ICellStyle styleQfw = hssfworkbook.CreateCellStyle();
 | 
						||
            styleQfw.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            styleQfw.Alignment = HorizontalAlignment.Right;
 | 
						||
            styleQfw.DataFormat = dataformat.GetFormat("#,##0.00");
 | 
						||
            styleQfw.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            ICellStyle styleDate = hssfworkbook.CreateCellStyle();
 | 
						||
            styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
 | 
						||
            styleDate.SetFont(cs_content_Font);
 | 
						||
 | 
						||
            #region 背景色、字体设置
 | 
						||
            #region 黄底
 | 
						||
            //创建单元格样式
 | 
						||
            //XSSFCellStyle backgroundstyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            ////填充模式
 | 
						||
            //backgroundstyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ////创建颜色
 | 
						||
            //XSSFColor xssfcolor = new XSSFColor();
 | 
						||
            ////rbg值
 | 
						||
            //byte[] rgbYellow = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            ////写入rgb
 | 
						||
            //xssfcolor.SetRgb(rgbYellow);
 | 
						||
            ////设置颜色值
 | 
						||
            //backgroundstyle.SetFillForegroundColor(xssfcolor);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 黄底黑字 backgroundstyle1
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle1 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle1.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor1 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbYellow1 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor1.SetRgb(rgbYellow1);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle1.SetFillForegroundColor(xssfcolor1);
 | 
						||
 | 
						||
            //创建字体
 | 
						||
            XSSFFont red_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font.Color = HSSFColor.Black.Index;//黑字
 | 
						||
            backgroundstyle1.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle1.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle1.SetFont(red_content_Font);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 黄底红字 backgroundstyle2
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle2 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle2.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor2 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbYellow2 = { (byte)250, (byte)250, (byte)210 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor2.SetRgb(rgbYellow2);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle2.SetFillForegroundColor(xssfcolor2);
 | 
						||
 | 
						||
            //创建字体
 | 
						||
            XSSFFont red_content_Font2 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font2.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font2.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font2.Color = HSSFColor.Red.Index;//黑字
 | 
						||
            backgroundstyle2.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle2.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle2.SetFont(red_content_Font2);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底红字 backgroundstyle3
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle3 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle3.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor3 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbRed3 = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            xssfcolor3.SetRgb(rgbRed3);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle3.SetFillForegroundColor(xssfcolor3);
 | 
						||
 | 
						||
            ///创建字体
 | 
						||
            XSSFFont red_content_Font3 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font3.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font3.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font3.Color = HSSFColor.Red.Index;
 | 
						||
            backgroundstyle3.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle3.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle3.SetFont(red_content_Font3);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 白底红字 backgroundstyle4
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle backgroundstyle4 = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            backgroundstyle4.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfcolor4 = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbWhite = { (byte)255, (byte)255, (byte)255 };//白色
 | 
						||
                                                                  //写入rgb
 | 
						||
            xssfcolor4.SetRgb(rgbWhite);
 | 
						||
            //设置颜色值
 | 
						||
            backgroundstyle4.SetFillForegroundColor(xssfcolor4);
 | 
						||
 | 
						||
            ///创建字体
 | 
						||
            XSSFFont red_content_Font4 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
            red_content_Font4.FontName = "sans-serif";//字体
 | 
						||
            red_content_Font4.FontHeightInPoints = 10; //字体大小   
 | 
						||
            red_content_Font4.Color = HSSFColor.Red.Index;
 | 
						||
            backgroundstyle4.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
            backgroundstyle4.Alignment = HorizontalAlignment.Center;
 | 
						||
            backgroundstyle4.SetFont(red_content_Font4);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle redbackgroundstyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            redbackgroundstyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor xssfredcolor = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbRed = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            xssfredcolor.SetRgb(rgbRed);
 | 
						||
            //设置颜色值
 | 
						||
            redbackgroundstyle.SetFillForegroundColor(xssfredcolor);
 | 
						||
            redbackgroundstyle.SetFont(cs_content_Font);
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region 红底
 | 
						||
            //创建单元格样式
 | 
						||
            XSSFCellStyle redDatestyle = (XSSFCellStyle)hssfworkbook.CreateCellStyle();
 | 
						||
            //填充模式
 | 
						||
            redDatestyle.FillPattern = FillPattern.SolidForeground;
 | 
						||
            //创建颜色
 | 
						||
            XSSFColor redDatecolor = new XSSFColor();
 | 
						||
            //rbg值
 | 
						||
            byte[] rgbDateRed = { (byte)244, (byte)164, (byte)96 };
 | 
						||
            //写入rgb
 | 
						||
            redDatecolor.SetRgb(rgbDateRed);
 | 
						||
            //设置颜色值
 | 
						||
            redDatestyle.SetFillForegroundColor(redDatecolor);
 | 
						||
            redDatestyle.DataFormat = dataformat.GetFormat("yyyy/m/d");
 | 
						||
            redDatestyle.SetFont(cs_content_Font);
 | 
						||
            #endregion
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region Overview
 | 
						||
            XSSFSheet overview = (XSSFSheet)hssfworkbook.GetSheet("Overview");
 | 
						||
            if (OverviewReport.Count > 0)
 | 
						||
            {
 | 
						||
                var rowIndex = 1;
 | 
						||
                foreach (var itemOver in OverviewReport)
 | 
						||
                {
 | 
						||
                    if (overview.GetRow(rowIndex) == null) overview.CreateRow(rowIndex);
 | 
						||
 | 
						||
                    #region 列赋值
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(0) == null) overview.GetRow(rowIndex).CreateCell(0);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_BUCode);
 | 
						||
 | 
						||
                    overview.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(1) == null) overview.GetRow(rowIndex).CreateCell(1);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_JobNo);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(2) == null) overview.GetRow(rowIndex).CreateCell(2);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_JobType);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(3) == null) overview.GetRow(rowIndex).CreateCell(3);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_LeadByName);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(4) == null) overview.GetRow(rowIndex).CreateCell(4);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.ProjectControl_JobTitle);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(5) == null) overview.GetRow(rowIndex).CreateCell(5);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.ProjectControl_OrginalBudget != null ? (double)itemOver.ProjectControl_OrginalBudget.Value : 0);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(5).CellStyle = styleQfw;
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(6) == null) overview.GetRow(rowIndex).CreateCell(6);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ProjectControl_ProjectManager);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(7) == null) overview.GetRow(rowIndex).CreateCell(7);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.ProjectControl_ConstManager);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(8) == null) overview.GetRow(rowIndex).CreateCell(8);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.ProjectControl_EMManager);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(9) == null) overview.GetRow(rowIndex).CreateCell(9);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.PM_MA_ProjectApproval))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(9).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_MA_ProjectApproval.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(9).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
                    
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(10) == null) overview.GetRow(rowIndex).CreateCell(10);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_MC))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(10).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_MS_MC.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(10).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(11) == null) overview.GetRow(rowIndex).CreateCell(11);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MCRevised))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MCRevised.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(12) == null) overview.GetRow(rowIndex).CreateCell(12);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(12).SetCellValue(itemOver.PM_General_Priority);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(13) == null) overview.GetRow(rowIndex).CreateCell(13);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(13).SetCellValue(itemOver.PM_General_Category);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(14) == null) overview.GetRow(rowIndex).CreateCell(14);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(14).SetCellValue(itemOver.ProjectControl_JobStatus);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(15) == null) overview.GetRow(rowIndex).CreateCell(15);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(15).SetCellValue(itemOver.Schedule);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(16) == null) overview.GetRow(rowIndex).CreateCell(16);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(16).SetCellValue(itemOver.Cost);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(17) == null) overview.GetRow(rowIndex).CreateCell(17);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(17).SetCellValue(itemOver.Scope);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(18) == null) overview.GetRow(rowIndex).CreateCell(18);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.PM_MA_JobReveive))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(18).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_MA_JobReveive.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(18).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(19) == null) overview.GetRow(rowIndex).CreateCell(19);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(19).SetCellValue(itemOver.EstimatedFinalCost != null ? (double)itemOver.EstimatedFinalCost.Value : 0);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(19).CellStyle = styleQfw;
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(20) == null) overview.GetRow(rowIndex).CreateCell(20);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(20).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MCActual.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(20).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(21) == null) overview.GetRow(rowIndex).CreateCell(21);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MC_Signed))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(21).SetCellValue(itemOver.MC_Signed);
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(21).SetCellValue("N/A");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(21).SetCellValue("");
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(22) == null) overview.GetRow(rowIndex).CreateCell(22);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.RFSU))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(22).SetCellValue(itemOver.RFSU);
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(22).SetCellValue("N/A");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(22).SetCellValue("");
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(23) == null) overview.GetRow(rowIndex).CreateCell(23);
 | 
						||
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.Punch_C_Killed))
 | 
						||
                    {
 | 
						||
                        if (itemOver.Punch_C_Killed == "1900-01-01")
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(23).SetCellValue("不适用");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(23).SetCellValue(itemOver.Punch_C_Killed);
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (itemOver.ProjectControl_JobType == "MOC" || itemOver.ProjectControl_JobType == "Other")
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(23).SetCellValue("N/A");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(23).SetCellValue("");
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(24) == null) overview.GetRow(rowIndex).CreateCell(24);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(24).SetCellValue(itemOver.FC_Signed);
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (itemOver.ProjectControl_JobType == "Projects" && itemOver.ProjectControl_OrginalBudget >= 1000000 && !string.IsNullOrEmpty(itemOver.PM_MA_ProjectApproval))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(24).SetCellValue("");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(24).SetCellValue("N/A");
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(25) == null) overview.GetRow(rowIndex).CreateCell(25);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(25).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(25).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(26) == null) overview.GetRow(rowIndex).CreateCell(26);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.IFC_Received))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(26).SetCellValue((DateTime)Convert.ToDateTime(itemOver.IFC_Received.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(26).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(27) == null) overview.GetRow(rowIndex).CreateCell(27);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.As_built_Received))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(27).SetCellValue((DateTime)Convert.ToDateTime(itemOver.As_built_Received.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(27).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
                   
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(28) == null) overview.GetRow(rowIndex).CreateCell(28);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MD_Received))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(28).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MD_Received.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(28).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(29) == null) overview.GetRow(rowIndex).CreateCell(29);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.Date_of_Registeration))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.Date_of_Registeration);
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        if (itemOver.ProjectControl_JobType == "Other")
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(29).SetCellValue("N/A");
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(29).SetCellValue("");
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(30) == null) overview.GetRow(rowIndex).CreateCell(30);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.ProjectControl_CostEffectvitity);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(31) == null) overview.GetRow(rowIndex).CreateCell(31);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(31).SetCellValue(itemOver.ProjectControl_PVIPrediction.HasValue ? Math.Round(Convert.ToDouble(itemOver.ProjectControl_PVIPrediction), 2) : 0);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(32) == null) overview.GetRow(rowIndex).CreateCell(32);
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.ProjectControl_PC_CancelDate))
 | 
						||
                    {
 | 
						||
                        overview.GetRow(rowIndex).GetCell(32).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_PC_CancelDate.ToString()));
 | 
						||
                        overview.GetRow(rowIndex).GetCell(32).CellStyle = styleDate;
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(33) == null) overview.GetRow(rowIndex).CreateCell(33);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(33).SetCellValue(itemOver.ProjectControl_Account);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(34) == null) overview.GetRow(rowIndex).CreateCell(34);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(34).SetCellValue(itemOver.ProjectControl_NetworkNo);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(35) == null) overview.GetRow(rowIndex).CreateCell(35);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(35).SetCellValue(itemOver.StudyWo);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(36) == null) overview.GetRow(rowIndex).CreateCell(36);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(36).SetCellValue(itemOver.CTEInvolved);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(37) == null) overview.GetRow(rowIndex).CreateCell(37);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(37).SetCellValue(itemOver.CAPEXPlanNo);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(38) == null) overview.GetRow(rowIndex).CreateCell(38);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(38).SetCellValue(itemOver.PM_General_CDI);
 | 
						||
 | 
						||
                    if (overview.GetRow(rowIndex).GetCell(39) == null) overview.GetRow(rowIndex).CreateCell(39);
 | 
						||
                    overview.GetRow(rowIndex).GetCell(39).SetCellValue(itemOver.ProjectControl_MOCFormNo);
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    #region 填充背景色
 | 
						||
                    //超出计划MC6个月,仍未有实际MC日期(MC Actual)
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_MC))
 | 
						||
                    {
 | 
						||
                        if (Funs.GetNewDateTime(itemOver.ProjectControl_MS_MC).Value.AddMonths(6) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(20).CellStyle = redbackgroundstyle;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    //超出实际MC10天,仍未签MC证书(MC Signed)
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
                    {
 | 
						||
                        if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(10) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.MC_Signed))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(21).CellStyle = redbackgroundstyle;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    //超出实际MC90天,仍未签FC证书(FC Signed)
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
                    {
 | 
						||
                        if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(90) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(22).CellStyle = redbackgroundstyle;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
 | 
						||
                    //if (!string.IsNullOrEmpty(itemOver.Punch_C_Killed) && itemOver.Punch_C_Killed=="1900-01-01")
 | 
						||
                    //{
 | 
						||
                    //    overview.GetRow(rowIndex).GetCell(23).CellStyle = redbackgroundstyle;
 | 
						||
                    //}
 | 
						||
 | 
						||
                    //超出FC180天,仍未商务关闭的(Business Closed)
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.FC_Signed))
 | 
						||
                    {
 | 
						||
                        if (Funs.GetNewDateTime(itemOver.FC_Signed).Value.AddDays(180) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(23).CellStyle = redbackgroundstyle;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    //超出实际MC90天,仍未收到AB的(As-built Received)
 | 
						||
                    if (!string.IsNullOrEmpty(itemOver.MCActual))
 | 
						||
                    {
 | 
						||
                        if (Funs.GetNewDateTime(itemOver.MCActual).Value.AddDays(90) < Funs.GetNewDateTime(DateTime.Now.ToShortDateString()) && string.IsNullOrEmpty(itemOver.As_built_Received))
 | 
						||
                        {
 | 
						||
                            overview.GetRow(rowIndex).GetCell(25).CellStyle = redDatestyle;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    #endregion
 | 
						||
                    
 | 
						||
                    if ((int)(95 * rowIndex / totalNum) > percent)
 | 
						||
                    {
 | 
						||
                        percent = (int)(100 * rowIndex / totalNum);
 | 
						||
 | 
						||
                    }
 | 
						||
                    rowIndex++;
 | 
						||
                }
 | 
						||
            }
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region Permit_General
 | 
						||
            XSSFSheet pg = (XSSFSheet)hssfworkbook.GetSheet("Permit_General");
 | 
						||
           
 | 
						||
            if (Permit_General.Count > 0)
 | 
						||
            {
 | 
						||
                var rowIndex = 1;
 | 
						||
                foreach (var item in Permit_General)
 | 
						||
                {
 | 
						||
                    if (pg.GetRow(rowIndex) == null) pg.CreateRow(rowIndex);
 | 
						||
 | 
						||
                    #region 列赋值
 | 
						||
                    if (item.PType == "计划")
 | 
						||
                    {
 | 
						||
                        if (pg.GetRow(rowIndex).GetCell(0) == null) pg.GetRow(rowIndex).CreateCell(0);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(0).SetCellValue(item.ProjectControl_JobNo);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
                        pg.GetRow(rowIndex).GetCell(0).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(0).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                        if (pg.GetRow(rowIndex).GetCell(1) == null) pg.GetRow(rowIndex).CreateCell(1);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(1).SetCellValue(item.ProjectControl_JobTitle);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);
 | 
						||
 | 
						||
                        if (pg.GetRow(rowIndex).GetCell(2) == null) pg.GetRow(rowIndex).CreateCell(2);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(2).SetCellValue(item.ProjectControl_ProjectManager);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);
 | 
						||
                        pg.GetRow(rowIndex).GetCell(2).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(2).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
                    }
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(3) == null) pg.GetRow(rowIndex).CreateCell(3);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(3).SetCellValue(item.PType);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(3).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(3).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(4) == null) pg.GetRow(rowIndex).CreateCell(4);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(4).SetCellValue(item.EnvAssess);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(4).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(4).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(5) == null) pg.GetRow(rowIndex).CreateCell(5);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(5).SetCellValue(item.EnergySaving);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(5).CellStyle = styleDate;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(5).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(5).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(5).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(6) == null) pg.GetRow(rowIndex).CreateCell(6);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(6).SetCellValue(item.ProjectRegistr);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(6).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(6).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(6).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(7) == null) pg.GetRow(rowIndex).CreateCell(7);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(7).SetCellValue(item.PlanningPermit);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(7).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(7).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(7).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(8) == null) pg.GetRow(rowIndex).CreateCell(8);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(8).SetCellValue(item.SafetyConReview);
 | 
						||
 | 
						||
                    pg.GetRow(rowIndex).GetCell(8).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(8).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(8).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(9) == null) pg.GetRow(rowIndex).CreateCell(9);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(9).SetCellValue(item.SafetyDesginReview);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(9).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(9).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(9).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(10) == null) pg.GetRow(rowIndex).CreateCell(10);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(10).SetCellValue(item.FFDesginReview);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(10).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(10).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(10).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(11) == null) pg.GetRow(rowIndex).CreateCell(11);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(11).SetCellValue(item.ConstPermit);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(11).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(11).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(11).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(12) == null) pg.GetRow(rowIndex).CreateCell(12);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(12).SetCellValue(item.CMStart);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(12).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(12).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(12).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(13) == null) pg.GetRow(rowIndex).CreateCell(13);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(13).SetCellValue(item.MC);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(13).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(13).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(13).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(14) == null) pg.GetRow(rowIndex).CreateCell(14);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(14).SetCellValue(item.SafetyFinalAcc);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(14).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(14).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(14).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(15) == null) pg.GetRow(rowIndex).CreateCell(15);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(15).SetCellValue(item.FFFinalAcc);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(15).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(15).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(15).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(16) == null) pg.GetRow(rowIndex).CreateCell(16);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(16).SetCellValue(item.Usin);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(16).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(16).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(16).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (pg.GetRow(rowIndex).GetCell(17) == null) pg.GetRow(rowIndex).CreateCell(17);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(17).SetCellValue(item.EnvFinalAcc);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(17).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    pg.GetRow(rowIndex).GetCell(17).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    pg.GetRow(rowIndex).GetCell(17).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    #region 填充背景色
 | 
						||
                    if (item.PType == "计划")
 | 
						||
                    {
 | 
						||
                        #region 设置计划行背景色
 | 
						||
                        pg.GetRow(rowIndex).GetCell(0).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(1).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(2).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(3).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;
 | 
						||
                        pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;
 | 
						||
                        #endregion
 | 
						||
                        #region 如果距计划日期还有超过一个月的时间,则计划日期显示黄底黑字
 | 
						||
                        if (item.EnvAssess != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnvAssess))//环评
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.EnergySaving != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnergySaving))//节能报告
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.ProjectRegistr != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.ProjectRegistr))//项目备案
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.PlanningPermit != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PlanningPermit))//规划许可
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.SafetyConReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyConReview))//安全条件审查
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.SafetyDesginReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyDesginReview))//安全设施设计审查
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.FFDesginReview != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.FFDesginReview))//消防设计审查
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.ConstPermit != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.ConstPermit))//施工许可
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        //if (item.CMStart != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.CMStart))//施工开始
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;
 | 
						||
                        //}
 | 
						||
                        //if (item.MC != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.MC))//机械竣工
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;
 | 
						||
                        //}
 | 
						||
                        if (item.SafetyFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.SafetyFinalAcc))//安全设施竣工验收
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.FFFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.FFFinalAcc))//消防设施竣工验收
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        //if (item.Usin != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.Usin))//投用
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;
 | 
						||
                        //}
 | 
						||
                        if (item.EnvFinalAcc != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.EnvFinalAcc))//环保设施竣工验收
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region  如果下月须完成,则显示黄底红字
 | 
						||
                        if (item.EnvAssess != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnvAssess).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnvAssess).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle2;//环评
 | 
						||
                        }
 | 
						||
                        if (item.EnergySaving != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnergySaving).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnergySaving).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle2;//节能报告
 | 
						||
                        }
 | 
						||
                        if (item.ProjectRegistr != "-" && DateTime.Now.Year == Convert.ToDateTime(item.ProjectRegistr).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.ProjectRegistr).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle2;//项目备案
 | 
						||
                        }
 | 
						||
                        if (item.PlanningPermit != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PlanningPermit).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PlanningPermit).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle2;//规划许可
 | 
						||
                        }
 | 
						||
                        if (item.SafetyConReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyConReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyConReview).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle2;//安全条件审查
 | 
						||
                        }
 | 
						||
                        if (item.SafetyDesginReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyDesginReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyDesginReview).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle2;//安全设施设计审查
 | 
						||
                        }
 | 
						||
                        if (item.FFDesginReview != "-" && DateTime.Now.Year == Convert.ToDateTime(item.FFDesginReview).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.FFDesginReview).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle2;//消防设计审查
 | 
						||
                        }
 | 
						||
                        if (item.ConstPermit != "-" && DateTime.Now.Year == Convert.ToDateTime(item.ConstPermit).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.ConstPermit).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle2;//施工许可
 | 
						||
                        }
 | 
						||
                        //if (item.CMStart != "-" && DateTime.Now.Year == Convert.ToDateTime(item.CMStart).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.CMStart).Month)
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle2;//施工开始
 | 
						||
                        //}
 | 
						||
                        //if (item.MC != "-" && DateTime.Now.Year == Convert.ToDateTime(item.MC).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.MC).Month)
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle2;//机械竣工
 | 
						||
                        //}
 | 
						||
                        if (item.SafetyFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.SafetyFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.SafetyFinalAcc).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle2;//安全设施竣工验收
 | 
						||
                        }
 | 
						||
                        if (item.FFFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.FFFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.FFFinalAcc).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle2;//消防设施竣工验收
 | 
						||
                        }
 | 
						||
                        //if (item.Usin != "-" && DateTime.Now.Year == Convert.ToDateTime(item.Usin).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.Usin).Month)
 | 
						||
                        //{
 | 
						||
                        //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle2;//投用
 | 
						||
                        //}
 | 
						||
                        if (item.EnvFinalAcc != "-" && DateTime.Now.Year == Convert.ToDateTime(item.EnvFinalAcc).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.EnvFinalAcc).Month)
 | 
						||
                        {
 | 
						||
                            pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle2;//环保设施竣工验收
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region 如果已过计划日期一个月,但还未完成,则显示红底红字 
 | 
						||
                        var actual = (from x in Funs.DB.View_Report_PermitGeneral where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "实际" select x).FirstOrDefault();
 | 
						||
                        if (actual != null)
 | 
						||
                        {
 | 
						||
                            if (item.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess).AddMonths(1) < DateTime.Now)//环评
 | 
						||
                            {
 | 
						||
                                if (actual.EnvAssess == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.EnergySaving != "-" && Convert.ToDateTime(item.EnergySaving).AddMonths(1) < DateTime.Now)//节能报告
 | 
						||
                            {
 | 
						||
                                if (actual.EnergySaving == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.ProjectRegistr != "-" && Convert.ToDateTime(item.ProjectRegistr).AddMonths(1) < DateTime.Now)//项目备案
 | 
						||
                            {
 | 
						||
                                if (actual.ProjectRegistr == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.PlanningPermit != "-" && Convert.ToDateTime(item.PlanningPermit).AddMonths(1) < DateTime.Now)//规划许可
 | 
						||
                            {
 | 
						||
                                if (actual.PlanningPermit == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.SafetyConReview != "-" && Convert.ToDateTime(item.SafetyConReview).AddMonths(1) < DateTime.Now)//安全条件审查
 | 
						||
                            {
 | 
						||
                                if (actual.SafetyConReview == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.SafetyDesginReview != "-" && Convert.ToDateTime(item.SafetyDesginReview).AddMonths(1) < DateTime.Now)//安全设施设计审查
 | 
						||
                            {
 | 
						||
                                if (actual.SafetyDesginReview == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.FFDesginReview != "-" && Convert.ToDateTime(item.FFDesginReview).AddMonths(1) < DateTime.Now)//消防设计审查
 | 
						||
                            {
 | 
						||
                                if (actual.FFDesginReview == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.ConstPermit != "-" && Convert.ToDateTime(item.ConstPermit).AddMonths(1) < DateTime.Now)//施工许可
 | 
						||
                            {
 | 
						||
                                if (actual.ConstPermit == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            //if (item.CMStart != "-" && Convert.ToDateTime(item.CMStart).AddMonths(1) < DateTime.Now )//施工开始
 | 
						||
                            //{
 | 
						||
                            //    if (actual.CMStart == "-")
 | 
						||
                            //    {
 | 
						||
                            //        pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle3;
 | 
						||
                            //    }
 | 
						||
                            //}
 | 
						||
                            //if (item.MC != "-" && Convert.ToDateTime(item.MC).AddMonths(1) < DateTime.Now )//机械竣工
 | 
						||
                            //{
 | 
						||
                            //    if (actual.MC == "-")
 | 
						||
                            //    {
 | 
						||
                            //        pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle3;
 | 
						||
                            //    }
 | 
						||
                            //}
 | 
						||
                            if (item.SafetyFinalAcc != "-" && Convert.ToDateTime(item.SafetyFinalAcc).AddMonths(1) < DateTime.Now)//安全设施竣工验收
 | 
						||
                            {
 | 
						||
                                if (actual.SafetyFinalAcc == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.FFFinalAcc != "-" && Convert.ToDateTime(item.FFFinalAcc).AddMonths(1) < DateTime.Now)//消防设施竣工验收
 | 
						||
                            {
 | 
						||
                                if (actual.FFFinalAcc == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            //if (item.Usin != "-" && Convert.ToDateTime(item.Usin).AddMonths(1) < DateTime.Now)//投用
 | 
						||
                            //{
 | 
						||
                            //    if (actual.Usin == "-")
 | 
						||
                            //    {
 | 
						||
                            //        pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle3;
 | 
						||
                            //    }
 | 
						||
                            //}
 | 
						||
                            if (item.EnvFinalAcc != "-" && Convert.ToDateTime(item.EnvFinalAcc).AddMonths(1) < DateTime.Now)//环保设施竣工验收
 | 
						||
                            {
 | 
						||
                                if (actual.EnvFinalAcc == "-")
 | 
						||
                                {
 | 
						||
                                    pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region 一旦实际日期栏填入数据,则计划日期恢复成黄底黑字
 | 
						||
                        var eproject = BLL.EProjectService.GeteProjectByJobNO(item.ProjectControl_JobNo);
 | 
						||
                        if (eproject != null)
 | 
						||
                        {
 | 
						||
                            if (eproject.Permit_PPA_EnvAssess.HasValue && item.EnvAssess != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;//环评
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_EnergySaving.HasValue && item.EnergySaving != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;//节能报告
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_ProjectRegistration.HasValue && item.ProjectRegistr != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;//项目备案
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_PlanningPermit.HasValue && item.PlanningPermit != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;//规划许可
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_SafetyConRev.HasValue && item.SafetyConReview != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;//安全条件审查
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_SafetyDesignRev.HasValue && item.SafetyDesginReview != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle1;//安全设施设计审查
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PPA_FFDesignReview.HasValue && item.FFDesginReview != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle1;//消防设计审查
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PA_ConstPermit.HasValue && item.ConstPermit != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle1;//施工许可
 | 
						||
                            }
 | 
						||
                            //if (eproject.Permit_PA_ConstPermit.HasValue&&item.CMStart!="-")
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle1;//施工开始
 | 
						||
                            //}
 | 
						||
                            //if (eproject.CM_MA_MC.HasValue && item.MC != "-")
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle1;//机械竣工
 | 
						||
                            //}
 | 
						||
                            if (eproject.Permit_PA_SafetyFinalACC.HasValue && item.SafetyFinalAcc != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle1;//安全设施竣工验收
 | 
						||
                            }
 | 
						||
                            if (eproject.Permit_PA_FFFinalACC.HasValue && item.FFFinalAcc != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle1;//消防设施竣工验收
 | 
						||
                            }
 | 
						||
                            //if (eproject.CM_MA_MC.HasValue && item.Usin != "-")
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle1;//投用
 | 
						||
                            //}
 | 
						||
                            if (eproject.Permit_PA_EnvFinalACC.HasValue && item.EnvFinalAcc != "-")
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle1;//环保设施竣工验收
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                    }
 | 
						||
                    if (item.PType == "实际")
 | 
						||
                    {
 | 
						||
                        var plan = (from x in Funs.DB.View_Report_PermitGeneral where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "计划" select x).FirstOrDefault();
 | 
						||
                        if (plan != null)
 | 
						||
                        {
 | 
						||
                            //如果提前或按时完成,则显示白底黑字
 | 
						||
                            //if (!string.IsNullOrEmpty(item.EnvAssess) && !string.IsNullOrEmpty(plan.EnvAssess) && item.EnvAssess != "-" && plan.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess) <= Convert.ToDateTime(plan.EnvAssess))
 | 
						||
                            //{
 | 
						||
 | 
						||
                            //}
 | 
						||
                            #region 如果是在计划日期后完成,则显示白底红字
 | 
						||
                            if (plan.EnvAssess != "-" && item.EnvAssess != "-" && Convert.ToDateTime(plan.EnvAssess) < Convert.ToDateTime(item.EnvAssess))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle4;//环评
 | 
						||
                            }
 | 
						||
                            if (plan.EnergySaving != "-" && item.EnergySaving != "-" && Convert.ToDateTime(plan.EnergySaving) < Convert.ToDateTime(item.EnergySaving))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle4;//节能报告
 | 
						||
                            }
 | 
						||
                            if (plan.ProjectRegistr != "-" && item.ProjectRegistr != "-" && Convert.ToDateTime(plan.ProjectRegistr) < Convert.ToDateTime(item.ProjectRegistr))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle4;//项目备案
 | 
						||
                            }
 | 
						||
                            if (plan.PlanningPermit != "-" && item.PlanningPermit != "-" && Convert.ToDateTime(plan.PlanningPermit) < Convert.ToDateTime(item.PlanningPermit))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle4;//规划许可
 | 
						||
                            }
 | 
						||
                            if (plan.SafetyConReview != "-" && item.SafetyConReview != "-" && Convert.ToDateTime(plan.SafetyConReview) < Convert.ToDateTime(item.SafetyConReview))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle4;//安全条件审查
 | 
						||
                            }
 | 
						||
                            if (plan.SafetyDesginReview != "-" && item.SafetyDesginReview != "-" && Convert.ToDateTime(plan.SafetyDesginReview) < Convert.ToDateTime(item.SafetyDesginReview))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(9).CellStyle = backgroundstyle4;//安全设施设计审查
 | 
						||
                            }
 | 
						||
                            if (plan.FFDesginReview != "-" && item.FFDesginReview != "-" && Convert.ToDateTime(plan.FFDesginReview) < Convert.ToDateTime(item.FFDesginReview))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(10).CellStyle = backgroundstyle4;//消防设计审查
 | 
						||
                            }
 | 
						||
                            if (plan.ConstPermit != "-" && item.ConstPermit != "-" && Convert.ToDateTime(plan.ConstPermit) < Convert.ToDateTime(item.ConstPermit))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(11).CellStyle = backgroundstyle4;//施工许可
 | 
						||
                            }
 | 
						||
                            //if (plan.CMStart != "-" && item.CMStart != "-" && Convert.ToDateTime(plan.CMStart) < Convert.ToDateTime(item.CMStart))
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(12).CellStyle = backgroundstyle4;//施工开始
 | 
						||
                            //}
 | 
						||
                            //if (plan.MC != "-" && item.MC != "-" && Convert.ToDateTime(plan.MC) < Convert.ToDateTime(item.MC))
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(13).CellStyle = backgroundstyle4;//机械竣工
 | 
						||
                            //}
 | 
						||
                            if (plan.SafetyFinalAcc != "-" && item.SafetyFinalAcc != "-" && Convert.ToDateTime(plan.SafetyFinalAcc) < Convert.ToDateTime(item.SafetyFinalAcc))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(14).CellStyle = backgroundstyle4;//安全设施竣工验收
 | 
						||
                            }
 | 
						||
                            if (plan.FFFinalAcc != "-" && item.FFFinalAcc != "-" && Convert.ToDateTime(plan.FFFinalAcc) < Convert.ToDateTime(item.FFFinalAcc))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(15).CellStyle = backgroundstyle4;//消防设施竣工验收
 | 
						||
                            }
 | 
						||
                            //if (plan.Usin != "-" && item.Usin != "-" && Convert.ToDateTime(plan.Usin) < Convert.ToDateTime(item.Usin))
 | 
						||
                            //{
 | 
						||
                            //    pg.GetRow(rowIndex).GetCell(16).CellStyle = backgroundstyle4;//投用
 | 
						||
                            //}
 | 
						||
                            if (plan.EnvFinalAcc != "-" && item.EnvFinalAcc != "-" && Convert.ToDateTime(plan.EnvFinalAcc) < Convert.ToDateTime(item.EnvFinalAcc))
 | 
						||
                            {
 | 
						||
                                pg.GetRow(rowIndex).GetCell(17).CellStyle = backgroundstyle4;//环保设施竣工验收
 | 
						||
                            }
 | 
						||
                            #endregion
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    if ((int)((95 * (rowIndex + overNum)) / totalNum) > percent)
 | 
						||
                    {
 | 
						||
                        percent = (int)(100 * (rowIndex + overNum) / totalNum);
 | 
						||
                    }
 | 
						||
 | 
						||
                    rowIndex++;
 | 
						||
                }
 | 
						||
            }
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region Permit_Pressure Piping & Vesse
 | 
						||
            XSSFSheet ppv = (XSSFSheet)hssfworkbook.GetSheet("Permit_Pressure Piping & Vesse");
 | 
						||
            
 | 
						||
            if (PressurePipingVesseReport.Count > 0)
 | 
						||
            {
 | 
						||
                var rowIndex = 1;
 | 
						||
                foreach (var item in PressurePipingVesseReport)
 | 
						||
                {
 | 
						||
                    if (ppv.GetRow(rowIndex) == null) ppv.CreateRow(rowIndex);
 | 
						||
 | 
						||
                    #region 列赋值
 | 
						||
                    if (item.PType == "计划")
 | 
						||
                    {
 | 
						||
                        if (ppv.GetRow(rowIndex).GetCell(0) == null) ppv.GetRow(rowIndex).CreateCell(0);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(0).SetCellValue(item.ProjectControl_JobNo);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(0).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(0).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                        if (ppv.GetRow(rowIndex).GetCell(1) == null) ppv.GetRow(rowIndex).CreateCell(1);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(1).SetCellValue(item.ProjectControl_JobTitle);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);
 | 
						||
 | 
						||
                        if (ppv.GetRow(rowIndex).GetCell(2) == null) ppv.GetRow(rowIndex).CreateCell(2);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(2).SetCellValue(item.ProjectControl_ProjectManager);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(2).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(2).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    }
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(3) == null) ppv.GetRow(rowIndex).CreateCell(3);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(3).SetCellValue(item.PType);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(3).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(3).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(4) == null) ppv.GetRow(rowIndex).CreateCell(4);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(4).SetCellValue(item.PressurePiping);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(4).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(4).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(5) == null) ppv.GetRow(rowIndex).CreateCell(5);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(5).SetCellValue(item.PressureVessel);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(5).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(5).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(5).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(6) == null) ppv.GetRow(rowIndex).CreateCell(6);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(6).SetCellValue(item.SQIB);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(6).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(6).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(6).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(7) == null) ppv.GetRow(rowIndex).CreateCell(7);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(7).SetCellValue(item.ArchiveAccep);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(7).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(7).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(7).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    if (ppv.GetRow(rowIndex).GetCell(8) == null) ppv.GetRow(rowIndex).CreateCell(8);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(8).SetCellValue(item.ThrdConstJian);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(8).CellStyle.SetFont(cs_content_Font);
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(8).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    ppv.GetRow(rowIndex).GetCell(8).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    #region 填充背景色
 | 
						||
                    if (item.PType == "计划")
 | 
						||
                    {
 | 
						||
                        #region 设置计划行背景色
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(0).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(1).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(2).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(3).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(6).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(7).CellStyle = backgroundstyle1;
 | 
						||
                        ppv.GetRow(rowIndex).GetCell(8).CellStyle = backgroundstyle1;
 | 
						||
                        #endregion
 | 
						||
                        #region 如果距计划日期还有超过一个月的时间,则计划日期显示黄底黑字
 | 
						||
                        if (item.PressurePiping != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PressurePiping))//压力管道
 | 
						||
                        {
 | 
						||
                            ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        if (item.PressureVessel != "-" && DateTime.Now.AddMonths(1) < Convert.ToDateTime(item.PressureVessel))//压力容器
 | 
						||
                        {
 | 
						||
                            ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region  如果下月须完成,则显示黄底红字
 | 
						||
                        if (item.PressurePiping != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PressurePiping).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PressurePiping).Month)
 | 
						||
                        {
 | 
						||
                            ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle2;//压力管道
 | 
						||
                        }
 | 
						||
                        if (item.PressureVessel != "-" && DateTime.Now.Year == Convert.ToDateTime(item.PressureVessel).Year && DateTime.Now.AddMonths(1).Month == Convert.ToDateTime(item.PressureVessel).Month)
 | 
						||
                        {
 | 
						||
                            ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle2;//压力容器
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region 如果已过计划日期一个月,但还未完成,则显示红底红字 
 | 
						||
                        var actual = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "实际" select x).FirstOrDefault();
 | 
						||
                        if (actual != null)
 | 
						||
                        {
 | 
						||
                            if (item.PressurePiping != "-" && Convert.ToDateTime(item.PressurePiping).AddMonths(1) < DateTime.Now)//压力管道
 | 
						||
                            {
 | 
						||
                                if (actual.PressurePiping == "-")
 | 
						||
                                {
 | 
						||
                                    ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                            if (item.PressureVessel != "-" && Convert.ToDateTime(item.PressureVessel).AddMonths(1) < DateTime.Now)//压力容器
 | 
						||
                            {
 | 
						||
                                if (actual.PressureVessel == "-")
 | 
						||
                                {
 | 
						||
                                    ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle3;
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                        #region 一旦实际日期栏填入数据,则计划日期恢复成黄底黑字
 | 
						||
                        var eproject = BLL.EProjectService.GeteProjectByJobNO(item.ProjectControl_JobNo);
 | 
						||
                        if (eproject != null)
 | 
						||
                        {
 | 
						||
                            if (eproject.SQIB_PressurePiping.HasValue && item.PressurePiping != "-")
 | 
						||
                            {
 | 
						||
                                ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle1;//压力管道
 | 
						||
                            }
 | 
						||
                            if (eproject.SQIB_PressureVessel.HasValue && item.PressureVessel != "-")
 | 
						||
                            {
 | 
						||
                                ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle1;//压力容器
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        #endregion
 | 
						||
                    }
 | 
						||
                    if (item.PType == "实际")
 | 
						||
                    {
 | 
						||
                        var plan = (from x in Funs.DB.View_Report_Permit_PressurePipingVesse where x.ProjectControl_JobNo == item.ProjectControl_JobNo && x.PType == "计划" select x).FirstOrDefault();
 | 
						||
                        if (plan != null)
 | 
						||
                        {
 | 
						||
                            //如果提前或按时完成,则显示白底黑字
 | 
						||
                            //if (!string.IsNullOrEmpty(item.EnvAssess) && !string.IsNullOrEmpty(plan.EnvAssess) && item.EnvAssess != "-" && plan.EnvAssess != "-" && Convert.ToDateTime(item.EnvAssess) <= Convert.ToDateTime(plan.EnvAssess))
 | 
						||
                            //{
 | 
						||
 | 
						||
                            //}
 | 
						||
                            #region 如果是在计划日期后完成,则显示白底红字
 | 
						||
                            if (plan.PressurePiping != "-" && item.PressurePiping != "-" && Convert.ToDateTime(plan.PressurePiping) < Convert.ToDateTime(item.PressurePiping))
 | 
						||
                            {
 | 
						||
                                ppv.GetRow(rowIndex).GetCell(4).CellStyle = backgroundstyle4;//压力管道
 | 
						||
                            }
 | 
						||
                            if (plan.PressureVessel != "-" && item.PressureVessel != "-" && Convert.ToDateTime(plan.PressureVessel) < Convert.ToDateTime(item.PressureVessel))
 | 
						||
                            {
 | 
						||
                                ppv.GetRow(rowIndex).GetCell(5).CellStyle = backgroundstyle4;//压力容器
 | 
						||
                            }
 | 
						||
                            #endregion
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    if ((int)((95 * (rowIndex + overNum+ permitNum)) / totalNum) > percent)
 | 
						||
                    {
 | 
						||
                        percent = (int)(100 * (rowIndex + overNum + permitNum) / totalNum);
 | 
						||
                    }
 | 
						||
                    rowIndex++;
 | 
						||
                }
 | 
						||
            }
 | 
						||
            #endregion
 | 
						||
 | 
						||
            #region Schedule_Gantt_Bar
 | 
						||
            XSSFSheet sgb = (XSSFSheet)hssfworkbook.GetSheet("Schedule_Gantt_Bar");
 | 
						||
            GregorianCalendar gc = new GregorianCalendar();
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
                {
 | 
						||
                    tb.Columns.Add(dateTime.Year + "-" + j, System.Type.GetType("System.String"));
 | 
						||
                }
 | 
						||
            }
 | 
						||
 | 
						||
            for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    var ReceiveDate = tb.Rows[i]["ReceiveDate"];
 | 
						||
                    var ApprovalDate = tb.Rows[i]["ApprovalDate"];
 | 
						||
                    var ConstStart = tb.Rows[i]["ConstMECivilStart"];
 | 
						||
                    var DEMEEnd = tb.Rows[i]["DEMECivilEnd"];
 | 
						||
                    var ConstEnd = tb.Rows[i]["ConstMECivilEnd"];
 | 
						||
                    if (ReceiveDate is DateTime && ApprovalDate is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ReceiveDate;
 | 
						||
                        DateTime end = (DateTime)ApprovalDate;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "A";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (ApprovalDate is DateTime && ConstStart is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ApprovalDate;
 | 
						||
                        DateTime end = (DateTime)ConstStart;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "B";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (ConstStart is DateTime && DEMEEnd is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)ConstStart;
 | 
						||
                        DateTime end = (DateTime)DEMEEnd;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "C";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                    if (DEMEEnd is DateTime && ConstEnd is DateTime)
 | 
						||
                    {
 | 
						||
                        DateTime start = (DateTime)DEMEEnd;
 | 
						||
                        DateTime end = (DateTime)ConstEnd;
 | 
						||
                        for (; start < end; start = start.AddDays(7))
 | 
						||
                        {
 | 
						||
                            if (tb.Columns.Contains(start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)))
 | 
						||
                                tb.Rows[i][start.Year + "-" + gc.GetWeekOfYear(start, CalendarWeekRule.FirstDay, DayOfWeek.Monday)] = "D";
 | 
						||
                        }
 | 
						||
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception e1)
 | 
						||
                {
 | 
						||
 | 
						||
                }
 | 
						||
            }
 | 
						||
            //计算excel表头
 | 
						||
            int index = 1;
 | 
						||
 | 
						||
            cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
            ICellStyle styleToday = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleToday.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Pink.Index;
 | 
						||
 | 
						||
            styleToday.FillPattern = FillPattern.SolidForeground;
 | 
						||
 | 
						||
            for (int i = -3; i < 2; i++)
 | 
						||
            {
 | 
						||
 | 
						||
                DateTime dateTime = new DateTime(DateTime.Now.Year + i, 12, 31);
 | 
						||
                ICellStyle styleTitle = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
                switch (i)
 | 
						||
                {
 | 
						||
                    case -3:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.CornflowerBlue.Index;
 | 
						||
                        break;
 | 
						||
                    case -2:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightYellow.Index;
 | 
						||
                        break;
 | 
						||
                    case -1:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Rose.Index;
 | 
						||
                        break;
 | 
						||
                    case 0:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Green.Index;
 | 
						||
                        break;
 | 
						||
                    case 1:
 | 
						||
                        styleTitle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
 | 
						||
                        break;
 | 
						||
                }
 | 
						||
                styleTitle.FillPattern = FillPattern.SolidForeground;
 | 
						||
                for (int j = 1; j <= gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday); j++)
 | 
						||
                {
 | 
						||
                    byte[] rgb = new byte[3] { 192, 0, 0 };
 | 
						||
                    sgb.GetRow(0).CreateCell(index + 10);
 | 
						||
                    sgb.GetRow(1).CreateCell(index + 10).SetCellValue(j);
 | 
						||
 | 
						||
                    sgb.GetRow(0).GetCell(index + 10).CellStyle = styleTitle;
 | 
						||
                    if (dateTime.Year == DateTime.Now.Year && gc.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday) == j)
 | 
						||
                    {
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle = styleToday;
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle.VerticalAlignment = VerticalAlignment.Bottom;
 | 
						||
                    }
 | 
						||
                    else
 | 
						||
                    {
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle = styleTitle;
 | 
						||
                        sgb.GetRow(1).GetCell(index + 10).CellStyle.VerticalAlignment = VerticalAlignment.Center;
 | 
						||
                    }
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
                    sgb.GetRow(1).GetCell(index + 10).CellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
 | 
						||
 | 
						||
                    //sgb.GetRow(0).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
                    //sgb.GetRow(1).GetCell(index + 6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
                    index++;
 | 
						||
                }
 | 
						||
                CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, index + 10 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday), (index + 9));
 | 
						||
                sgb.AddMergedRegion(cellRangeAddress);
 | 
						||
                sgb.GetRow(0).GetCell(index + 10 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday)).SetCellValue(dateTime.Year);
 | 
						||
                sgb.GetRow(0).GetCell(index + 10 - gc.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Monday)).CellStyle.Alignment = HorizontalAlignment.Center;
 | 
						||
 | 
						||
            }
 | 
						||
 | 
						||
            ICellStyle style = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            style.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleA = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleA.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
 | 
						||
            styleA.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleB = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleB.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            styleB.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleC = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleC.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Indigo.Index;
 | 
						||
            styleC.FillPattern = FillPattern.SolidForeground;
 | 
						||
            ICellStyle styleD = (ICellStyle)hssfworkbook.CreateCellStyle(); //创建字体
 | 
						||
            styleD.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index;
 | 
						||
            styleD.FillPattern = FillPattern.SolidForeground;
 | 
						||
            if (tb.Rows.Count > 0)
 | 
						||
            {
 | 
						||
                var rowIndex = 2;
 | 
						||
                for (int i = 0; i < tb.Rows.Count; i++)
 | 
						||
                {
 | 
						||
                    if (sgb.GetRow(rowIndex) == null) sgb.CreateRow(rowIndex);
 | 
						||
 | 
						||
                    //XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
 | 
						||
                    //cs_content_Font.FontHeightInPoints = 10; //字体大小
 | 
						||
 | 
						||
                    #region 列赋值
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(0) == null) sgb.GetRow(rowIndex).CreateCell(0);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(0).SetCellValue(tb.Rows[i]["ProjectControl_JobNo"].ToString());
 | 
						||
 | 
						||
                    //sgb.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(1) == null) sgb.GetRow(rowIndex).CreateCell(1);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(1).SetCellValue(tb.Rows[i]["ProjectControl_BUCode"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(2) == null) sgb.GetRow(rowIndex).CreateCell(2);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(2).SetCellValue(tb.Rows[i]["ProjectControl_JobType"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(3) == null) sgb.GetRow(rowIndex).CreateCell(3);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(3).SetCellValue(tb.Rows[i]["ProjectControl_JobTitle"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(4) == null) sgb.GetRow(rowIndex).CreateCell(4);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(4).SetCellValue(tb.Rows[i]["PM_General_Priority"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(5) == null) sgb.GetRow(rowIndex).CreateCell(5);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(5).SetCellValue(tb.Rows[i]["PM_General_Category"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(6) == null) sgb.GetRow(rowIndex).CreateCell(6);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(6).SetCellValue(tb.Rows[i]["PlanHours_ACP"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(7) == null) sgb.GetRow(rowIndex).CreateCell(7);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(7).SetCellValue(tb.Rows[i]["PlanHours_S"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(8) == null) sgb.GetRow(rowIndex).CreateCell(8);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(8).SetCellValue(tb.Rows[i]["ProjectControl_LeadByName"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(9) == null) sgb.GetRow(rowIndex).CreateCell(9);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(9).SetCellValue(tb.Rows[i]["ProjectControl_JobStatus"].ToString());
 | 
						||
 | 
						||
                    if (sgb.GetRow(rowIndex).GetCell(10) == null) sgb.GetRow(rowIndex).CreateCell(10);
 | 
						||
                    sgb.GetRow(rowIndex).GetCell(10).SetCellValue(tb.Rows[i]["Schedule"].ToString());
 | 
						||
 | 
						||
                    for (int j = 11; j < tb.Columns.Count - 10; j++)
 | 
						||
                    {
 | 
						||
                        if (sgb.GetRow(rowIndex).GetCell(j) == null) sgb.GetRow(rowIndex).CreateCell(j);
 | 
						||
                        sgb.GetRow(rowIndex).GetCell(j).SetCellValue(tb.Rows[i][j + 10].ToString());
 | 
						||
                        switch (tb.Rows[i][j + 10].ToString())
 | 
						||
                        {
 | 
						||
                            case "A":
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleA;
 | 
						||
                                break;
 | 
						||
                            case "B":
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleB;
 | 
						||
                                break;
 | 
						||
                            case "C":
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleC;
 | 
						||
                                break;
 | 
						||
                            case "D":
 | 
						||
                                sgb.GetRow(rowIndex).GetCell(j).CellStyle = styleD;
 | 
						||
                                break;
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    #endregion
 | 
						||
 | 
						||
                    if ((int)((95 * (rowIndex - 1 + overNum + permitNum + prepipingNum)) / totalNum) > percent)
 | 
						||
                    {
 | 
						||
                        percent = (int)(100 * (rowIndex - 1 + overNum + permitNum + prepipingNum) / totalNum);
 | 
						||
                    }
 | 
						||
 | 
						||
                    rowIndex++;
 | 
						||
                }
 | 
						||
            }
 | 
						||
            #endregion            
 | 
						||
 | 
						||
            overview.ForceFormulaRecalculation = true;
 | 
						||
            pg.ForceFormulaRecalculation = true;
 | 
						||
            ppv.ForceFormulaRecalculation = true;
 | 
						||
            sgb.ForceFormulaRecalculation = true;
 | 
						||
 | 
						||
            using (FileStream filess = File.OpenWrite(ReportFileName))
 | 
						||
            {
 | 
						||
                hssfworkbook.Write(filess);
 | 
						||
                hssfworkbook.Close();
 | 
						||
                filess.Flush();
 | 
						||
                filess.Close();
 | 
						||
            }
 | 
						||
            percent = 100;
 | 
						||
            url = ReportFileName.Replace(Server.MapPath("~/"), "");
 | 
						||
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
        
 | 
						||
        #region 权限设置
 | 
						||
        /// <summary>
 | 
						||
        /// 菜单按钮权限
 | 
						||
        /// </summary>
 | 
						||
        private void GetButtonPower()
 | 
						||
        {
 | 
						||
            var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.OverviewMenuId);
 | 
						||
            if (buttonList.Count() > 0)
 | 
						||
            {
 | 
						||
                if (buttonList.Contains(BLL.Const.BtnOut))
 | 
						||
                {
 | 
						||
                    this.btnExport.Hidden = false;
 | 
						||
                    this.btnGaExport.Hidden = false;
 | 
						||
                }
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
    }
 | 
						||
} |