Basf_EProject/EProject/FineUIPro.Web/Report/ProjectListReport.aspx.cs

1524 lines
77 KiB
C#

using BLL;
using NPOI.XSSF.UserModel;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.Report
{
public partial class ProjectListReport : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
// 表头过滤
FilterDataRowItem = FilterDataRowItemImplement;
if (!IsPostBack)
{
GetButtonPower();//权限设置
BLL.Sys_UserService.InitUserDropDownList(this.drpProjectManager, true);
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
else if (GetRequestEventArgument() == "FilterChange")
{
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT * FROM View_ProjectListReport 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 (this.drpProjectManager.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpProjectManager.SelectedValue))
{
strSql += " AND ProjectControl_ProjectManager LIKE @pm ";
listStr.Add(new SqlParameter("@pm", "%" + this.drpProjectManager.SelectedItem.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 过滤表头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_FilterChange(object sender, EventArgs e)
{
BindGrid();
}
/// <summary>
/// 根据表头信息过滤列表数据
/// </summary>
/// <param name="sourceObj"></param>
/// <param name="fillteredOperator"></param>
/// <param name="fillteredObj"></param>
/// <param name="column"></param>
/// <returns></returns>
private bool FilterDataRowItemImplement(object sourceObj, string fillteredOperator, object fillteredObj, string column)
{
bool valid = false;
if (column == "ProjectControl_BUCode")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_JobNo")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_JobType")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_LeadByName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_JobTitle")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_OrginalBudget")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_ChangedBudget")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CommittedPRPO")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_Actual")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_ProjectManager")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_ConstManager")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_MS_ResourcePlanReceived")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_MS_Approval")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_MA_ProjectApproval")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_MS_MC")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_MA_MC")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_MS_Close")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_PC_CancelDate")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_BC_CloseDate")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_General_Priority")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_JobStatus")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_Cost")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_MOCFormNo")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_Account")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_PVIPrediction")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CostEffectvitity")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_OperationRep")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CI_ProcessName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CI_EquipmentName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CI_InstrumentName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CI_ElectricalName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CI_CivilName")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_General_Category")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_General_CDI")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CC_SchStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CC_SchEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_CC_RevisedStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_CC_RevisedEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CM_SchStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_CM_RevisedStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_CM_SchEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CM_CM_RevisedEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_LP_SchStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_LP_SchEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_LLEP_RevisedStart")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "PM_LLEP_RevisedEnd")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectControl_Remarks")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
return valid;
}
#endregion
#region
/// <summary>
/// 下拉框选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <summary>
/// 分页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <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;
BindGrid();
}
#endregion
#region
/// <summary>
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnExport_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = rootPath + "Project_List_Report.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);
#region Project_List_Report
XSSFSheet projectList = (XSSFSheet)hssfworkbook.GetSheet("Project_List_Report");
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);
var ProjectListReport = (from x in Funs.DB.View_ProjectListReport orderby x.ProjectControl_JobNo descending select x).ToList();
if (!string.IsNullOrEmpty(txtJobNo.Text.Trim()))
{
ProjectListReport = ProjectListReport.Where(x => x.ProjectControl_JobNo.Contains(this.txtJobNo.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.drpProjectManager.SelectedValue) && this.drpProjectManager.SelectedValue != BLL.Const._Null)
{
ProjectListReport = ProjectListReport.Where(x => x.ProjectControl_ProjectManager == this.drpProjectManager.SelectedItem.Text.Trim()).ToList();
}
if (ProjectListReport.Count > 0)
{
var rowIndex = 1;
foreach (var itemOver in ProjectListReport)
{
if (projectList.GetRow(rowIndex) == null) projectList.CreateRow(rowIndex);
#region
//BU.
if (projectList.GetRow(rowIndex).GetCell(0) == null) projectList.GetRow(rowIndex).CreateCell(0);
projectList.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.ProjectControl_BUCode);
projectList.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Job No
if (projectList.GetRow(rowIndex).GetCell(1) == null) projectList.GetRow(rowIndex).CreateCell(1);
projectList.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.ProjectControl_JobNo);
projectList.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);
//Job Type
if (projectList.GetRow(rowIndex).GetCell(2) == null) projectList.GetRow(rowIndex).CreateCell(2);
projectList.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.ProjectControl_JobType);
projectList.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);
//Lead By
if (projectList.GetRow(rowIndex).GetCell(3) == null) projectList.GetRow(rowIndex).CreateCell(3);
projectList.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.ProjectControl_LeadByName);
projectList.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);
//Job Title
if (projectList.GetRow(rowIndex).GetCell(4) == null) projectList.GetRow(rowIndex).CreateCell(4);
projectList.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.ProjectControl_JobTitle);
projectList.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);
//Org. Budget
if (projectList.GetRow(rowIndex).GetCell(5) == null) projectList.GetRow(rowIndex).CreateCell(5);
projectList.GetRow(rowIndex).GetCell(5).SetCellValue((double)itemOver.OrginalBudget); //(string.Format("{0:N}", itemOver.OrginalBudget));
projectList.GetRow(rowIndex).GetCell(5).CellStyle = styleQfw;
//Chd. Budget
if (projectList.GetRow(rowIndex).GetCell(6) == null) projectList.GetRow(rowIndex).CreateCell(6);
projectList.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.ChangedBudget != null ? (double)itemOver.ChangedBudget.Value : 0); //(string.Format("{0:N}", itemOver.ChangedBudget));
projectList.GetRow(rowIndex).GetCell(6).CellStyle = styleQfw;
//Cost. Comp
if (projectList.GetRow(rowIndex).GetCell(7) == null) projectList.GetRow(rowIndex).CreateCell(7);
projectList.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.CostToComplete != null ? (double)itemOver.CostToComplete.Value : 0); //(string.Format("{0:N}", itemOver.CostToComplete));
projectList.GetRow(rowIndex).GetCell(7).CellStyle = styleQfw;
//Final Cost
if (projectList.GetRow(rowIndex).GetCell(8) == null) projectList.GetRow(rowIndex).CreateCell(8);
projectList.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.FinalCost != null ? (double)itemOver.FinalCost.Value : 0); //(string.Format("{0:N}", itemOver.FinalCost));
projectList.GetRow(rowIndex).GetCell(8).CellStyle = styleQfw;
//Proj. Manager
if (projectList.GetRow(rowIndex).GetCell(9) == null) projectList.GetRow(rowIndex).CreateCell(9);
projectList.GetRow(rowIndex).GetCell(9).SetCellValue(itemOver.ProjectControl_ProjectManager);
projectList.GetRow(rowIndex).GetCell(9).CellStyle.SetFont(cs_content_Font);
//Const. Manager
if (projectList.GetRow(rowIndex).GetCell(10) == null) projectList.GetRow(rowIndex).CreateCell(10);
projectList.GetRow(rowIndex).GetCell(10).SetCellValue(itemOver.ProjectControl_ConstManager);
projectList.GetRow(rowIndex).GetCell(10).CellStyle.SetFont(cs_content_Font);
//Receive
if (projectList.GetRow(rowIndex).GetCell(11) == null) projectList.GetRow(rowIndex).CreateCell(11);
if (!string.IsNullOrEmpty(itemOver.RECEIVES))
{
projectList.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)Convert.ToDateTime(itemOver.RECEIVES));
projectList.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
}
//Appr Date(Sch)
if (projectList.GetRow(rowIndex).GetCell(12) == null) projectList.GetRow(rowIndex).CreateCell(12);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_Approval))
{
projectList.GetRow(rowIndex).GetCell(12).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_MS_Approval));
projectList.GetRow(rowIndex).GetCell(12).CellStyle = styleDate;
}
//Appr Date(Act)
if (projectList.GetRow(rowIndex).GetCell(13) == null) projectList.GetRow(rowIndex).CreateCell(13);
if (!string.IsNullOrEmpty(itemOver.PM_MA_ProjectApproval))
{
projectList.GetRow(rowIndex).GetCell(13).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_MA_ProjectApproval));
projectList.GetRow(rowIndex).GetCell(13).CellStyle = styleDate;
}
//MC (Plan)
if (projectList.GetRow(rowIndex).GetCell(14) == null) projectList.GetRow(rowIndex).CreateCell(14);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_MC))
{
projectList.GetRow(rowIndex).GetCell(14).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_MS_MC));
projectList.GetRow(rowIndex).GetCell(14).CellStyle = styleDate;
}
//MC (Act)
if (projectList.GetRow(rowIndex).GetCell(15) == null) projectList.GetRow(rowIndex).CreateCell(15);
if (!string.IsNullOrEmpty(itemOver.CM_MA_MC))
{
projectList.GetRow(rowIndex).GetCell(15).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_MA_MC));
projectList.GetRow(rowIndex).GetCell(15).CellStyle = styleDate;
}
//Close(Sch)
if (projectList.GetRow(rowIndex).GetCell(16) == null) projectList.GetRow(rowIndex).CreateCell(16);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_MS_Close))
{
projectList.GetRow(rowIndex).GetCell(16).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_MS_Close));
projectList.GetRow(rowIndex).GetCell(16).CellStyle = styleDate;
}
//Close(Act)
#region Close(Act)
//string closeAct = "";
//if (itemOver.ProjectControl_JobType == "MOC")
//{
// List<DateTime> closeDateLists = new List<DateTime>();
// var built = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D02_AS-BUILT");
// if (built != null)
// {
// if (built.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(built.ReceiveHC)); //竣工图接收日期
// }
// }
// var md = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D03_MD");
// if (md != null)
// {
// if (md.ReceivePDF.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(md.ReceivePDF));//主控文档更新日期
// }
// }
// if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate));//商务关闭日期
// }
// if (itemOver.CM_Date_of_Registration.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.CM_Date_of_Registration));//剩余材料登记
// }
// closeDateLists.Sort();
// if (closeDateLists.Count == 4)
// {
// closeAct = closeDateLists[closeDateLists.Count - 1].ToShortDateString();
// }
//}
//else if (itemOver.ProjectControl_JobType == "Small Invest")
//{
// List<DateTime> closeDateLists = new List<DateTime>();
// var built = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D02_AS-BUILT");
// if (built != null)
// {
// if (built.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(built.ReceiveHC)); //竣工图接收日期
// }
// }
// if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate));//商务关闭日期
// }
// var md = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D03_MD");
// if (md != null)
// {
// if (md.ReceivePDF.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(md.ReceivePDF));//主控文档更新日期
// }
// }
// if (itemOver.CM_Punch_CKilledDate.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.CM_Punch_CKilledDate));//C类尾项消项日期
// }
// var mc = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D11_MC");
// if (mc != null)
// {
// if (mc.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(mc.ReceiveHC));//机械竣工签署日期
// }
// }
// if (itemOver.CM_Date_of_Registration.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.CM_Date_of_Registration));//剩余材料登记
// }
// closeDateLists.Sort();
// if (closeDateLists.Count == 6)
// {
// closeAct = closeDateLists[closeDateLists.Count - 1].ToShortDateString();
// }
//}
//else if (itemOver.ProjectControl_JobType == "Projects")
//{
// List<DateTime> closeDateLists = new List<DateTime>();
// var built = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D02_AS-BUILT");
// if (built != null)
// {
// if (built.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(built.ReceiveHC)); //竣工图接收日期
// }
// }
// if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate));//商务关闭日期
// }
// var md = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D03_MD");
// if (md != null)
// {
// if (md.ReceivePDF.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(md.ReceivePDF));//主控文档更新日期
// }
// }
// if (itemOver.CM_Punch_CKilledDate.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.CM_Punch_CKilledDate));//C类尾项消项日期
// }
// var mc = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D11_MC");
// if (mc != null)
// {
// if (mc.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(mc.ReceiveHC));//机械竣工签署日期
// }
// }
// var fc = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D30_FC");
// if (fc != null)
// {
// if (fc.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(fc.ReceiveHC));//FC签署日期
// }
// }
// if (itemOver.CM_Date_of_Registration.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.CM_Date_of_Registration));//剩余材料登记
// }
// closeDateLists.Sort();
// if (closeDateLists.Count == 7)
// {
// closeAct = closeDateLists[closeDateLists.Count - 1].ToShortDateString();
// }
//}
//else if (itemOver.ProjectControl_JobType == "Other")
//{
// List<DateTime> closeDateLists = new List<DateTime>();
// var built = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D02_AS-BUILT");
// if (built != null)
// {
// if (built.ReceiveHC.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(built.ReceiveHC)); //竣工图接收日期
// }
// }
// if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
// {
// closeDateLists.Add(Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate));//商务关闭日期
// }
// var md = BLL.TDCService.GetTDCByEprojectId(itemOver.EProjectId, "D03_MD");
// if (md != null)
// {
// if (md.ReceivePDF.HasValue)
// {
// closeDateLists.Add(Convert.ToDateTime(md.ReceivePDF));//主控文档更新日期
// }
// }
// closeDateLists.Sort();
// if (closeDateLists.Count == 3)
// {
// closeAct = closeDateLists[closeDateLists.Count - 1].ToShortDateString();
// }
//}
#endregion
if (projectList.GetRow(rowIndex).GetCell(17) == null) projectList.GetRow(rowIndex).CreateCell(17);
if (!string.IsNullOrEmpty(itemOver.CloseAct))
{
projectList.GetRow(rowIndex).GetCell(17).SetCellValue(itemOver.CloseAct);
projectList.GetRow(rowIndex).GetCell(17).CellStyle = styleDate;
}
//Cancel Date
if (projectList.GetRow(rowIndex).GetCell(18) == null) projectList.GetRow(rowIndex).CreateCell(18);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_PC_CancelDate))
{
projectList.GetRow(rowIndex).GetCell(18).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_PC_CancelDate));
projectList.GetRow(rowIndex).GetCell(18).CellStyle = styleDate;
}
//B. Close
if (projectList.GetRow(rowIndex).GetCell(19) == null) projectList.GetRow(rowIndex).CreateCell(19);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_BC_CloseDate))
{
projectList.GetRow(rowIndex).GetCell(19).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_BC_CloseDate));
projectList.GetRow(rowIndex).GetCell(19).CellStyle = styleDate;
}
//Priority
if (projectList.GetRow(rowIndex).GetCell(20) == null) projectList.GetRow(rowIndex).CreateCell(20);
projectList.GetRow(rowIndex).GetCell(20).SetCellValue(itemOver.PM_General_Priority);
projectList.GetRow(rowIndex).GetCell(20).CellStyle.SetFont(cs_content_Font);
//Job Status
if (projectList.GetRow(rowIndex).GetCell(21) == null) projectList.GetRow(rowIndex).CreateCell(21);
projectList.GetRow(rowIndex).GetCell(21).SetCellValue(itemOver.ProjectControl_JobStatus);
projectList.GetRow(rowIndex).GetCell(21).CellStyle.SetFont(cs_content_Font);
//Sche.
if (projectList.GetRow(rowIndex).GetCell(22) == null) projectList.GetRow(rowIndex).CreateCell(22);
projectList.GetRow(rowIndex).GetCell(22).SetCellValue(itemOver.Schedule);
projectList.GetRow(rowIndex).GetCell(22).CellStyle.SetFont(cs_content_Font);
//Cost
if (projectList.GetRow(rowIndex).GetCell(23) == null) projectList.GetRow(rowIndex).CreateCell(23);
projectList.GetRow(rowIndex).GetCell(23).SetCellValue(itemOver.Cost);
projectList.GetRow(rowIndex).GetCell(23).CellStyle.SetFont(cs_content_Font);
//Scope
if (projectList.GetRow(rowIndex).GetCell(24) == null) projectList.GetRow(rowIndex).CreateCell(24);
projectList.GetRow(rowIndex).GetCell(24).SetCellValue(itemOver.Scope);
projectList.GetRow(rowIndex).GetCell(24).CellStyle.SetFont(cs_content_Font);
//MOC No.
if (projectList.GetRow(rowIndex).GetCell(25) == null) projectList.GetRow(rowIndex).CreateCell(25);
projectList.GetRow(rowIndex).GetCell(25).SetCellValue(itemOver.ProjectControl_MOCFormNo);
projectList.GetRow(rowIndex).GetCell(25).CellStyle.SetFont(cs_content_Font);
//Account
if (projectList.GetRow(rowIndex).GetCell(26) == null) projectList.GetRow(rowIndex).CreateCell(26);
projectList.GetRow(rowIndex).GetCell(26).SetCellValue(itemOver.ProjectControl_Account);
projectList.GetRow(rowIndex).GetCell(26).CellStyle.SetFont(cs_content_Font);
//PVI Pre.
if (projectList.GetRow(rowIndex).GetCell(27) == null) projectList.GetRow(rowIndex).CreateCell(27);
projectList.GetRow(rowIndex).GetCell(27).SetCellValue(Convert.ToDouble(itemOver.ProjectControl_PVIPrediction));
projectList.GetRow(rowIndex).GetCell(27).CellStyle.SetFont(cs_content_Font);
//Cost Eff.
if (projectList.GetRow(rowIndex).GetCell(28) == null) projectList.GetRow(rowIndex).CreateCell(28);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_CostEffectvitity))
{
projectList.GetRow(rowIndex).GetCell(28).SetCellValue(Convert.ToDouble(itemOver.ProjectControl_CostEffectvitity));
projectList.GetRow(rowIndex).GetCell(28).CellStyle.SetFont(cs_content_Font);
}
//Oper. Rep.
if (projectList.GetRow(rowIndex).GetCell(29) == null) projectList.GetRow(rowIndex).CreateCell(29);
projectList.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.ProjectControl_OperationRep);
projectList.GetRow(rowIndex).GetCell(29).CellStyle.SetFont(cs_content_Font);
//Process Eng.
if (projectList.GetRow(rowIndex).GetCell(30) == null) projectList.GetRow(rowIndex).CreateCell(30);
projectList.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.ProjectControl_CI_ProcessName);
projectList.GetRow(rowIndex).GetCell(30).CellStyle.SetFont(cs_content_Font);
//Equip. Eng.
if (projectList.GetRow(rowIndex).GetCell(31) == null) projectList.GetRow(rowIndex).CreateCell(31);
projectList.GetRow(rowIndex).GetCell(31).SetCellValue(itemOver.ProjectControl_CI_EquipmentName);
projectList.GetRow(rowIndex).GetCell(31).CellStyle.SetFont(cs_content_Font);
//Instr. Eng.
if (projectList.GetRow(rowIndex).GetCell(32) == null) projectList.GetRow(rowIndex).CreateCell(32);
projectList.GetRow(rowIndex).GetCell(32).SetCellValue(itemOver.ProjectControl_CI_InstrumentName);
projectList.GetRow(rowIndex).GetCell(32).CellStyle.SetFont(cs_content_Font);
//Elec. Eng.
if (projectList.GetRow(rowIndex).GetCell(33) == null) projectList.GetRow(rowIndex).CreateCell(33);
projectList.GetRow(rowIndex).GetCell(33).SetCellValue(itemOver.ProjectControl_CI_ElectricalName);
projectList.GetRow(rowIndex).GetCell(33).CellStyle.SetFont(cs_content_Font);
//Civil Eng.
if (projectList.GetRow(rowIndex).GetCell(34) == null) projectList.GetRow(rowIndex).CreateCell(34);
projectList.GetRow(rowIndex).GetCell(34).SetCellValue(itemOver.ProjectControl_CI_CivilName);
projectList.GetRow(rowIndex).GetCell(34).CellStyle.SetFont(cs_content_Font);
//CATEGORY
if (projectList.GetRow(rowIndex).GetCell(35) == null) projectList.GetRow(rowIndex).CreateCell(35);
projectList.GetRow(rowIndex).GetCell(35).SetCellValue(itemOver.PM_General_Category);
projectList.GetRow(rowIndex).GetCell(35).CellStyle.SetFont(cs_content_Font);
//PROJECT_CDI
if (projectList.GetRow(rowIndex).GetCell(36) == null) projectList.GetRow(rowIndex).CreateCell(36);
projectList.GetRow(rowIndex).GetCell(36).SetCellValue(itemOver.PM_General_CDI);
projectList.GetRow(rowIndex).GetCell(36).CellStyle.SetFont(cs_content_Font);
//IFC Received
if (projectList.GetRow(rowIndex).GetCell(37) == null) projectList.GetRow(rowIndex).CreateCell(37);
if (!string.IsNullOrEmpty(itemOver.IFC_Received))
{
projectList.GetRow(rowIndex).GetCell(37).SetCellValue((DateTime)Convert.ToDateTime(itemOver.IFC_Received));
projectList.GetRow(rowIndex).GetCell(37).CellStyle = styleDate;
}
//PROJ_DE_CIVIL_SCH_START_DATE
if (projectList.GetRow(rowIndex).GetCell(38) == null) projectList.GetRow(rowIndex).CreateCell(38);
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Civil_Sch_Start))
{
projectList.GetRow(rowIndex).GetCell(38).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Civil_Sch_Start));
projectList.GetRow(rowIndex).GetCell(38).CellStyle = styleDate;
}
//PROJ_DE_CIVIL_SCH_END_DATE
if (projectList.GetRow(rowIndex).GetCell(39) == null) projectList.GetRow(rowIndex).CreateCell(39);
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Civil_Sch_End))
{
projectList.GetRow(rowIndex).GetCell(39).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Civil_Sch_End));
projectList.GetRow(rowIndex).GetCell(39).CellStyle = styleDate;
}
//PROJ_DE_CIVIL_ACU_START_DATE
if (projectList.GetRow(rowIndex).GetCell(40) == null) projectList.GetRow(rowIndex).CreateCell(40);
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_CIVIL_ACU_START_DATE))
{
projectList.GetRow(rowIndex).GetCell(40).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_CIVIL_ACU_START_DATE));
projectList.GetRow(rowIndex).GetCell(40).CellStyle = styleDate;
}
//PROJ_DE_CIVIL_ACU_END_DATE
if (projectList.GetRow(rowIndex).GetCell(41) == null) projectList.GetRow(rowIndex).CreateCell(41);
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_CIVIL_ACU_END_DATE))
{
projectList.GetRow(rowIndex).GetCell(41).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_CIVIL_ACU_END_DATE));
projectList.GetRow(rowIndex).GetCell(41).CellStyle = styleDate;
}
//PROJ_DE_ME_SCH_START_DATE
if (projectList.GetRow(rowIndex).GetCell(42) == null) projectList.GetRow(rowIndex).CreateCell(42);
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Mech_EI_Sch_Start))
{
projectList.GetRow(rowIndex).GetCell(42).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Mech_EI_Sch_Start));
projectList.GetRow(rowIndex).GetCell(42).CellStyle = styleDate;
}
//PROJ_DE_ME_ACU_START_DATE
if (projectList.GetRow(rowIndex).GetCell(43) == null) projectList.GetRow(rowIndex).CreateCell(43);
if (!string.IsNullOrEmpty(itemOver.Detail_Eng_Mech_EI_Sch_End))
{
projectList.GetRow(rowIndex).GetCell(43).SetCellValue((DateTime)Convert.ToDateTime(itemOver.Detail_Eng_Mech_EI_Sch_End));
projectList.GetRow(rowIndex).GetCell(43).CellStyle = styleDate;
}
//PROJ_DE_ME_SCH_END_DATE
if (projectList.GetRow(rowIndex).GetCell(44) == null) projectList.GetRow(rowIndex).CreateCell(44);
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_ME_SCH_END_DATE))
{
projectList.GetRow(rowIndex).GetCell(44).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_ME_SCH_END_DATE));
projectList.GetRow(rowIndex).GetCell(44).CellStyle = styleDate;
}
//PROJ_DE_ME_ACU_END_DATE
if (projectList.GetRow(rowIndex).GetCell(45) == null) projectList.GetRow(rowIndex).CreateCell(45);
if (!string.IsNullOrEmpty(itemOver.PROJ_DE_ME_ACU_END_DATE))
{
projectList.GetRow(rowIndex).GetCell(45).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PROJ_DE_ME_ACU_END_DATE));
projectList.GetRow(rowIndex).GetCell(45).CellStyle = styleDate;
}
//PROJ_DE_LLI_SCH_START_DATE
if (projectList.GetRow(rowIndex).GetCell(46) == null) projectList.GetRow(rowIndex).CreateCell(46);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_LP_SchStart))
{
projectList.GetRow(rowIndex).GetCell(46).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_LP_SchStart));
projectList.GetRow(rowIndex).GetCell(46).CellStyle = styleDate;
}
//PROJ_DE_LLI_SCH_END_DATE
if (projectList.GetRow(rowIndex).GetCell(47) == null) projectList.GetRow(rowIndex).CreateCell(47);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_LP_SchEnd))
{
projectList.GetRow(rowIndex).GetCell(47).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_LP_SchEnd));
projectList.GetRow(rowIndex).GetCell(47).CellStyle = styleDate;
}
//PROJ_DE_LLI_ACU_START_DATE
if (projectList.GetRow(rowIndex).GetCell(48) == null) projectList.GetRow(rowIndex).CreateCell(48);
if (!string.IsNullOrEmpty(itemOver.PM_LLEP_RevisedStart))
{
projectList.GetRow(rowIndex).GetCell(48).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_LLEP_RevisedStart));
projectList.GetRow(rowIndex).GetCell(48).CellStyle = styleDate;
}
//PROJ_DE_LLI_ACU_END_DATE
if (projectList.GetRow(rowIndex).GetCell(49) == null) projectList.GetRow(rowIndex).CreateCell(49);
if (!string.IsNullOrEmpty(itemOver.PM_LLEP_RevisedEnd))
{
projectList.GetRow(rowIndex).GetCell(49).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_LLEP_RevisedEnd));
projectList.GetRow(rowIndex).GetCell(49).CellStyle = styleDate;
}
//PROJ_CN_CIVIL_SCH_START_DATE
if (projectList.GetRow(rowIndex).GetCell(50) == null) projectList.GetRow(rowIndex).CreateCell(50);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_CC_SchStart))
{
projectList.GetRow(rowIndex).GetCell(50).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_CC_SchStart));
projectList.GetRow(rowIndex).GetCell(50).CellStyle = styleDate;
}
//PROJ_CN_CIVIL_SCH_END_DATE
if (projectList.GetRow(rowIndex).GetCell(51) == null) projectList.GetRow(rowIndex).CreateCell(51);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_CC_SchEnd))
{
projectList.GetRow(rowIndex).GetCell(51).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_CC_SchEnd));
projectList.GetRow(rowIndex).GetCell(51).CellStyle = styleDate;
}
//PROJ_CN_CIVIL_ACU_START_DATE
if (projectList.GetRow(rowIndex).GetCell(52) == null) projectList.GetRow(rowIndex).CreateCell(52);
if (!string.IsNullOrEmpty(itemOver.CM_CC_RevisedStart))
{
projectList.GetRow(rowIndex).GetCell(52).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_CC_RevisedStart));
projectList.GetRow(rowIndex).GetCell(52).CellStyle = styleDate;
}
//PROJ_CN_CIVIL_ACU_END_DATE
if (projectList.GetRow(rowIndex).GetCell(53) == null) projectList.GetRow(rowIndex).CreateCell(53);
if (!string.IsNullOrEmpty(itemOver.CM_CC_RevisedEnd))
{
projectList.GetRow(rowIndex).GetCell(53).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_CC_RevisedEnd));
projectList.GetRow(rowIndex).GetCell(53).CellStyle = styleDate;
}
//PROJ_CN_ME_SCH_START_DATE
if (projectList.GetRow(rowIndex).GetCell(54) == null) projectList.GetRow(rowIndex).CreateCell(54);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_CM_SchStart))
{
projectList.GetRow(rowIndex).GetCell(54).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_CM_SchStart));
projectList.GetRow(rowIndex).GetCell(54).CellStyle = styleDate;
}
//PROJ_CN_ME_SCH_END_DATE
if (projectList.GetRow(rowIndex).GetCell(55) == null) projectList.GetRow(rowIndex).CreateCell(55);
if (!string.IsNullOrEmpty(itemOver.ProjectControl_CM_SchEnd))
{
projectList.GetRow(rowIndex).GetCell(55).SetCellValue((DateTime)Convert.ToDateTime(itemOver.ProjectControl_CM_SchEnd));
projectList.GetRow(rowIndex).GetCell(55).CellStyle = styleDate;
}
//PROJ_CN_ME_ACU_START_DATE
if (projectList.GetRow(rowIndex).GetCell(56) == null) projectList.GetRow(rowIndex).CreateCell(56);
if (!string.IsNullOrEmpty(itemOver.CM_CM_RevisedStart))
{
projectList.GetRow(rowIndex).GetCell(56).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_CM_RevisedStart));
projectList.GetRow(rowIndex).GetCell(56).CellStyle = styleDate;
}
//PROJ_CN_ME_ACU_END_DATE
if (projectList.GetRow(rowIndex).GetCell(57) == null) projectList.GetRow(rowIndex).CreateCell(57);
if (!string.IsNullOrEmpty(itemOver.CM_CM_RevisedEnd))
{
projectList.GetRow(rowIndex).GetCell(57).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_CM_RevisedEnd));
projectList.GetRow(rowIndex).GetCell(57).CellStyle = styleDate;
}
//Revised MC Date
if (projectList.GetRow(rowIndex).GetCell(58) == null) projectList.GetRow(rowIndex).CreateCell(58);
if (itemOver.ProjectControl_Revised_MC_Date.HasValue)
{
projectList.GetRow(rowIndex).GetCell(58).SetCellValue((DateTime)itemOver.ProjectControl_Revised_MC_Date.Value);
projectList.GetRow(rowIndex).GetCell(58).CellStyle = styleDate;
}
//Remarks
if (projectList.GetRow(rowIndex).GetCell(59) == null) projectList.GetRow(rowIndex).CreateCell(59);
projectList.GetRow(rowIndex).GetCell(59).SetCellValue(itemOver.ProjectControl_Remarks);
projectList.GetRow(rowIndex).GetCell(59).CellStyle.SetFont(cs_content_Font);
//PM_Critical
if (projectList.GetRow(rowIndex).GetCell(60) == null) projectList.GetRow(rowIndex).CreateCell(60);
projectList.GetRow(rowIndex).GetCell(60).SetCellValue(itemOver.PM_Critical);
projectList.GetRow(rowIndex).GetCell(60).CellStyle.SetFont(cs_content_Font);
//PM_ReasonForCritical
if (projectList.GetRow(rowIndex).GetCell(61) == null) projectList.GetRow(rowIndex).CreateCell(61);
projectList.GetRow(rowIndex).GetCell(61).SetCellValue(itemOver.PM_ReasonForCritical);
projectList.GetRow(rowIndex).GetCell(61).CellStyle.SetFont(cs_content_Font);
if (projectList.GetRow(rowIndex).GetCell(62) == null) projectList.GetRow(rowIndex).CreateCell(62);
projectList.GetRow(rowIndex).GetCell(62).SetCellValue(itemOver.StudyWo);
projectList.GetRow(rowIndex).GetCell(62).CellStyle.SetFont(cs_content_Font);
if (projectList.GetRow(rowIndex).GetCell(63) == null) projectList.GetRow(rowIndex).CreateCell(63);
projectList.GetRow(rowIndex).GetCell(63).SetCellValue(itemOver.CTEInvolved);
projectList.GetRow(rowIndex).GetCell(63).CellStyle.SetFont(cs_content_Font);
if (projectList.GetRow(rowIndex).GetCell(64) == null) projectList.GetRow(rowIndex).CreateCell(64);
projectList.GetRow(rowIndex).GetCell(64).SetCellValue(itemOver.CAPEXPlanNo);
projectList.GetRow(rowIndex).GetCell(64).CellStyle.SetFont(cs_content_Font);
if (projectList.GetRow(rowIndex).GetCell(65) == null) projectList.GetRow(rowIndex).CreateCell(65);
projectList.GetRow(rowIndex).GetCell(65).SetCellValue(itemOver.OutSourceType);
projectList.GetRow(rowIndex).GetCell(65).CellStyle.SetFont(cs_content_Font);
// MC Received Date
if (projectList.GetRow(rowIndex).GetCell(66) == null) projectList.GetRow(rowIndex).CreateCell(66);
if (!string.IsNullOrEmpty(itemOver.MC_ReceivedDate))
{
projectList.GetRow(rowIndex).GetCell(66).SetCellValue((DateTime)Convert.ToDateTime(itemOver.MC_ReceivedDate));
projectList.GetRow(rowIndex).GetCell(66).CellStyle = styleDate;
}
// Const.Kick-off Meeting
if (projectList.GetRow(rowIndex).GetCell(67) == null) projectList.GetRow(rowIndex).CreateCell(67);
if (!string.IsNullOrEmpty(itemOver.CM_KickOffMetting))
{
projectList.GetRow(rowIndex).GetCell(67).SetCellValue((DateTime)Convert.ToDateTime(itemOver.CM_KickOffMetting));
projectList.GetRow(rowIndex).GetCell(67).CellStyle = styleDate;
}
//EM
if (projectList.GetRow(rowIndex).GetCell(68) == null) projectList.GetRow(rowIndex).CreateCell(68);
projectList.GetRow(rowIndex).GetCell(68).SetCellValue(itemOver.ProjectControl_EMManager);
projectList.GetRow(rowIndex).GetCell(68).CellStyle.SetFont(cs_content_Font);
// PM_SC_ApprovedQty
if (projectList.GetRow(rowIndex).GetCell(69) == null) projectList.GetRow(rowIndex).CreateCell(69);
projectList.GetRow(rowIndex).GetCell(69).SetCellValue(itemOver.PM_SC_ApprovedQty);
projectList.GetRow(rowIndex).GetCell(69).CellStyle.SetFont(cs_content_Font);
// PM_SC_ApprovedCost
if (projectList.GetRow(rowIndex).GetCell(70) == null) projectList.GetRow(rowIndex).CreateCell(70);
projectList.GetRow(rowIndex).GetCell(70).SetCellValue((double)itemOver.PM_SC_ApprovedCost);
projectList.GetRow(rowIndex).GetCell(70).CellStyle = styleQfw;
// PM_Planning_Approval
if (projectList.GetRow(rowIndex).GetCell(71) == null) projectList.GetRow(rowIndex).CreateCell(71);
if (!string.IsNullOrEmpty(itemOver.PM_Planning_Approval))
{
projectList.GetRow(rowIndex).GetCell(71).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_Planning_Approval));
projectList.GetRow(rowIndex).GetCell(71).CellStyle = styleDate;
}
// PM_Pre_Approval
if (projectList.GetRow(rowIndex).GetCell(72) == null) projectList.GetRow(rowIndex).CreateCell(72);
if (!string.IsNullOrEmpty(itemOver.PM_Pre_Approval))
{
projectList.GetRow(rowIndex).GetCell(72).SetCellValue((DateTime)Convert.ToDateTime(itemOver.PM_Pre_Approval));
projectList.GetRow(rowIndex).GetCell(72).CellStyle = styleDate;
}
if (projectList.GetRow(rowIndex).GetCell(73) == null) projectList.GetRow(rowIndex).CreateCell(73);
projectList.GetRow(rowIndex).GetCell(73).SetCellValue(itemOver.Job_Hold);
projectList.GetRow(rowIndex).GetCell(73).CellStyle = styleQfw;
#endregion
rowIndex++;
}
}
#endregion
projectList.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=P02_Project_List_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();
}
/// <summary>
/// 根据sql获取数据
/// </summary>
/// <param name="strSql"></param>
/// <param name="tableName"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public static DataTable GetDataTableNameRunText(string strSql, string tableName = "", params SqlParameter[] parameters)
{
DataTable dataTable = string.IsNullOrEmpty(tableName) ? new DataTable() : new DataTable(tableName);
using (SqlConnection Connection = new SqlConnection(Funs.ConnString))
{
try
{
Connection.Open();
SqlCommand command = new SqlCommand(strSql, Connection);
command.CommandType = CommandType.Text;
if (parameters != null)
{
command.Parameters.AddRange(parameters);
}
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataTable);
}
finally
{
Connection.Close();
}
}
return dataTable;
}
#endregion
#region
protected string ConvertPro(object eprojectId)
{
DateTime? mcDate = null;
if (eprojectId != null && eprojectId.ToString() != "")
{
DateTime? civilDate = null;
DateTime? meDate = null;
var q = from x in Funs.DB.View_ProjectListReport where x.EProjectId == eprojectId.ToString() select x;
if (q.Count() > 0)
{
if (!string.IsNullOrEmpty(q.First().CM_CC_RevisedEnd))
{
civilDate = Convert.ToDateTime(q.First().CM_CC_RevisedEnd);
}
if (!string.IsNullOrEmpty(q.First().CM_CM_RevisedEnd))
{
meDate = Convert.ToDateTime(q.First().CM_CM_RevisedEnd);
}
if (civilDate != null && meDate != null)
{
if (civilDate > meDate)
{
mcDate = civilDate;
}
else
{
mcDate = meDate;
}
}
if (civilDate != null && meDate == null)
{
mcDate = civilDate;
}
if (civilDate == null && meDate != null)
{
mcDate = meDate;
}
}
}
if (mcDate != null)
{
return mcDate.Value.ToString("yyyy-MM-dd");
}
else
{
return "";
}
}
#endregion
#region
/// <summary>
/// 菜单按钮权限
/// </summary>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.ProjectListMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnOut))
{
this.btnExport.Hidden = false;
}
}
}
#endregion
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
}
}