增加进度报表
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BLL;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.JDGL.CostAnalysis
|
||||
{
|
||||
public partial class JDReport : PageBase
|
||||
{
|
||||
#region 加载页面
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
||||
GetValue();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetEmpty()
|
||||
{
|
||||
this.SimpleForm1.Title = string.Empty;
|
||||
txt2.Text = string.Empty;
|
||||
txt3.Text = string.Empty;
|
||||
txt4.Text = string.Empty;
|
||||
txt5.Text = string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取记录值
|
||||
private void GetValue()
|
||||
{
|
||||
BindChart();
|
||||
//Model.Information_SafetyBriefing report = Funs.DB.Information_SafetyBriefing.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.Month == month && e.YearId == year);
|
||||
//if (report != null)
|
||||
//{
|
||||
// string upState = string.Empty;
|
||||
// if (report.UpState == BLL.Const.UpState_3)
|
||||
// {
|
||||
// upState = "(已上报)";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// upState = "(未上报)";
|
||||
// }
|
||||
// this.SimpleForm1.Title = "实业安全简报" + report.YearId + "年 " + report.Month + "月" + upState;
|
||||
// lbUnitName.Text = "填报企业:" + BLL.UnitService.GetUnitNameByUnitId(report.UnitId);
|
||||
// lbCompileMan.Text = "编制人:" + BLL.UserService.GetUserNameByUserId(report.CompileMan);
|
||||
// lbAuditor.Text = "审核人:" + report.Auditor;
|
||||
// lbApprover.Text = "审批人:" + report.Approver;
|
||||
// this.txtMainWork.Text = report.MainWork;
|
||||
// this.txtHazardRecording.Text = report.HazardRecording;
|
||||
// this.txtSafetyAccident.Text = report.SafetyAccident;
|
||||
// this.txtEPAccident.Text = report.EPAccident;
|
||||
// this.txtOHAccident.Text = report.OHAccident;
|
||||
// this.txtWorkPermitNum.Text = report.WorkPermitNum;
|
||||
// this.txtHiddenDangerDetection.Text = report.HiddenDangerDetection;
|
||||
// this.txtRectificationSituation.Text = report.RectificationSituation;
|
||||
// this.txtCheckProblemsRectification.Text = report.CheckProblemsRectification;
|
||||
// this.txtPendingProject.Text = report.PendingProject;
|
||||
// this.txtContractorManagement.Text = report.ContractorManagement;
|
||||
// this.txtEnvironmentalEmissions.Text = report.EnvironmentalEmissions;
|
||||
// this.txtNextMonthWorkPlan.Text = report.NextMonthWorkPlan;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// SetEmpty();
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据绑定
|
||||
/// <summary>
|
||||
/// 数据绑定
|
||||
/// </summary>
|
||||
private void BindChart()
|
||||
{
|
||||
Model.Project_Installation installation = BLL.Project_InstallationService.GetProjectInstallationByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (installation != null && !string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
|
||||
{
|
||||
string id = installation.InstallationId;
|
||||
string date = this.txtMonths.Text.Trim() + "-01";
|
||||
string strSql = "select distinct (cast(YEAR(Months) as varchar(4))+'.'+cast(MONTH(Months) as varchar(2))) as 月份,t.Months," +
|
||||
"ThisRealCost as '本月已完工作实际费用-ACWP',ThisPlanCost as '本月已完工作预算费用-BCWP',ThisPlanValue as '本月计划工作预算费用-BCWS',TotalPlanValue as '累计计划工作预算费用-BCWS',TotalRealCost as '累计已完工作实际费用-ACWP',TotalPlanCost as '累计已完工作预算费用-BCWP' " +
|
||||
"from dbo.View_WBS_CostControlParentDetail as t where ParentId=@Id and t.Months<=@Months order by t.Months";
|
||||
//string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-01";
|
||||
SqlParameter[] parameter = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@Id",id),
|
||||
new SqlParameter("@Months",date),
|
||||
};
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
decimal lastbcws = 0, bcws = 0, lastacwp = 0, acwp = 0, lastbcwp = 0, bcwp = 0;
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
dt.Rows[i]["本月已完工作实际费用-ACWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作实际费用-ACWP"].ToString()) / 10000;
|
||||
dt.Rows[i]["本月已完工作预算费用-BCWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作预算费用-BCWP"].ToString()) / 10000;
|
||||
dt.Rows[i]["本月计划工作预算费用-BCWS"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月计划工作预算费用-BCWS"].ToString()) / 10000;
|
||||
bcws = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计计划工作预算费用-BCWS"].ToString());
|
||||
acwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作实际费用-ACWP"].ToString());
|
||||
bcwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作预算费用-BCWP"].ToString());
|
||||
if (bcws == lastbcws)
|
||||
{
|
||||
if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
|
||||
{
|
||||
dt.Rows[i]["累计计划工作预算费用-BCWS"] = DBNull.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000;
|
||||
}
|
||||
if (acwp == lastacwp)
|
||||
{
|
||||
if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
|
||||
{
|
||||
dt.Rows[i]["累计已完工作实际费用-ACWP"] = DBNull.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000;
|
||||
}
|
||||
if (bcwp == lastbcwp)
|
||||
{
|
||||
if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now)
|
||||
{
|
||||
dt.Rows[i]["累计已完工作预算费用-BCWP"] = DBNull.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000;
|
||||
}
|
||||
lastbcws = bcws;
|
||||
lastacwp = acwp;
|
||||
lastbcwp = bcwp;
|
||||
}
|
||||
this.ChartEV.CreateMaryChart(dt, 1220, 420, null);
|
||||
decimal BCWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计已完工作预算费用-BCWP"].ToString());
|
||||
decimal BCWS = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计计划工作预算费用-BCWS"].ToString());
|
||||
decimal ACWP = Funs.GetNewDecimalOrZero(dt.Rows[dt.Rows.Count - 1]["累计已完工作实际费用-ACWP"].ToString());
|
||||
decimal CV = BCWP - ACWP;
|
||||
decimal SV = BCWP - BCWS;
|
||||
decimal CPI = BCWP / ACWP;
|
||||
decimal SPI = BCWP / BCWS;
|
||||
this.txt2.Text = "总体施工进度赢得值参数:\r\nBCWP:" + BCWP.ToString("0.####") + "\r\nBCWS:" + BCWS.ToString("0.####") + "\r\nACWP:" + ACWP.ToString("0.####") + "\r\nCV:" + CV.ToString("0.####") + "\r\nSV:" + SV.ToString("0.####") + "\r\nCPI:" + CPI.ToString("0.####") + "\r\nSPI:" + SPI.ToString("0.####");
|
||||
|
||||
|
||||
|
||||
//BCWP、BCWS、ACWP
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 查询
|
||||
/// <summary>
|
||||
/// 查询按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetValue();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关闭弹出窗口
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
GetValue();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Response.ClearContent();
|
||||
//string filename = Funs.GetNewFileName();
|
||||
//Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("工作量统计" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
//Response.ContentType = "application/excel";
|
||||
//Response.ContentEncoding = Encoding.UTF8;
|
||||
//this.Grid1.PageSize = Grid1.RecordCount;
|
||||
//Response.Write(GetGridTableHtml2(Grid1));
|
||||
//Response.End();
|
||||
//DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
|
||||
//DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, BLL.Const._Null, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
|
||||
//Grid1.DataSource = table;
|
||||
//Grid1.DataBind();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user