diff --git a/SGGL/FineUIPro.Web/DataShow/JD.aspx b/SGGL/FineUIPro.Web/DataShow/JD.aspx index 6b94fdbe..caa8d497 100644 --- a/SGGL/FineUIPro.Web/DataShow/JD.aspx +++ b/SGGL/FineUIPro.Web/DataShow/JD.aspx @@ -53,10 +53,10 @@ - - + + diff --git a/SGGL/FineUIPro.Web/DataShow/JD.aspx.cs b/SGGL/FineUIPro.Web/DataShow/JD.aspx.cs index 5c7f959c..080757e6 100644 --- a/SGGL/FineUIPro.Web/DataShow/JD.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/JD.aspx.cs @@ -25,6 +25,14 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject3, true); BLL.UserService.InitSGBUser(this.drpDutyPerson3, true); BindGrid1(); + + //统计月份信息 + DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); + if (DateTime.Now.Day < 26) + { + months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01"); + } + this.txtMonths.Text = months.ToString("yyyy-MM"); } } @@ -68,6 +76,17 @@ left join ( Grid1.DataBind(); } + #region 月份选择事件 + /// + /// 月份选择事件 + /// + /// + /// + protected void txtMonths_TextChanged(object sender, EventArgs e) + { + BindGrid2(); + } + #endregion /// /// 绑定数据 /// @@ -90,12 +109,13 @@ left join ( { projects = projects.Where(x => x.ProjectId == this.drpProject2.SelectedValue).OrderBy(x => x.ProjectName); } - //统计月份信息 - DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); - if (DateTime.Now.Day < 26) - { - months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01"); - } + //////统计月份信息 + //DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); + //if (DateTime.Now.Day < 26) + //{ + // months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01"); + //} + DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01"); //2、获取当前项目指定月所有计划 var allMonthPlans = from x in db.JDGL_MonthPlan where x.Months == months @@ -174,7 +194,7 @@ left join ( select x; foreach (var item in projects) { - var lastWeek = (from x in db.JDGL_WeekPlan where x.ProjectId == item.ProjectId && DateTime.Now > ((DateTime)x.EndDate).AddDays(1) orderby x.EndDate select x).FirstOrDefault(); + var lastWeek = (from x in db.JDGL_WeekPlan where x.ProjectId == item.ProjectId && DateTime.Now > ((DateTime)x.EndDate).AddDays(1) orderby x.EndDate descending select x).FirstOrDefault(); double planNum = 0, completedNum = 0, rate = 0; if (lastWeek != null) { @@ -417,14 +437,15 @@ left join ( return; } - //统计月份信息 - DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); - if (DateTime.Now.Day < 26) - { - months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01"); - } + ////统计月份信息 + //DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); + //if (DateTime.Now.Day < 26) + //{ + // months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01"); + //} + //string month = months.ToString("yyyy-MM-dd"); string projectId = Grid2.SelectedRowID; - string month = months.ToString("yyyy-MM-dd"); + string month = this.txtMonths.Text.Trim() + "-01"; PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("JDMonthDetail.aspx?projectId={0}&month={1}", projectId, month, "查看明细 - "))); } diff --git a/SGGL/FineUIPro.Web/DataShow/JD.aspx.designer.cs b/SGGL/FineUIPro.Web/DataShow/JD.aspx.designer.cs index 5ca21d2d..0aa302e9 100644 --- a/SGGL/FineUIPro.Web/DataShow/JD.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/DataShow/JD.aspx.designer.cs @@ -158,6 +158,15 @@ namespace FineUIPro.Web.DataShow /// protected global::FineUIPro.Toolbar Toolbar1; + /// + /// txtMonths 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtMonths; + /// /// drpProject2 控件。 /// diff --git a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx index b8fcff67..47b8360b 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx +++ b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx @@ -29,6 +29,15 @@ SortDirection="ASC" EnableColumnLines="true" AllowPaging="false" IsDatabasePaging="false" PageSize="1000" AllowFilters="true" EnableTextSelection="True"> + + + + + + + + diff --git a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.cs b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.cs index dac682af..15f12db6 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.cs @@ -59,10 +59,23 @@ namespace FineUIPro.Web.DataShow } this.Month = months.ToString("yyyy-MM-dd"); } + this.txtMonths.Text = this.Month.Replace("-01", ""); BindGrid(); } } + #region 月份选择事件 + /// + /// 月份选择事件 + /// + /// + /// + protected void txtMonths_TextChanged(object sender, EventArgs e) + { + this.Month = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01")); + BindGrid(); + } + #endregion /// /// 加载Grid diff --git a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.designer.cs b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.designer.cs index c7400f32..5faa1ad4 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/DataShow/JDMonthDetail.aspx.designer.cs @@ -50,6 +50,24 @@ namespace FineUIPro.Web.DataShow /// protected global::FineUIPro.Grid Grid1; + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtMonths 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtMonths; + /// /// lblPageIndex 控件。 /// diff --git a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx index 952459b8..4565bad1 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx +++ b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx @@ -23,8 +23,19 @@ - + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.cs b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.cs index 5603dcd6..7bd81005 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.cs @@ -46,16 +46,72 @@ namespace FineUIPro.Web.DataShow { this.ProjectId = Request.Params["projectId"]; } - Model.SGGLDB db = Funs.DB; - var lastWeek = (from x in db.JDGL_WeekPlan where x.ProjectId == this.ProjectId && DateTime.Now > ((DateTime)x.EndDate).AddDays(1) orderby x.EndDate select x).FirstOrDefault(); - - this.WeekNo = lastWeek.WeekNo; + var lastWeek = (from x in db.JDGL_WeekPlan where x.ProjectId == this.ProjectId && DateTime.Now > ((DateTime)x.EndDate).AddDays(1) orderby x.EndDate descending select x).FirstOrDefault(); + this.WeekNo = lastWeek != null ? lastWeek.WeekNo : string.Empty; + this.InitDropDownList(); BindGrid(); } } + /// + /// 初始化下拉框 + /// + private void InitDropDownList() + { + WeekItemService.InitWeekItemDropDownList(this.drpWeekNo, this.ProjectId, false); + if (!string.IsNullOrWhiteSpace(this.WeekNo)) + { + var item = WeekItemService.GetWeekItemByProjectIdAndWeekNo(this.ProjectId, int.Parse(this.WeekNo)); + if (item != null) + { + this.drpWeekNo.SelectedValue = item.WeekNo.ToString(); + this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", item.StartDate); + this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", item.EndDate); + } + } + else + { + //获取当前时间所在周号,存在默认选中当前时间点所在周,否则选择最后一个周 + var item = WeekItemService.GetWeekItemByDateNow(this.ProjectId); + if (item != null) + {//存在默认选中当前时间点所在周 + this.drpWeekNo.SelectedValue = item.WeekNo.ToString(); + this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", item.StartDate); + this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", item.EndDate); + } + else + { + var items = WeekItemService.GetWeekItemList(this.ProjectId); + if (items.Any()) + {//否则选择最后一个周 + item = items.First(); + this.drpWeekNo.SelectedValue = item.WeekNo.ToString(); + this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", item.StartDate); + this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", item.EndDate); + } + } + } + } + /// + /// 周号选择触发事件 + /// + /// + /// + protected void drpWeekNo_SelectedIndexChanged(object sender, EventArgs e) + { + string weekNo = this.drpWeekNo.SelectedValue; + this.WeekNo = weekNo; + var item = BLL.WeekItemService.GetWeekItemByProjectIdAndWeekNo(this.ProjectId, int.Parse(weekNo)); + if (item != null) + { + this.drpWeekNo.SelectedValue = item.WeekNo.ToString(); + this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", item.StartDate); + this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", item.EndDate); + } + BindGrid(); + } /// /// 加载Grid diff --git a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.designer.cs b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.designer.cs index 4c59a6fa..c9d1d3d8 100644 --- a/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/DataShow/JDWeekDetail.aspx.designer.cs @@ -50,6 +50,42 @@ namespace FineUIPro.Web.DataShow /// protected global::FineUIPro.Grid Grid1; + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// drpWeekNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpWeekNo; + + /// + /// txtStartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartDate; + + /// + /// txtEndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndDate; + /// /// Label1 控件。 ///