diff --git a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx index a2570df2..c56d924e 100644 --- a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx +++ b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx @@ -90,7 +90,7 @@ - diff --git a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs index aff7b6da..0d20996e 100644 --- a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs @@ -28,7 +28,7 @@ namespace FineUIPro.Web.DataShow } } - + /// /// 绑定数据 /// @@ -57,7 +57,7 @@ namespace FineUIPro.Web.DataShow // cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text; //} - + SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); Grid1.RecordCount = tb.Rows.Count; @@ -130,7 +130,7 @@ namespace FineUIPro.Web.DataShow /// protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) { - EditData(); + //EditData(); } @@ -148,11 +148,11 @@ namespace FineUIPro.Web.DataShow PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkingHoursItem.aspx?projectId={0}", Grid1.SelectedRowID, "查看 - "))); } #endregion - + protected void btnView_Click(object sender, EventArgs e) { - EditData(); + //EditData(); } @@ -166,28 +166,12 @@ namespace FineUIPro.Web.DataShow decimal cout1 = 0; if (projectId != null) { - var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); - var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getD1 = from x in Funs.DB.SitePerson_DayReport - join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; - if (datetime1.HasValue) - { - getD1 = getD1.Where(x => x.CompileDate >= datetime1); - } - if (datetime2.HasValue) - { - getD1 = getD1.Where(x => x.CompileDate <= datetime2); - } - var getC = from x in Funs.DB.SitePerson_DayReportDetail - join y in getD1 on x.DayReportId equals y.DayReportId - where y.ProjectId == projectId.ToString() - select x; - if (getC.Count() > 0) - { - cout1 = getC.Sum(x => x.PersonWorkTime ?? 0); - } + var result = (from x in Funs.DB.SeDin_MonthReport2 + join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId + where y.ProjectId == projectId.ToString() + orderby y.ReporMonth descending + select x.ProjectWorkTime ?? 0).FirstOrDefault(); + cout1 = result; } return cout1; } @@ -207,7 +191,7 @@ namespace FineUIPro.Web.DataShow var getD1 = from x in Funs.DB.Accident_AccidentHandle join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId where y.ProjectState == Const.ProjectState_1 - select x; + select x; var getD2 = from x in Funs.DB.Accident_AccidentReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId where y.ProjectState == Const.ProjectState_1 @@ -246,10 +230,11 @@ namespace FineUIPro.Web.DataShow { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getC1 = from x in Funs.DB.SitePerson_DayReport - join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; + var getC1 = (from x in Funs.DB.SeDin_MonthReport2 + join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId + where y.ProjectId == projectId.ToString() + orderby y.ReporMonth descending + select x.ProjectWorkTime ?? 0).FirstOrDefault(); var getD1 = from x in Funs.DB.Accident_AccidentHandle join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId @@ -262,32 +247,22 @@ namespace FineUIPro.Web.DataShow if (datetime1.HasValue) { - getC1 = getC1.Where(x => x.CompileDate >= datetime1); getD1 = getD1.Where(x => x.AccidentDate >= datetime1); getD2 = getD2.Where(x => x.CompileDate >= datetime1); } if (datetime2.HasValue) { - getC1 = getC1.Where(x => x.CompileDate <= datetime2); getD1 = getD1.Where(x => x.AccidentDate <= datetime2); getD2 = getD2.Where(x => x.CompileDate <= datetime2); } - var getC = from x in Funs.DB.SitePerson_DayReportDetail - join y in getC1 on x.DayReportId equals y.DayReportId - where y.ProjectId == projectId.ToString() - select x; - if (getC.Count() > 0) - { - cout1 = getC.Sum(x => x.PersonWorkTime ?? 0); - } - + cout1 = getC1; if (getD1.Count() > 0) { - cout1 = cout1 -getD1.Sum(x => x.WorkHoursLoss ?? 0); + cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0); } if (getD2.Count() > 0) { - cout1 = cout1- getD2.Sum(x => x.WorkingHoursLoss ?? 0); + cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0); } } return cout1;