CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/JDGL/WBS/WorkloadStatistics.aspx.cs

218 lines
9.4 KiB
C#
Raw Normal View History

2021-08-13 11:15:59 +08:00
using BLL;
using System;
using System.Data;
using System.Linq;
2021-09-15 14:50:52 +08:00
using System.Text;
2021-08-13 11:15:59 +08:00
using System.Web.UI.WebControls;
namespace FineUIPro.Web.JDGL.WBS
{
public partial class WorkloadStatistics : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.drpCnProfession.DataValueField = "CnProfessionId";
this.drpCnProfession.DataTextField = "CnProfessionName";
this.drpCnProfession.DataSource = BLL.CnProfessionInitService.GetCnProfessionInitDropDownList();
this.drpCnProfession.DataBind();
Funs.FineUIPleaseSelect(drpCnProfession);
Funs.FineUIPleaseSelect(drpUnitProject);
Funs.FineUIPleaseSelect(drpWbsSet);
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
2021-09-23 14:45:21 +08:00
Funs.FineUIPleaseSelect(this.drpWeek);
InitWeek();
2021-08-13 11:15:59 +08:00
}
}
#endregion
2021-09-23 14:45:21 +08:00
private void InitWeek()
{
if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
{
this.Grid1.Columns[5].HeaderText = "本月计划完成量(B)";
this.Grid1.Columns[6].HeaderText = "本月完成量(C)";
this.Grid1.Columns[8].HeaderText = "本月已完工作实际费用-ACWP(A*C)";
this.Grid1.Columns[9].HeaderText = "本月计划工作预算费用-BCWS(B*D)";
this.Grid1.Columns[10].HeaderText = "本月已完工作预算费用-BCWP(C*D)";
this.drpWeek.Items.Clear();
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01");
string costControlId = BLL.CostControlDetailService.GetHasWeekPlanCostControlIdByProjectIdAndMonth(this.CurrUser.LoginProjectId, months);
if (!string.IsNullOrEmpty(costControlId))
{
BLL.CostControlDetailService.InitWeekPlanList(this.drpWeek, costControlId, months, true);
this.drpWeek.SelectedValue = BLL.Const._Null;
}
else
{
Funs.FineUIPleaseSelect(this.drpWeek);
2021-09-23 15:48:02 +08:00
this.drpWeek.SelectedValue = BLL.Const._Null;
2021-09-23 14:45:21 +08:00
}
}
}
#region
/// <summary>
/// 月份选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtMonths_TextChanged(object sender, EventArgs e)
{
InitWeek();
}
#endregion
2021-08-13 11:15:59 +08:00
#region
/// <summary>
/// 查询按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
{
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim());
//if (this.rblStatisticsType.SelectedValue == "1")
//{
2021-09-23 14:45:21 +08:00
DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpWeek.SelectedValue, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
2021-08-13 11:15:59 +08:00
Grid1.DataSource = table;
Grid1.DataBind();
//}
//else
//{
// if (this.drpCnProfession.SelectedValue != BLL.Const._Null)
// {
// DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue);
// Grid1.DataSource = table;
// Grid1.DataBind();
// }
// else
// {
// Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
// }
//}
}
else
{
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 统计类型选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void rblStatisticsType_SelectedIndexChanged(object sender, EventArgs e)
{
//if (this.rblStatisticsType.SelectedValue == "1")
//{
// this.drpCnProfession.Hidden = true;
// this.drpUnitProject.Hidden = true;
// this.drpCnProfession.SelectedValue = BLL.Const._Null;
//}
//else if (this.rblStatisticsType.SelectedValue == "2")
//{
// this.drpCnProfession.Hidden = false;
//}
}
#endregion
protected void drpCnProfession_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpCnProfession.SelectedValue != BLL.Const._Null)
{
this.drpUnitProject.DataValueField = "UnitProjectCode";
this.drpUnitProject.DataTextField = "UnitProjectName";
this.drpUnitProject.DataSource = BLL.UnitProjectInitService.GetUnitProjectInitsByCnProfessionId(this.drpCnProfession.SelectedValue);
this.drpUnitProject.DataBind();
Funs.FineUIPleaseSelect(drpUnitProject);
this.drpUnitProject.SelectedValue = BLL.Const._Null;
this.drpWbsSet.Items.Clear();
Funs.FineUIPleaseSelect(drpWbsSet);
this.drpWbsSet.SelectedValue = BLL.Const._Null;
}
else
{
this.drpUnitProject.Items.Clear();
Funs.FineUIPleaseSelect(drpUnitProject);
this.drpUnitProject.SelectedValue = BLL.Const._Null;
this.drpWbsSet.Items.Clear();
Funs.FineUIPleaseSelect(drpWbsSet);
this.drpWbsSet.SelectedValue = BLL.Const._Null;
}
}
protected void drpUnitProject_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpUnitProject.SelectedValue != BLL.Const._Null)
{
this.drpWbsSet.DataValueField = "WbsSetCode";
this.drpWbsSet.DataTextField = "WbsSetName";
this.drpWbsSet.DataSource = BLL.WbsSetInitService.GetWbsSetInitsByUnitProjectCode(this.drpUnitProject.SelectedValue);
this.drpWbsSet.DataBind();
Funs.FineUIPleaseSelect(drpWbsSet);
this.drpWbsSet.SelectedValue = BLL.Const._Null;
}
else
{
this.drpWbsSet.Items.Clear();
Funs.FineUIPleaseSelect(drpWbsSet);
this.drpWbsSet.SelectedValue = BLL.Const._Null;
}
}
2021-09-15 14:50:52 +08:00
#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());
2021-09-23 14:45:21 +08:00
DataTable table = BLL.WorkloadStatisticsService.GetTreeDataTable(this.CurrUser.LoginProjectId, months, this.drpWeek.SelectedValue, this.drpCnProfession.SelectedValue, this.drpUnitProject.SelectedValue, this.drpWbsSet.SelectedValue);
2021-09-15 14:50:52 +08:00
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
2021-09-23 14:45:21 +08:00
protected void drpWeek_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpWeek.SelectedValue == BLL.Const._Null)
{
this.Grid1.Columns[5].HeaderText = "本月计划完成量(B)";
this.Grid1.Columns[6].HeaderText = "本月完成量(C)";
this.Grid1.Columns[8].HeaderText = "本月已完工作实际费用-ACWP(A*C)";
this.Grid1.Columns[9].HeaderText = "本月计划工作预算费用-BCWS(B*D)";
this.Grid1.Columns[10].HeaderText = "本月已完工作预算费用-BCWP(C*D)";
}
else
{
this.Grid1.Columns[5].HeaderText = "本周计划完成量(B)";
this.Grid1.Columns[6].HeaderText = "本周完成量(C)";
this.Grid1.Columns[8].HeaderText = "本周已完工作实际费用-ACWP(A*C)";
this.Grid1.Columns[9].HeaderText = "本周计划工作预算费用-BCWS(B*D)";
this.Grid1.Columns[10].HeaderText = "本周已完工作预算费用-BCWP(C*D)";
}
}
2021-08-13 11:15:59 +08:00
}
}