777 lines
47 KiB
C#
777 lines
47 KiB
C#
using BLL;
|
|
using Microsoft.Reporting.WebForms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.Report
|
|
{
|
|
public partial class ReportPrint :PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
string report = Request.QueryString["report"];
|
|
string eProjectId = Request.QueryString["eProjectId"];
|
|
if (report == "2")
|
|
{
|
|
var eProject = BLL.EProjectService.GeteProjectById(eProjectId);
|
|
List<ReportParameter> paras = new List<ReportParameter>();
|
|
|
|
if (eProject != null)
|
|
{
|
|
//第1行
|
|
paras.Add(new ReportParameter("ReportDate", DateTime.Now.ToString("yyyy-MM-dd")));
|
|
|
|
//第2行
|
|
paras.Add(new ReportParameter("ReportCompany", " BASF - YPC Company Limited"));
|
|
paras.Add(new ReportParameter("ReportCurrUser", this.CurrUser.UserName));
|
|
|
|
//第3行
|
|
paras.Add(new ReportParameter("ProjectControl_JobNo", eProject.ProjectControl_JobNo));
|
|
|
|
//第4行
|
|
paras.Add(new ReportParameter("ProjectControl_JobTitle", eProject.ProjectControl_JobTitle));
|
|
paras.Add(new ReportParameter("ProjectControl_BUCode", eProject.ProjectControl_BUCode));
|
|
|
|
//第5行
|
|
//paras.Add(new ReportParameter("ProjectControl_OrginalBudget", decimal.Round(decimal.Parse(eProject.ProjectControl_OrginalBudget.ToString()), 0).ToString()));
|
|
paras.Add(new ReportParameter("ProjectControl_OrginalBudget", String.Format("{0:N2}", eProject.ProjectControl_OrginalBudget.HasValue ? eProject.ProjectControl_OrginalBudget.Value : 0)));
|
|
|
|
//第6行
|
|
|
|
//第7行
|
|
|
|
string scope = "";
|
|
decimal? m = eProject.PM_SC_ApprovedQty;//批准的变更数
|
|
decimal? n = eProject.PM_SC_PendingQty;//待定的变更数
|
|
if (n > 0)
|
|
{
|
|
scope = "C";
|
|
}
|
|
else if (n == 0 && m > 0)
|
|
{
|
|
scope = "B";
|
|
}
|
|
else if (m == 0 && n == 0)
|
|
{
|
|
scope = "A";
|
|
}
|
|
else
|
|
{
|
|
scope = "-";
|
|
}
|
|
paras.Add(new ReportParameter("scope", scope.ToString()));
|
|
|
|
string cost = "";
|
|
//获取项目的最新成本
|
|
//var costManage = BLL.CostReportService.GetMaxMonthCostReportByEprojectId(eProjectId);
|
|
//if (costManage != null)
|
|
//{
|
|
decimal? orginalBudget = eProject.ProjectControl_OrginalBudget.HasValue ? eProject.ProjectControl_OrginalBudget : 0;//原始的预算
|
|
decimal? changedBudget = eProject.ProjectControl_ChangedBudget.HasValue ? eProject.ProjectControl_ChangedBudget : 0;//变更的预算
|
|
decimal? actualCost = eProject.ProjectControl_Actual.HasValue ? eProject.ProjectControl_Actual : 0;//实际的成本
|
|
decimal? committedPRPO = eProject.ProjectControl_CommittedPRPO.HasValue ? eProject.ProjectControl_CommittedPRPO : 0;//承诺的PR或PO成本
|
|
decimal? committedSSRs = eProject.ProjectControl_CommittedSSRs.HasValue ? eProject.ProjectControl_CommittedSSRs : 0; //承诺的SSR成本
|
|
decimal? costToComplete = eProject.PM_General_CostToComplete.HasValue ? eProject.PM_General_CostToComplete : 0; //预估的完工任需成本
|
|
//预估的最终成本=实际的成本+承诺的PR或PO成本+承诺的SSR成本+预估的完工任需成本
|
|
decimal? rmb = actualCost + committedPRPO + committedSSRs + costToComplete;
|
|
//成本差异=(预估的最终成本-原始的预算-变更的预算)/(原始的预算+变更的预算)*100%
|
|
if (orginalBudget + changedBudget > 0)
|
|
{
|
|
double result = 0;
|
|
result = Convert.ToDouble((rmb - orginalBudget - changedBudget) / (orginalBudget + changedBudget)) /** 0.1*/;
|
|
if (result > 0.1)
|
|
{
|
|
cost = "C";
|
|
}
|
|
else if (result <= 0.1 && result > 0.05)
|
|
{
|
|
cost = "B";
|
|
}
|
|
else if (result <= 0.05)
|
|
{
|
|
cost = "A";
|
|
}
|
|
else
|
|
{
|
|
cost = "-";
|
|
}
|
|
}
|
|
//}
|
|
paras.Add(new ReportParameter("cost", cost.ToString()));
|
|
|
|
DateTime? ms = eProject.PM_MA_ProjectApproval.HasValue ? eProject.PM_MA_ProjectApproval : null; //项目批准的实际时间
|
|
DateTime? x = eProject.ProjectControl_CM_SchEnd.HasValue ? eProject.ProjectControl_CM_SchEnd : null;//计划的机械电仪施工结束时间
|
|
DateTime? y = eProject.CM_CM_RevisedEnd.HasValue ? eProject.CM_CM_RevisedEnd : null;//修正的机械电仪施工结束时间
|
|
int a = 0;
|
|
int b = 0;
|
|
int c = 0;
|
|
string schedule = "";
|
|
if (y.HasValue && x.HasValue)
|
|
{
|
|
a = (y - x).Value.Days;
|
|
}
|
|
if (x.HasValue && ms.HasValue)
|
|
{
|
|
b = (x - ms).Value.Days;
|
|
}
|
|
if (b != 0)
|
|
{
|
|
c = a / b;
|
|
if (c > 0.1)
|
|
{
|
|
schedule = "C";
|
|
}
|
|
else if (0.1 >= c && c > 0.05)
|
|
{
|
|
schedule = "B";
|
|
}
|
|
else if (c <= 0.05)
|
|
{
|
|
schedule = "A";
|
|
}
|
|
else
|
|
{
|
|
schedule = "-";
|
|
}
|
|
}
|
|
paras.Add(new ReportParameter("schedule", schedule.ToString()));
|
|
|
|
paras.Add(new ReportParameter("PM_SC_ApprovedQty", eProject.PM_SC_ApprovedQty.HasValue ? eProject.PM_SC_ApprovedQty.Value.ToString("N0") : "0"));
|
|
paras.Add(new ReportParameter("PM_SC_ApprovedCost", String.Format("{0:N2}", eProject.PM_SC_ApprovedCost.HasValue ? eProject.PM_SC_ApprovedCost.Value : 0)));
|
|
|
|
paras.Add(new ReportParameter("PM_SC_PendingQty", eProject.PM_SC_PendingQty.HasValue ? eProject.PM_SC_PendingQty.Value.ToString("N0") : "0"));
|
|
paras.Add(new ReportParameter("PM_SC_PendingCost", String.Format("{0:N2}", eProject.PM_SC_PendingCost.HasValue ? eProject.PM_SC_PendingCost.Value : 0)));
|
|
|
|
//新增加的逻辑数据
|
|
if (!eProject.Detail_Eng_Civil_SchStart.HasValue && !eProject.Detail_Eng_Civil_SchEnd.HasValue && !eProject.Detail_Eng_MechEI_SchStart.HasValue && !eProject.Detail_Eng_MechEI_SchEnd.HasValue)
|
|
{
|
|
var plan = BLL.ResourcePlanService.GetResourcePlanByEProjectId(eProjectId).FirstOrDefault();
|
|
if (plan != null)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_SchStart", plan.Detail_Eng_Civil_Sch_Start.HasValue ? string.Format("{0:yyyy-MM-dd}", plan.Detail_Eng_Civil_Sch_Start) : ""));
|
|
paras.Add(new ReportParameter("ProjectControl_CC_SchEnd", plan.Detail_Eng_Civil_Sch_End.HasValue ? string.Format("{0:yyyy-MM-dd}", plan.Detail_Eng_Civil_Sch_End) : ""));
|
|
paras.Add(new ReportParameter("ProjectControl_CC_SchEnd", plan.Detail_Eng_Civil_Sch_End.HasValue ? string.Format("{0:yyyy-MM-dd}", plan.Detail_Eng_Civil_Sch_End) : ""));
|
|
|
|
decimal schProgress = 0;
|
|
decimal civilSchStart = 0;
|
|
decimal civilSchEnd = 0;
|
|
if (plan.Detail_Eng_Civil_Sch_Start.HasValue)
|
|
{
|
|
civilSchStart = (DateTime.Now - plan.Detail_Eng_Civil_Sch_Start).Value.Days;
|
|
}
|
|
if (plan.Detail_Eng_Civil_Sch_Start.HasValue && plan.Detail_Eng_Civil_Sch_End.HasValue)
|
|
{
|
|
civilSchEnd = (plan.Detail_Eng_Civil_Sch_End - plan.Detail_Eng_Civil_Sch_Start).Value.Days;
|
|
}
|
|
if (civilSchEnd > 0)
|
|
{
|
|
schProgress = civilSchStart / civilSchEnd * 100;
|
|
|
|
if (schProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", "100.00"));
|
|
}
|
|
else if (schProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", schProgress.ToString("0.00")));
|
|
}
|
|
}
|
|
paras.Add(new ReportParameter("ProjectControl_CM_SchStart", plan.Detail_Eng_Mech_EI_Sch_Start.HasValue ? string.Format("{0:yyyy-MM-dd}", plan.Detail_Eng_Mech_EI_Sch_Start) : ""));
|
|
paras.Add(new ReportParameter("ProjectControl_CM_SchEnd", plan.Detail_Eng_Mech_EI_Sch_End.HasValue ? string.Format("{0:yyyy-MM-dd}", plan.Detail_Eng_Mech_EI_Sch_End) : ""));
|
|
|
|
decimal schMechEIProgress = 0;
|
|
decimal mechEISchStart = 0;
|
|
decimal mechEISchEnd = 0;
|
|
if (plan.Detail_Eng_Mech_EI_Sch_Start.HasValue)
|
|
{
|
|
mechEISchStart = (DateTime.Now - plan.Detail_Eng_Mech_EI_Sch_Start).Value.Days;
|
|
}
|
|
if (plan.Detail_Eng_Mech_EI_Sch_Start.HasValue && plan.Detail_Eng_Mech_EI_Sch_End.HasValue)
|
|
{
|
|
mechEISchEnd = (plan.Detail_Eng_Mech_EI_Sch_End - plan.Detail_Eng_Mech_EI_Sch_Start).Value.Days;
|
|
}
|
|
if (mechEISchEnd > 0)
|
|
{
|
|
schMechEIProgress = mechEISchStart / mechEISchEnd * 100;
|
|
}
|
|
if (schMechEIProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", "100.00"));
|
|
}
|
|
else if (schMechEIProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", schMechEIProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//老数据有值显示老数据中的值
|
|
if (eProject.Detail_Eng_Civil_SchStart.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_SchStart", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_Civil_SchStart)));
|
|
}
|
|
if (eProject.Detail_Eng_Civil_SchEnd.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_SchEnd", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_Civil_SchEnd)));
|
|
}
|
|
if (eProject.Detail_Eng_Civil_SchProgress.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", eProject.Detail_Eng_Civil_SchProgress.Value.ToString("#0.00")));
|
|
}
|
|
else
|
|
{
|
|
decimal schEngCivilProgress = 0;
|
|
decimal schEngCivilStart = 0;
|
|
decimal schEngCivilEnd = 0;
|
|
if (eProject.Detail_Eng_Civil_SchStart.HasValue)
|
|
{
|
|
schEngCivilStart = (DateTime.Now - eProject.Detail_Eng_Civil_SchStart).Value.Days;
|
|
}
|
|
if (eProject.Detail_Eng_Civil_SchStart.HasValue && eProject.Detail_Eng_Civil_SchEnd.HasValue)
|
|
{
|
|
schEngCivilEnd = (eProject.Detail_Eng_Civil_SchEnd - eProject.Detail_Eng_Civil_SchStart).Value.Days;
|
|
}
|
|
if (schEngCivilEnd > 0)
|
|
{
|
|
schEngCivilProgress = schEngCivilStart / schEngCivilEnd * 100;
|
|
}
|
|
if (schEngCivilProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", "100.00"));
|
|
}
|
|
else if (schEngCivilProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CC_Progress", schEngCivilProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_SchStart.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_SchStart", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_MechEI_SchStart)));
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_SchEnd.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_SchEnd", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_MechEI_SchEnd)));
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_ReviseProgress.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", eProject.Detail_Eng_MechEI_ReviseProgress.Value.ToString("#0.00")));
|
|
}
|
|
else
|
|
{
|
|
decimal schEngMechEIProgress = 0;
|
|
decimal schEngMechEIStart = 0;
|
|
decimal schEngMechEIEnd = 0;
|
|
if (eProject.Detail_Eng_MechEI_SchStart.HasValue)
|
|
{
|
|
schEngMechEIStart = (DateTime.Now - eProject.Detail_Eng_MechEI_SchStart).Value.Days;
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_SchStart.HasValue && eProject.Detail_Eng_MechEI_SchEnd.HasValue)
|
|
{
|
|
schEngMechEIEnd = (eProject.Detail_Eng_MechEI_SchEnd - eProject.Detail_Eng_MechEI_SchStart).Value.Days;
|
|
}
|
|
if (schEngMechEIEnd > 0)
|
|
{
|
|
schEngMechEIProgress = schEngMechEIStart / schEngMechEIEnd * 100;
|
|
}
|
|
if (schEngMechEIProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", "100.00"));
|
|
}
|
|
else if (schEngMechEIProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_CM_Progress", schEngMechEIProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
}
|
|
#region CivilRevised
|
|
//针对新数据
|
|
if (!eProject.Detail_Eng_Civil_ReviseStart.HasValue && !eProject.Detail_Eng_Civil_ReviseEnd.HasValue && !eProject.Detail_Eng_MechEI_ReviseStart.HasValue && !eProject.Detail_Eng_MechEI_ReviseEnd.HasValue)
|
|
{
|
|
decimal civilRevisedStart = 0;
|
|
decimal civilRevisedEnd = 0;
|
|
decimal civilRevisedProgress = 0;
|
|
List<DateTime> startlists = new List<DateTime>();
|
|
List<DateTime> endlists = new List<DateTime>();
|
|
|
|
var pmList = BLL.PMService.GetPMByEprojectId(eProjectId);
|
|
foreach (var item in pmList)
|
|
{
|
|
if (item.DisciplinesWBSName == "Civil")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
startlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
endlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Masterplanning")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
startlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
endlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Architectral")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
startlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
endlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "HVAC")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
startlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
endlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
startlists.Sort();
|
|
endlists.Sort();
|
|
}
|
|
if (startlists.Count > 0)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedStart", string.Format("{0:yyyy-MM-dd}", startlists.FirstOrDefault())));
|
|
}
|
|
if (endlists.Count > 0)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedEnd", string.Format("{0:yyyy-MM-dd}", endlists.LastOrDefault())));
|
|
}
|
|
if (startlists.FirstOrDefault() != null)
|
|
{
|
|
civilRevisedStart = (DateTime.Now - Convert.ToDateTime(startlists.FirstOrDefault())).Days;
|
|
}
|
|
if (startlists.FirstOrDefault() != null && endlists.LastOrDefault() != null)
|
|
{
|
|
civilRevisedEnd = (endlists.LastOrDefault() - startlists.FirstOrDefault()).Days;
|
|
}
|
|
if (civilRevisedEnd > 0)
|
|
{
|
|
civilRevisedProgress = civilRevisedStart / civilRevisedEnd * 100;
|
|
}
|
|
if (civilRevisedProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", "100.00"));
|
|
}
|
|
else if (civilRevisedProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", civilRevisedProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
else//针对老数据
|
|
{
|
|
if (eProject.Detail_Eng_Civil_ReviseStart.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedStart", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_Civil_ReviseStart)));
|
|
}
|
|
if (eProject.Detail_Eng_Civil_ReviseEnd.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedEnd", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_Civil_ReviseEnd)));
|
|
}
|
|
if (eProject.Detail_Eng_Civil_ReviseProgress.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", eProject.Detail_Eng_Civil_ReviseProgress.Value.ToString("#0.00")));
|
|
}
|
|
else
|
|
{
|
|
decimal revisedEngCivilProgress = 0;
|
|
decimal revisedEngCivilStart = 0;
|
|
decimal revisedEngCivilEnd = 0;
|
|
if (eProject.Detail_Eng_Civil_ReviseStart.HasValue)
|
|
{
|
|
revisedEngCivilStart = (DateTime.Now - eProject.Detail_Eng_Civil_ReviseStart).Value.Days;
|
|
}
|
|
if (eProject.Detail_Eng_Civil_ReviseStart.HasValue && eProject.Detail_Eng_Civil_ReviseEnd.HasValue)
|
|
{
|
|
revisedEngCivilEnd = (eProject.Detail_Eng_Civil_ReviseEnd - eProject.Detail_Eng_Civil_ReviseStart).Value.Days;
|
|
}
|
|
if (revisedEngCivilEnd > 0)
|
|
{
|
|
revisedEngCivilProgress = revisedEngCivilStart / revisedEngCivilEnd * 100;
|
|
}
|
|
if (revisedEngCivilProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", "100.00"));
|
|
}
|
|
else if (revisedEngCivilProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("civilRevisedProgress", revisedEngCivilProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region MechEIRevised
|
|
//针对新数据
|
|
if (!eProject.Detail_Eng_MechEI_SchStart.HasValue && !eProject.Detail_Eng_MechEI_SchEnd.HasValue && !eProject.Detail_Eng_MechEI_ReviseStart.HasValue && !eProject.Detail_Eng_MechEI_ReviseEnd.HasValue)
|
|
{
|
|
decimal mechEIRevisedStart = 0;
|
|
decimal mechEIRevisedEnd = 0;
|
|
decimal mechEIRevisedProgress = 0;
|
|
List<DateTime> mechEIstartlists = new List<DateTime>();
|
|
List<DateTime> mechEIendlists = new List<DateTime>();
|
|
|
|
var pmLists = BLL.PMService.GetPMByEprojectId(eProjectId);
|
|
foreach (var item in pmLists)
|
|
{
|
|
if (item.DisciplinesWBSName == "Electrical")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Telecommunication")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Instrument")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "PID")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Process")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Plumbing/F.F")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Mech./Equi.")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
else if (item.DisciplinesWBSName == "Piping")
|
|
{
|
|
if (item.RevisedStart.HasValue)
|
|
{
|
|
mechEIstartlists.Add(Convert.ToDateTime(item.RevisedStart));
|
|
}
|
|
if (item.RevisedEnd.HasValue)
|
|
{
|
|
mechEIendlists.Add(Convert.ToDateTime(item.RevisedEnd));
|
|
}
|
|
}
|
|
mechEIstartlists.Sort();
|
|
mechEIendlists.Sort();
|
|
}
|
|
if (mechEIstartlists.Count > 0)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedStart", string.Format("{0:yyyy-MM-dd}", mechEIstartlists.FirstOrDefault())));
|
|
}
|
|
if (mechEIendlists.Count > 0)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedEnd", string.Format("{0:yyyy-MM-dd}", mechEIendlists.LastOrDefault())));
|
|
}
|
|
if (mechEIstartlists.FirstOrDefault() != null)
|
|
{
|
|
mechEIRevisedStart = (DateTime.Now - Convert.ToDateTime(mechEIstartlists.FirstOrDefault())).Days;
|
|
}
|
|
if (mechEIstartlists.FirstOrDefault() != null && mechEIendlists.LastOrDefault() != null)
|
|
{
|
|
mechEIRevisedEnd = (mechEIendlists.LastOrDefault() - mechEIstartlists.FirstOrDefault()).Days;
|
|
}
|
|
if (mechEIRevisedEnd > 0)
|
|
{
|
|
mechEIRevisedProgress = mechEIRevisedStart / mechEIRevisedEnd * 100;
|
|
}
|
|
if (mechEIRevisedProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", "100.00"));
|
|
}
|
|
else if (mechEIRevisedProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", mechEIRevisedProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
else //针对老数据
|
|
{
|
|
if (eProject.Detail_Eng_MechEI_ReviseStart.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedStart", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_MechEI_ReviseStart)));
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_ReviseEnd.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedEnd", string.Format("{0:yyyy-MM-dd}", eProject.Detail_Eng_MechEI_ReviseEnd)));
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_ReviseProgress.HasValue)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", eProject.Detail_Eng_MechEI_ReviseProgress.Value.ToString("#0.00")));
|
|
}
|
|
else
|
|
{
|
|
decimal DE_mechEIRevisedStart = 0;
|
|
decimal DE_mechEIRevisedEnd = 0;
|
|
decimal DE_mechEIRevisedProgress = 0;
|
|
if (eProject.Detail_Eng_MechEI_ReviseStart.HasValue)
|
|
{
|
|
DE_mechEIRevisedStart = (DateTime.Now - eProject.Detail_Eng_MechEI_ReviseStart).Value.Days;
|
|
}
|
|
if (eProject.Detail_Eng_MechEI_ReviseStart.HasValue && eProject.Detail_Eng_MechEI_ReviseEnd.HasValue)
|
|
{
|
|
DE_mechEIRevisedEnd = (eProject.Detail_Eng_MechEI_ReviseEnd - eProject.Detail_Eng_MechEI_ReviseStart).Value.Days;
|
|
}
|
|
DE_mechEIRevisedProgress = DE_mechEIRevisedStart / DE_mechEIRevisedEnd * 100;
|
|
if (DE_mechEIRevisedProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", "100.00"));
|
|
}
|
|
else if (DE_mechEIRevisedProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("mechEIRevisedProgress", DE_mechEIRevisedProgress.ToString("#0.00")));
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
string ProjectControl_LP_SchStart = eProject.ProjectControl_LP_SchStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_LP_SchStart) : "";
|
|
paras.Add(new ReportParameter("ProjectControl_LP_SchStart", ProjectControl_LP_SchStart));
|
|
|
|
string ProjectControl_LP_SchEnd = eProject.ProjectControl_LP_SchEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_LP_SchEnd) : "";
|
|
paras.Add(new ReportParameter("ProjectControl_LP_SchEnd", ProjectControl_LP_SchEnd));
|
|
if (eProject.ProjectControl_LP_Progress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_LP_Progress", "100.00"));
|
|
}
|
|
else if (eProject.ProjectControl_LP_Progress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_LP_Progress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ProjectControl_LP_Progress", eProject.ProjectControl_LP_Progress.ToString()));
|
|
}
|
|
|
|
paras.Add(new ReportParameter("PM_LLEP_RevisedStart", eProject.PM_LLEP_RevisedStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.PM_LLEP_RevisedStart) : ""));
|
|
paras.Add(new ReportParameter("PM_LLEP_RevisedEnd", eProject.PM_LLEP_RevisedEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.PM_LLEP_RevisedEnd) : ""));
|
|
if (eProject.PM_LLEP_ActualProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("PM_LLEP_ActualProgress", "100.00"));
|
|
}
|
|
else if (eProject.PM_LLEP_ActualProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("PM_LLEP_ActualProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("PM_LLEP_ActualProgress", eProject.PM_LLEP_ActualProgress.ToString()));
|
|
}
|
|
paras.Add(new ReportParameter("ConstCivilSchStart", eProject.ProjectControl_CC_SchStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_CC_SchStart) : ""));
|
|
paras.Add(new ReportParameter("ConstCivilSchEnd", eProject.ProjectControl_CC_SchEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_CC_SchEnd) : ""));
|
|
if (eProject.ProjectControl_CC_Progress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ConstCivilSchProgress", "100.00"));
|
|
}
|
|
else if (eProject.ProjectControl_CC_Progress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ConstCivilSchProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ConstCivilSchProgress", eProject.ProjectControl_CC_Progress.ToString()));
|
|
}
|
|
paras.Add(new ReportParameter("ConstMechEISchStart", eProject.ProjectControl_CM_SchStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_CM_SchStart) : ""));
|
|
paras.Add(new ReportParameter("ConstMechEISchEnd", eProject.ProjectControl_CM_SchEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_CM_SchEnd) : ""));
|
|
if (eProject.ProjectControl_CM_Progress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("ConstMechEISchProgress", "100.00"));
|
|
}
|
|
else if (eProject.ProjectControl_CM_Progress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("ConstMechEISchProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("ConstMechEISchProgress", eProject.ProjectControl_CM_Progress.ToString()));
|
|
}
|
|
paras.Add(new ReportParameter("CM_CC_RevisedStart", eProject.CM_CC_RevisedStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.CM_CC_RevisedStart) : ""));
|
|
|
|
paras.Add(new ReportParameter("CM_CC_RevisedEnd", eProject.CM_CC_RevisedEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.CM_CC_RevisedEnd) : ""));
|
|
|
|
if (eProject.CM_CC_AcutalProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("CM_CC_AcutalProgress", "100.00"));
|
|
}
|
|
else if (eProject.CM_CC_AcutalProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("CM_CC_AcutalProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("CM_CC_AcutalProgress", eProject.CM_CC_AcutalProgress.ToString()));
|
|
}
|
|
paras.Add(new ReportParameter("CM_CM_RevisedStart", eProject.CM_CM_RevisedStart.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.CM_CM_RevisedStart) : ""));
|
|
paras.Add(new ReportParameter("CM_CM_RevisedEnd", eProject.CM_CM_RevisedEnd.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.CM_CM_RevisedEnd) : ""));
|
|
|
|
if (eProject.CM_CM_AcutalProgress > 100)
|
|
{
|
|
paras.Add(new ReportParameter("CM_CM_AcutalProgress", "100.00"));
|
|
}
|
|
else if (eProject.CM_CM_AcutalProgress < 0)
|
|
{
|
|
paras.Add(new ReportParameter("CM_CM_AcutalProgress", "0.00"));
|
|
}
|
|
else
|
|
{
|
|
paras.Add(new ReportParameter("CM_CM_AcutalProgress", eProject.CM_CM_AcutalProgress.ToString()));
|
|
}
|
|
string ProjectControl_MS_MC = eProject.ProjectControl_MS_MC.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.ProjectControl_MS_MC) : "";
|
|
paras.Add(new ReportParameter("ProjectControl_MS_MC", ProjectControl_MS_MC));
|
|
paras.Add(new ReportParameter("CM_MA_MC", eProject.CM_MA_MC.HasValue ? string.Format("{0:yyyy-MM-dd}", eProject.CM_MA_MC) : ""));
|
|
|
|
|
|
string variance = "";
|
|
|
|
paras.Add(new ReportParameter("OrginalBudget", String.Format("{0:N2}", orginalBudget)));
|
|
paras.Add(new ReportParameter("ActualCost", String.Format("{0:N2}", actualCost)));
|
|
|
|
decimal? committed = committedPRPO + committedSSRs;
|
|
paras.Add(new ReportParameter("committed", String.Format("{0:N2}", committed)));
|
|
paras.Add(new ReportParameter("CostToComplete", String.Format("{0:N2}", costToComplete)));
|
|
|
|
decimal? estimatedFinalCost = actualCost + committed + costToComplete;
|
|
paras.Add(new ReportParameter("estimatedFinalCost", String.Format("{0:N2}", estimatedFinalCost)));
|
|
|
|
if (orginalBudget + changedBudget > 0)
|
|
{
|
|
decimal? cbchj = (estimatedFinalCost - orginalBudget - changedBudget) / (orginalBudget + changedBudget) * 100;
|
|
variance = decimal.Round(decimal.Parse(cbchj.ToString()), 2).ToString() + "%";
|
|
|
|
}
|
|
paras.Add(new ReportParameter("variance", variance));
|
|
|
|
|
|
paras.Add(new ReportParameter("PM_Remarks_Engineering", eProject.PM_Remarks_Engineering));
|
|
paras.Add(new ReportParameter("PM_Remarks_Procurement", eProject.PM_Remarks_Procurement));
|
|
paras.Add(new ReportParameter("CM_Remarks_Procurement", eProject.CM_Remarks_Procurement));
|
|
paras.Add(new ReportParameter("CM_Remarks_Construction", eProject.CM_Remarks_Construction));
|
|
paras.Add(new ReportParameter("CM_Remarks_QualityHSE", eProject.CM_Remarks_QualityHSE));
|
|
paras.Add(new ReportParameter("ProjectControl_ProjectManager", eProject.ProjectControl_ProjectManager));
|
|
paras.Add(new ReportParameter("ProjectControl_ConstManager", eProject.ProjectControl_ConstManager));
|
|
|
|
string areasofConcern = "";
|
|
var areaConcern = BLL.AreaConcernService.GetAreaConcernListByEprojectId(eProjectId);
|
|
if (areaConcern.Count > 0)
|
|
{
|
|
for (int i = 0; i < areaConcern.Count; i++)
|
|
{
|
|
if (i < 3)//获取最新的3条数据
|
|
{
|
|
areasofConcern += areaConcern[i].Remark + "|";
|
|
}
|
|
}
|
|
areasofConcern = areasofConcern.Substring(0, areasofConcern.LastIndexOf('|'));
|
|
}
|
|
paras.Add(new ReportParameter("AreasofConcern", areasofConcern));
|
|
|
|
}
|
|
|
|
List<Model.Editor_EProject> list = new List<Model.Editor_EProject>();
|
|
ReportDataSource rds = new ReportDataSource("DataSet1", list);
|
|
ReportViewer1.LocalReport.ReportPath = "Report/Report1.rdlc";
|
|
ReportViewer1.LocalReport.DataSources.Add(rds);
|
|
ReportViewer1.LocalReport.SetParameters(paras);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |