HSE月报修改
This commit is contained in:
		
							parent
							
								
									c37a207bfe
								
							
						
					
					
						commit
						efac95deb3
					
				| 
						 | 
				
			
			@ -69,14 +69,14 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
        /// </summary>
 | 
			
		||||
        private void BindGrid()
 | 
			
		||||
        {
 | 
			
		||||
            string strSql = @"SELECT item.* ,ISNULL(0,t.SumProjectTotal) AS SumProjectTotal 
 | 
			
		||||
            string strSql = @"SELECT item.* ,ISNULL(t.SumProjectTotal,0) AS SumProjectTotal 
 | 
			
		||||
                                FROM dbo.HSSE_MonthReportItem item
 | 
			
		||||
                              LEFT JOIN dbo.HSSE_MonthReport r ON r.MonthReportId = item.MonthReportId
 | 
			
		||||
                              LEFT JOIN (SELECT a.MonthReportItemId,ISNULL(0,SUM(ISNULL(0,a.ProjectTotal))) AS SumProjectTotal  
 | 
			
		||||
                              LEFT JOIN (SELECT a.ReportItem,ISNULL(SUM(ISNULL(a.ProjectTotal,0)),0) AS SumProjectTotal  
 | 
			
		||||
                                           FROM dbo.HSSE_MonthReportItem a
 | 
			
		||||
                                           LEFT JOIN dbo.HSSE_MonthReport b ON b.MonthReportId = a.MonthReportId 
 | 
			
		||||
                                           WHERE b.ProjectId=@ProjectId AND b.Years<>DATENAME(YEAR,GETDATE())
 | 
			
		||||
                                           GROUP BY a.MonthReportItemId )t  ON t.MonthReportItemId = item.MonthReportItemId
 | 
			
		||||
                                           WHERE b.ProjectId=@ProjectId AND b.Years < "+ this.tvControlItem.SelectedNode.Text+ @"
 | 
			
		||||
                                           GROUP BY a.ReportItem )t  ON t.ReportItem = item.ReportItem
 | 
			
		||||
                              WHERE r.ProjectId=@ProjectId AND r.MonthReportId=@MonthReportId
 | 
			
		||||
                              ORDER BY item.Sort";
 | 
			
		||||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
			
		||||
| 
						 | 
				
			
			@ -95,10 +95,15 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
 | 
			
		||||
        protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            int cm = GetCurMonth();
 | 
			
		||||
            int editMonth = GetCurMonth();
 | 
			
		||||
            int cm = 12;
 | 
			
		||||
            if (DateTime.Now.Year.ToString()== tvControlItem.SelectedNode.Text)
 | 
			
		||||
            {
 | 
			
		||||
                cm = DateTime.Now.Month;
 | 
			
		||||
            }
 | 
			
		||||
            for (int i = 1; i <= 12; i++)
 | 
			
		||||
            {
 | 
			
		||||
                if (i != cm)
 | 
			
		||||
                if (i != editMonth)
 | 
			
		||||
                {
 | 
			
		||||
                    string monthC = "Month" + i.ToString();
 | 
			
		||||
                    RenderField month = Grid1.FindColumn(monthC) as RenderField;
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +123,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                     join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
 | 
			
		||||
                                     where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode == "CHENGDA"
 | 
			
		||||
                                     select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = person.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +136,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                     where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode == "CHENGDA"
 | 
			
		||||
                                           && z.WorkPostName.Contains("安全")
 | 
			
		||||
                                     select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = person.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +147,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                     join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
 | 
			
		||||
                                     where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode != "CHENGDA"
 | 
			
		||||
                                     select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = person.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -155,7 +160,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                     where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode != "CHENGDA"
 | 
			
		||||
                                           && z.WorkPostName.Contains("安全")
 | 
			
		||||
                                     select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = person.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -165,11 +170,11 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                    {
 | 
			
		||||
                        DateTime? sDate = Convert.ToDateTime(tvControlItem.SelectedNode.Text + "-" + i.ToString());
 | 
			
		||||
                        var dayReports = BLL.SitePerson_MonthReportService.getMonthReports(this.CurrUser.LoginProjectId, sDate);
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "" && dayReports.Count() > 0)
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "" && dayReports.Count() > 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = dayReports.First().DayWorkTime;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        else if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = 0;
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +187,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                 where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                 && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
 | 
			
		||||
                                 select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = accident.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -195,7 +200,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                       && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
 | 
			
		||||
                                       && x.Injury=="1"
 | 
			
		||||
                                       select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = accident.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -208,7 +213,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                       && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
 | 
			
		||||
                                       && x.Injury == "2"
 | 
			
		||||
                                       select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = accident.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -221,7 +226,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                       && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
 | 
			
		||||
                                       && x.Injury == "3"
 | 
			
		||||
                                       select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = accident.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -233,7 +238,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                       where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                       && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
 | 
			
		||||
                                       select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = accident.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -241,14 +246,14 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
 | 
			
		||||
                    if (e.RowIndex == 11) // 现场环境事故
 | 
			
		||||
                    {
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = "0";
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (e.RowIndex == 12) // 现场发生设备材料盗窃案件
 | 
			
		||||
                    {
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = "0";
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -260,7 +265,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                       where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                       && x.WeekMeetingDate >= startDate && x.WeekMeetingDate < startDate.AddMonths(1)
 | 
			
		||||
                                       select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = weekMeeting.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -272,7 +277,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                          where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                          && x.AttendMeetingDate >= startDate && x.AttendMeetingDate < startDate.AddMonths(1)
 | 
			
		||||
                                          select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = weekMeeting.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +285,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
 | 
			
		||||
                    if (e.RowIndex == 15) // 施工现场HSE联检
 | 
			
		||||
                    {
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = "0";
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +297,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                          where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                          && x.CheckedDate >= startDate && x.CheckedDate < startDate.AddMonths(1)
 | 
			
		||||
                                          select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = check.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -304,7 +309,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                          where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                          && x.CompleteDate >= startDate && x.CompleteDate < startDate.AddMonths(1)
 | 
			
		||||
                                          select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = check.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -316,7 +321,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                    where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                    && x.PunishNoticeDate >= startDate && x.PunishNoticeDate < startDate.AddMonths(1)
 | 
			
		||||
                                    select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = check.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -328,7 +333,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                    where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                    && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1)
 | 
			
		||||
                                    select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            e.Values[month.ColumnIndex] = em.Count();
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -340,7 +345,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                    where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                    && x.TrainStartDate >= startDate && x.TrainStartDate < startDate.AddMonths(1)
 | 
			
		||||
                                    select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            if (edu.Count() > 0)
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -359,7 +364,7 @@ namespace FineUIPro.Web.HSSE.Manager
 | 
			
		|||
                                  where x.ProjectId == this.CurrUser.LoginProjectId
 | 
			
		||||
                                  && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1)
 | 
			
		||||
                                  select x;
 | 
			
		||||
                        if (e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        if (i <= cm && e.Values[month.ColumnIndex].ToString() == "")
 | 
			
		||||
                        {
 | 
			
		||||
                            if (equ.Count()>0)
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue