214 lines
7.7 KiB
C#
214 lines
7.7 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
{
|
|
public partial class JD : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
Funs.DropDownPageSize(this.ddlPageSize2);
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
ddlPageSize2.SelectedValue = Grid2.PageSize.ToString();
|
|
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
|
BLL.ProjectService.InitProjectDropDownList(this.drpProject2, true);
|
|
BindGrid1();
|
|
}
|
|
}
|
|
|
|
private void BindGrid1()
|
|
{
|
|
string strSql = @"select p.ProjectId,ProjectCode, ProjectName,(select sum(isnull(RealNum,0)) from JDGL_ProgressCompletion a where a.ProjectId=p.ProjectId) as RealNum,
|
|
cast((case when isnull(MonthPlan.MonthPlanNum,0)=0 then 0 else isnull(MonthPlanOK.MonthPlanOKNum,0)/(1.0 *isnull(MonthPlan.MonthPlanNum,0))*100 end) as DECIMAL(19,2)) as MonthPlanRate,
|
|
cast((case when isnull(WeekPlan.WeekPlanNum,0)=0 then 0 else isnull(WeekPlanOK.WeekPlanOKNum,0)/(1.0 *isnull(WeekPlan.WeekPlanNum,0))*100 end) as DECIMAL(19,2)) as WeekPlanRate
|
|
from Base_Project p
|
|
left join (
|
|
SELECT COUNT(w.WeekPlanId) AS WeekPlanNum,w.ProjectId FROM JDGL_WeekPlan w
|
|
GROUP BY w.ProjectId
|
|
) AS WeekPlan ON WeekPlan.ProjectId=p.ProjectId
|
|
left join (
|
|
SELECT COUNT(w.WeekPlanId) AS WeekPlanOKNum,w.ProjectId FROM JDGL_WeekPlan w
|
|
where w.IsOK=1
|
|
GROUP BY w.ProjectId
|
|
) AS WeekPlanOK ON WeekPlanOK.ProjectId=p.ProjectId
|
|
left join (
|
|
SELECT COUNT(w.MonthPlanId) AS MonthPlanNum,w.ProjectId FROM JDGL_MonthPlan w
|
|
GROUP BY w.ProjectId
|
|
) AS MonthPlan ON MonthPlan.ProjectId=p.ProjectId
|
|
left join (
|
|
SELECT COUNT(w.MonthPlanId) AS MonthPlanOKNum,w.ProjectId FROM JDGL_MonthPlan w
|
|
where w.RealDate is not null and w.RealDate<=w.PlanDate
|
|
GROUP BY w.ProjectId
|
|
) AS MonthPlanOK ON MonthPlanOK.ProjectId=p.ProjectId
|
|
where ProjectState =1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
string cpara = string.Empty;
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND p.ProjectId = @projectId";
|
|
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid2()
|
|
{
|
|
//string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1 ";
|
|
//List<SqlParameter> listStr = new List<SqlParameter>();
|
|
//string cpara = string.Empty;
|
|
//if (this.drpProject2.SelectedValue != Const._Null)
|
|
//{
|
|
// strSql += " AND projectId = @projectId"; ///状态为已完成
|
|
// listStr.Add(new SqlParameter("@projectId", this.drpProject2.SelectedValue));
|
|
//}
|
|
|
|
//SqlParameter[] parameter = listStr.ToArray();
|
|
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
//Grid2.RecordCount = tb.Rows.Count;
|
|
//var table = this.GetPagedDataTable(Grid2, tb);
|
|
//Grid2.DataSource = table;
|
|
//Grid2.DataBind();
|
|
|
|
DataTable table = new DataTable();
|
|
table.Columns.Add(new DataColumn("BaseId", typeof(String)));
|
|
table.Columns.Add(new DataColumn("SupId", typeof(String)));
|
|
table.Columns.Add(new DataColumn("Name", typeof(String)));
|
|
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
|
|
table.Columns.Add(new DataColumn("DrawingNo", typeof(String)));
|
|
table.Columns.Add(new DataColumn("DrawingName", typeof(String)));
|
|
table.Columns.Add(new DataColumn("Part", typeof(String)));
|
|
table.Columns.Add(new DataColumn("ProjectContent", typeof(String)));
|
|
table.Columns.Add(new DataColumn("Unit", typeof(String)));
|
|
table.Columns.Add(new DataColumn("Amount", typeof(decimal)));
|
|
table.Columns.Add(new DataColumn("WorkTeam", typeof(String)));
|
|
table.Columns.Add(new DataColumn("State", typeof(String)));
|
|
|
|
DataRow row;
|
|
row = table.NewRow();
|
|
row[0] = "0";
|
|
row[1] = null;
|
|
row[2] = "工程量基础表";
|
|
row[3] = "";
|
|
row[4] = "";
|
|
row[5] = "";
|
|
row[6] = "";
|
|
row[7] = "";
|
|
row[8] = "";
|
|
row[9] = DBNull.Value;
|
|
row[10] = "";
|
|
row[11] = "";
|
|
table.Rows.Add(row);
|
|
}
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid1();
|
|
}
|
|
#endregion
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid1();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid1();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页显示条数下拉框
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid1();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox2_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid2();
|
|
}
|
|
#endregion
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid2_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid2();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid2_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
BindGrid2();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页显示条数下拉框
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize2_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid2.PageSize = Convert.ToInt32(ddlPageSize2.SelectedValue);
|
|
BindGrid2();
|
|
}
|
|
#endregion
|
|
|
|
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (TabStrip1.ActiveTabIndex == 1)
|
|
{
|
|
BindGrid2();
|
|
}
|
|
}
|
|
}
|
|
} |