diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx
new file mode 100644
index 00000000..450725ce
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx
@@ -0,0 +1,171 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManagerMonthC.aspx.cs" Inherits="FineUIPro.Web.CQMS.ManageReport.ManagerMonthC" %>
+
+
+
+
+
+ HSE月报告
+
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.cs
new file mode 100644
index 00000000..17a59d1d
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.cs
@@ -0,0 +1,815 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using BLL;
+using AspNet = System.Web.UI.WebControls;
+using Newtonsoft.Json.Linq;
+
+namespace FineUIPro.Web.CQMS.ManageReport
+{
+ public partial class ManagerMonthC : PageBase
+ {
+
+ #region 加载页面
+ ///
+ /// 加载页面
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ ////权限按钮方法
+ this.GetButtonPower();
+
+ this.txtReportYear.Text = string.Format("{0:yyyy}", DateTime.Now);
+ // 绑定表格
+ //BindGrid();
+ InitTreeMenu();
+ }
+ }
+
+ private void InitTreeMenu()
+ {
+ this.tvControlItem.Nodes.Clear();
+ TreeNode rootNode = new TreeNode();
+ rootNode.Text = "年份";
+ rootNode.NodeID = "0";
+ rootNode.Expanded = true;
+ this.tvControlItem.Nodes.Add(rootNode);
+
+ var report = from x in Funs.DB.CQMS_MonthReport
+ where x.ProjectId == CurrUser.LoginProjectId
+ orderby x.Years
+ select x;
+ if (report.Count() > 0)
+ {
+ foreach (var y in report)
+ {
+ TreeNode tnYear = new TreeNode();//年节点
+ tnYear.Text = y.Years.HasValue ? y.Years.Value.ToString() : "";
+ tnYear.NodeID = y.MonthReportId;
+ tnYear.EnableClickEvent = true;
+ rootNode.Nodes.Add(tnYear);
+ }
+ }
+
+ }
+
+ protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
+ {
+ BindGrid();
+ }
+
+ ///
+ /// 绑定数据
+ ///
+ private void BindGrid()
+ {
+ string strSql = @"SELECT item.* ,ISNULL(t.SumProjectTotal,0) AS SumProjectTotal
+ FROM dbo.CQMS_MonthReportItem item
+ LEFT JOIN dbo.CQMS_MonthReport r ON r.MonthReportId = item.MonthReportId
+ LEFT JOIN (SELECT a.ReportItem,ISNULL(SUM(ISNULL(a.ProjectTotal,0)),0) AS SumProjectTotal
+ FROM dbo.CQMS_MonthReportItem a
+ LEFT JOIN dbo.CQMS_MonthReport b ON b.MonthReportId = a.MonthReportId
+ 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 listStr = new List();
+ listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
+ listStr.Add(new SqlParameter("@MonthReportId", tvControlItem.SelectedNodeID));
+
+ SqlParameter[] parameter = listStr.ToArray();
+ DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
+ // 2.获取当前分页数据
+ //var table = this.GetPagedDataTable(Grid1, tb1);
+
+ Grid1.DataSource = dt;
+ Grid1.DataBind();
+
+ }
+
+ protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
+ {
+ int cm = GetCurMonth();
+
+ for (int i = 1; i <= 12; i++)
+ {
+ if (i != cm)
+ {
+ //string monthC = "Month" + i.ToString();
+ //RenderField month = Grid1.FindColumn(monthC) as RenderField;
+ //e.CellCssClasses[month.ColumnIndex] = "f-grid-cell-uneditable";
+ }
+ else
+ {
+ string monthC = "Month" + i.ToString();
+ RenderField month = Grid1.FindColumn(monthC) as RenderField;
+ RenderField yearTotal = Grid1.FindColumn("YearTotal") as RenderField;
+ RenderField projectTotal = Grid1.FindColumn("ProjectTotal") as RenderField;
+ RenderField sumProjectTotal = Grid1.FindColumn("SumProjectTotal") as RenderField;
+
+ if (e.RowIndex == 0) // 成达公司现场人数
+ {
+ var person = from x in Funs.DB.SitePerson_Person
+ 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() == "")
+ {
+ e.Values[month.ColumnIndex] = person.Count();
+ }
+ }
+ if (e.RowIndex == 1) // 成达公司HSE管理人数
+ {
+ var person = from x in Funs.DB.SitePerson_Person
+ join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
+ join z in Funs.DB.Base_WorkPost on x.WorkPostId equals z.WorkPostId
+ where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode == "CHENGDA"
+ && z.WorkPostName.Contains("安全")
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = person.Count();
+ }
+ }
+ if (e.RowIndex == 2) // 分包商现场人数
+ {
+ var person = from x in Funs.DB.SitePerson_Person
+ 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() == "")
+ {
+ e.Values[month.ColumnIndex] = person.Count();
+ }
+ }
+ if (e.RowIndex == 3) // 分包商HSE管理人数
+ {
+ var person = from x in Funs.DB.SitePerson_Person
+ join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
+ join z in Funs.DB.Base_WorkPost on x.WorkPostId equals z.WorkPostId
+ where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode != "CHENGDA"
+ && z.WorkPostName.Contains("安全")
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = person.Count();
+ }
+ }
+
+ if (e.RowIndex == 4 || e.RowIndex == 5) // 人工时数,安全生产人工时数
+ {
+ 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)
+ {
+ e.Values[month.ColumnIndex] = dayReports.First().DayWorkTime;
+ }
+ else if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = 0;
+ }
+ }
+
+ DateTime startDate = Convert.ToDateTime(tvControlItem.SelectedNode.Text + "-" + i.ToString() + "-01");
+ if (e.RowIndex == 6) // HSE记录事故数量
+ {
+ var accident = from x in Funs.DB.Accident_AccidentPersonRecord
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = accident.Count();
+ }
+ }
+
+ if (e.RowIndex == 7) // 死亡
+ {
+ var accident = from x in Funs.DB.Accident_AccidentPersonRecord
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
+ && x.Injury == "1"
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = accident.Count();
+ }
+ }
+
+ if (e.RowIndex == 8) // 重伤
+ {
+ var accident = from x in Funs.DB.Accident_AccidentPersonRecord
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
+ && x.Injury == "2"
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = accident.Count();
+ }
+ }
+
+ if (e.RowIndex == 9) // 轻伤
+ {
+ var accident = from x in Funs.DB.Accident_AccidentPersonRecord
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
+ && x.Injury == "3"
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = accident.Count();
+ }
+ }
+
+ if (e.RowIndex == 10) // 未遂事故
+ {
+ var accident = from x in Funs.DB.Accident_AccidentHandle
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = accident.Count();
+ }
+ }
+
+ if (e.RowIndex == 11) // 现场环境事故
+ {
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = "0";
+ }
+ }
+ if (e.RowIndex == 12) // 现场发生设备材料盗窃案件
+ {
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = "0";
+ }
+ }
+
+ if (e.RowIndex == 13) // HSE周会
+ {
+ var weekMeeting = from x in Funs.DB.Meeting_WeekMeeting
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.WeekMeetingDate >= startDate && x.WeekMeetingDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = weekMeeting.Count();
+ }
+ }
+
+ if (e.RowIndex == 14) // HSE委员会会议
+ {
+ var weekMeeting = from x in Funs.DB.Meeting_AttendMeeting
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.AttendMeetingDate >= startDate && x.AttendMeetingDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = weekMeeting.Count();
+ }
+ }
+
+ if (e.RowIndex == 15) // 施工现场HSE联检
+ {
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = "0";
+ }
+ }
+
+ if (e.RowIndex == 16) // 发布HSE整改通知书
+ {
+ var check = from x in Funs.DB.Check_RectifyNotices
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.CheckedDate >= startDate && x.CheckedDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = check.Count();
+ }
+ }
+
+ if (e.RowIndex == 17) // 关闭HSE整改通知书
+ {
+ var check = from x in Funs.DB.Check_RectifyNotices
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.CompleteDate >= startDate && x.CompleteDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = check.Count();
+ }
+ }
+
+ if (e.RowIndex == 18) // 发布HSE处罚书
+ {
+ var check = from x in Funs.DB.Check_PunishNotice
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.PunishNoticeDate >= startDate && x.PunishNoticeDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = check.Count();
+ }
+ }
+
+ if (e.RowIndex == 19) // 发布应急预案
+ {
+ var em = from x in Funs.DB.Emergency_EmergencyList
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ e.Values[month.ColumnIndex] = em.Count();
+ }
+ }
+
+ if (e.RowIndex == 20) // 人员培训
+ {
+ var edu = from x in Funs.DB.EduTrain_TrainRecord
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.TrainStartDate >= startDate && x.TrainStartDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ if (edu.Count() > 0)
+ {
+ e.Values[month.ColumnIndex] = edu.Sum(x => x.TrainPersonNum);
+ }
+ else
+ {
+ e.Values[month.ColumnIndex] = 0;
+ }
+ }
+ }
+
+ if (e.RowIndex == 21) // 设备HSE检验
+ {
+ var equ = from x in Funs.DB.License_EquipmentSafetyList
+ where x.ProjectId == this.CurrUser.LoginProjectId
+ && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1)
+ select x;
+ if (e.Values[month.ColumnIndex].ToString() == "")
+ {
+ if (equ.Count() > 0)
+ {
+ e.Values[month.ColumnIndex] = equ.Sum(x => x.EquipmentSafetyListCount);
+ }
+ else
+ {
+ e.Values[month.ColumnIndex] = 0;
+ }
+ }
+ }
+
+ RenderField month1 = Grid1.FindColumn("Month1") as RenderField;
+ RenderField month2 = Grid1.FindColumn("Month2") as RenderField;
+ RenderField month3 = Grid1.FindColumn("Month3") as RenderField;
+ RenderField month4 = Grid1.FindColumn("Month4") as RenderField;
+ RenderField month5 = Grid1.FindColumn("Month5") as RenderField;
+ RenderField month6 = Grid1.FindColumn("Month6") as RenderField;
+ RenderField month7 = Grid1.FindColumn("Month7") as RenderField;
+ RenderField month8 = Grid1.FindColumn("Month8") as RenderField;
+ RenderField month9 = Grid1.FindColumn("Month9") as RenderField;
+ RenderField month10 = Grid1.FindColumn("Month10") as RenderField;
+ RenderField month11 = Grid1.FindColumn("Month11") as RenderField;
+ RenderField month12 = Grid1.FindColumn("Month12") as RenderField;
+ // 年度总计
+ e.Values[yearTotal.ColumnIndex] = Convert.ToInt32(e.Values[month1.ColumnIndex].ToString() != "" ? e.Values[month1.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month2.ColumnIndex].ToString() != "" ? e.Values[month2.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month3.ColumnIndex].ToString() != "" ? e.Values[month3.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month4.ColumnIndex].ToString() != "" ? e.Values[month4.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month5.ColumnIndex].ToString() != "" ? e.Values[month5.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month6.ColumnIndex].ToString() != "" ? e.Values[month6.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month7.ColumnIndex].ToString() != "" ? e.Values[month7.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month8.ColumnIndex].ToString() != "" ? e.Values[month8.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month9.ColumnIndex].ToString() != "" ? e.Values[month9.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month10.ColumnIndex].ToString() != "" ? e.Values[month10.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month11.ColumnIndex].ToString() != "" ? e.Values[month11.ColumnIndex] : 0)
+ + Convert.ToInt32(e.Values[month12.ColumnIndex].ToString() != "" ? e.Values[month12.ColumnIndex] : 0);
+ // 项目总计
+ e.Values[projectTotal.ColumnIndex] = Convert.ToInt32(e.Values[yearTotal.ColumnIndex]) + Convert.ToInt32(e.Values[sumProjectTotal.ColumnIndex]);
+
+ }
+ }
+
+ }
+ #endregion
+
+ #region 查询
+ ///
+ /// 查询
+ ///
+ ///
+ ///
+ protected void TextBox_TextChanged(object sender, EventArgs e)
+ {
+ this.BindGrid();
+ }
+ #endregion
+
+ #region 新建报表
+ ///
+ /// 新增
+ ///
+ ///
+ ///
+ protected void btnNew_Click(object sender, EventArgs e)
+ {
+ Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
+ if (project.StartDate != null)
+ {
+ if (!string.IsNullOrEmpty(this.txtReportYear.Text.Trim()))
+ {
+ if (this.txtReportYear.Text.Trim() == DateTime.Now.Year.ToString())
+ {
+ int? years = Convert.ToInt32(this.txtReportYear.Text.Trim());
+ var report = Funs.DB.CQMS_MonthReport.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.Years == years);
+
+ if (report == null)
+ {
+ Model.CQMS_MonthReport newReport = new Model.CQMS_MonthReport();
+ newReport.MonthReportId = SQLHelper.GetNewID(typeof(Model.CQMS_MonthReport));
+ newReport.ProjectId = this.CurrUser.LoginProjectId;
+ newReport.Years = years;
+ Funs.DB.CQMS_MonthReport.InsertOnSubmit(newReport);
+ Funs.DB.SubmitChanges();
+
+ List ItemList = new List();
+ for (int i = 0; i < 22; i++)
+ {
+ Model.CQMS_MonthReportItem item = new Model.CQMS_MonthReportItem();
+ item.MonthReportItemId = SQLHelper.GetNewID(typeof(Model.CQMS_MonthReportItem));
+ item.MonthReportId = newReport.MonthReportId;
+ if (i == 0)
+ {
+ item.ReportItem = "发布施工质量管理文件";
+ item.Unit = "份";
+ }
+ if (i == 1)
+ {
+ item.ReportItem = "组织设计交底与图纸会审";
+ item.Unit = "次";
+ }
+ if (i == 2)
+ {
+ item.ReportItem = "审批施工组织设计或施工方案";
+ item.Unit = "份";
+ }
+ if (i == 3)
+ {
+ item.ReportItem = "施工质量联合检查(例行检测+专项检测)";
+ item.Unit = "次";
+ }
+ if (i == 4)
+ {
+ item.ReportItem = "施工质量专题会议";
+ item.Unit = "次";
+ }
+ if (i == 5)
+ {
+ item.ReportItem = "不符合项报告(NCR)";
+ item.Unit = "";
+ }
+ if (i == 6)
+ {
+ item.ReportItem = "发布";
+ item.Unit = "份";
+ }
+ if (i == 7)
+ {
+ item.ReportItem = "关闭";
+ item.Unit = "份";
+ }
+
+ if (i == 8)
+ {
+ item.ReportItem = "质量整改与处罚";
+ item.Unit = "";
+ }
+ if (i == 9)
+ {
+ item.ReportItem = "发出质量整改通知单";
+ item.Unit = "份";
+ }
+ if (i == 10)
+ {
+ item.ReportItem = "发出质量处罚通知单";
+ item.Unit = "份";
+ }
+ if (i == 11)
+ {
+ item.ReportItem = "检验批及合格率";
+ item.Unit = "";
+ }
+ if (i == 12)
+ {
+ item.ReportItem = "检验批次数";
+ item.Unit = "次";
+ }
+ if (i == 13)
+ {
+ item.ReportItem = "合格率";
+ item.Unit = "%";
+ }
+ if (i == 14)
+ {
+ item.ReportItem = "无损检测(RT)";
+ item.Unit = "";
+ }
+ if (i == 15)
+ {
+ item.ReportItem = "一次拍片数";
+ item.Unit = "张";
+ }
+ if (i == 16)
+ {
+ item.ReportItem = "一次合格数";
+ item.Unit = "张";
+ }
+ if (i == 17)
+ {
+ item.ReportItem = "一次合格率";
+ item.Unit = "%";
+ }
+ if (i == 18)
+ {
+ item.ReportItem = "质量事故";
+ item.Unit = "";
+ }
+ if (i == 19)
+ {
+ item.ReportItem = "重大质量事故";
+ item.Unit = "次";
+ }
+ if (i == 20)
+ {
+ item.ReportItem = "较大质量事故";
+ item.Unit = "次";
+ }
+ if (i == 21)
+ {
+ item.ReportItem = "一般质量事故";
+ item.Unit = "次";
+ }
+ if (i == 22)
+ {
+ item.ReportItem = "监理单位下发质量问题通知单";
+ item.Unit = "";
+ }
+ if (i == 23)
+ {
+ item.ReportItem = "收到";
+ item.Unit = "份";
+ }
+ if (i == 24)
+ {
+ item.ReportItem = "关闭";
+ item.Unit = "份";
+ }
+ if (i == 25)
+ {
+ item.ReportItem = "业主方/业主管理公司下发质量问题通知单";
+ item.Unit = "";
+ }
+ if (i == 26)
+ {
+ item.ReportItem = "收到";
+ item.Unit = "份";
+ }
+ if (i == 27)
+ {
+ item.ReportItem = "关闭";
+ item.Unit = "份";
+ }
+ item.Sort = i + 1;
+ ItemList.Add(item);
+ }
+
+ Funs.DB.CQMS_MonthReportItem.InsertAllOnSubmit(ItemList);
+ Funs.DB.SubmitChanges();
+ this.InitTreeMenu();
+ Alert.ShowInTop("月报创建成功!", MessageBoxIcon.Success);
+ }
+ else
+ {
+ Alert.ShowInTop("月报已创建,请选择左边树的年进行编辑!", MessageBoxIcon.Warning);
+ return;
+ }
+ BindGrid();
+ }
+ else
+ {
+ Alert.ShowInTop("只能新建当年的月报!", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ else
+ {
+ Alert.ShowInTop("请选择年度!", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ else
+ {
+ Alert.ShowInTop("请先设置项目开工时间!", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ #endregion
+
+ protected void btnSave_Click(object sender, EventArgs e)
+ {
+ int cm = GetCurMonth();
+ JArray editReport = Grid1.GetMergedData();
+ if (editReport.Count > 0)
+ {
+ if (true || cm != 0)
+ {
+ for (int i = 0; i < editReport.Count; i++)
+ {
+ JObject objects = (JObject)editReport[i];
+ string monthReportItemId = objects["values"]["MonthReportItemId"].ToString();
+ Model.CQMS_MonthReportItem item = Funs.DB.CQMS_MonthReportItem.FirstOrDefault(x => x.MonthReportItemId == monthReportItemId);
+ // if (cm == 1)
+ {
+ item.Month1 = Funs.GetNewInt(objects["values"]["Month1"].ToString());
+ }
+ // if (cm == 2)
+ {
+ item.Month2 = Funs.GetNewInt(objects["values"]["Month2"].ToString());
+ }
+ // if (cm == 3)
+ {
+ item.Month3 = Funs.GetNewInt(objects["values"]["Month3"].ToString());
+ }
+ // if (cm == 4)
+ {
+ item.Month4 = Funs.GetNewInt(objects["values"]["Month4"].ToString());
+ }
+ // if (cm == 5)
+ {
+ item.Month5 = Funs.GetNewInt(objects["values"]["Month5"].ToString());
+ }
+ // if (cm == 6)
+ {
+ item.Month6 = Funs.GetNewInt(objects["values"]["Month6"].ToString());
+ }
+ //if (cm == 7)
+ {
+ item.Month7 = Funs.GetNewInt(objects["values"]["Month7"].ToString());
+ }
+ // if (cm == 8)
+ {
+ item.Month8 = Funs.GetNewInt(objects["values"]["Month8"].ToString());
+ }
+ //if (cm == 9)
+ {
+ item.Month9 = Funs.GetNewInt(objects["values"]["Month9"].ToString());
+ }
+ // if (cm == 10)
+ {
+ item.Month10 = Funs.GetNewInt(objects["values"]["Month10"].ToString());
+ }
+ //if (cm == 11)
+ {
+ item.Month11 = Funs.GetNewInt(objects["values"]["Month11"].ToString());
+ }
+ //if (cm == 12)
+ {
+ item.Month12 = Funs.GetNewInt(objects["values"]["Month12"].ToString());
+ }
+ item.YearTotal = Funs.GetNewInt(objects["values"]["YearTotal"].ToString());
+ item.ProjectTotal = Funs.GetNewInt(objects["values"]["ProjectTotal"].ToString());
+ Funs.DB.SubmitChanges();
+ this.ShowNotify("保存成功");
+ }
+ }
+ else
+ {
+ Alert.ShowInTop("月报的填报日期为每月的26号开始到下月的4号截止!", MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ }
+
+ ///
+ /// 获取可编辑的月份
+ ///
+ ///
+ private int GetCurMonth()
+ {
+ DateTime nowDate = DateTime.Now;
+ // 本月
+ int m = nowDate.Month;
+ // 上月
+ int lm = nowDate.AddMonths(-1).Month;
+ // 当月第几天
+ int cd = nowDate.Day;
+ // 下月的第几天
+ int nd = nowDate.AddMonths(1).Day;
+
+ int cm = 0;
+ if (cd >= 26)
+ {
+ cm = m;
+ }
+ if (nd <= 20)
+ {
+ cm = lm;
+ }
+ return cm;
+ }
+
+ #region 获取按钮权限
+ ///
+ /// 获取按钮权限
+ ///
+ ///
+ ///
+ private void GetButtonPower()
+ {
+ if (Request.Params["value"] == "0")
+ {
+ return;
+ }
+ var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WeekReportMenuId);
+ if (buttonList.Count() > 0)
+ {
+ if (buttonList.Contains(BLL.Const.BtnAdd))
+ {
+ this.btnNew.Hidden = false;
+ }
+ }
+ }
+ #endregion
+
+ #region 导出按钮
+ /// 导出按钮
+ ///
+ ///
+ ///
+ 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 = System.Text.Encoding.UTF8;
+ this.Grid1.PageSize = 500;
+ this.BindGrid();
+ Response.Write(GetGridTableHtml(Grid1));
+ Response.End();
+ }
+
+ ///
+ /// 导出方法
+ ///
+ ///
+ ///
+ private string GetGridTableHtml(Grid grid)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("");
+ sb.Append("");
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ sb.AppendFormat("{0} | ", column.HeaderText);
+ }
+ sb.Append("
");
+ foreach (GridRow row in grid.Rows)
+ {
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ string html = row.Values[column.ColumnIndex].ToString();
+ if (column.ColumnID == "tfNumber")
+ {
+ html = (row.FindControl("lblNumber") as AspNet.Label).Text;
+ }
+ sb.AppendFormat("{0} | ", html);
+ }
+
+ sb.Append("
");
+ }
+
+ sb.Append("
");
+
+ return sb.ToString();
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.designer.cs
new file mode 100644
index 00000000..dc84ca70
--- /dev/null
+++ b/SGGL/FineUIPro.Web/CQMS/ManageReport/ManagerMonthC.aspx.designer.cs
@@ -0,0 +1,242 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.CQMS.ManageReport
+{
+
+
+ public partial class ManagerMonthC
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// Panel1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel Panel1;
+
+ ///
+ /// panelLeftRegion 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel panelLeftRegion;
+
+ ///
+ /// tvControlItem 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Tree tvControlItem;
+
+ ///
+ /// panelCenterRegion 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel panelCenterRegion;
+
+ ///
+ /// Grid1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// ToolbarFill1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarFill ToolbarFill1;
+
+ ///
+ /// txtReportYear 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DatePicker txtReportYear;
+
+ ///
+ /// btnNew 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnNew;
+
+ ///
+ /// btnSave 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnSave;
+
+ ///
+ /// btnOut 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnOut;
+
+ ///
+ /// txtMonth1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth1;
+
+ ///
+ /// txtMonth2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth2;
+
+ ///
+ /// txtMonth3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth3;
+
+ ///
+ /// txtMonth4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth4;
+
+ ///
+ /// txtMonth5 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth5;
+
+ ///
+ /// txtMonth6 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth6;
+
+ ///
+ /// txtMonth7 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth7;
+
+ ///
+ /// txtMonth8 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth8;
+
+ ///
+ /// txtMonth9 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth9;
+
+ ///
+ /// txtMonth10 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth10;
+
+ ///
+ /// txtMonth11 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth11;
+
+ ///
+ /// txtMonth12 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.NumberBox txtMonth12;
+ }
+}
diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt
index 6d345475..1c9abd91 100644
--- a/SGGL/FineUIPro.Web/ErrLog.txt
+++ b/SGGL/FineUIPro.Web/ErrLog.txt
@@ -1365,3 +1365,43 @@ IP地址:::1
出错时间:05/21/2023 16:29:44
+
+错误信息开始=====>
+错误类型:NullReferenceException
+错误信息:未将对象引用设置到对象的实例。
+错误堆栈:
+ 在 FineUIPro.Web.CQMS.ManageReport.ManagerMonthC.BindGrid() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\ManageReport\ManagerMonthC.aspx.cs:行号 73
+ 在 FineUIPro.Web.CQMS.ManageReport.ManagerMonthC.btnNew_Click(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\ManageReport\ManagerMonthC.aspx.cs:行号 611
+ 在 FineUIPro.Button.OnClick(EventArgs e)
+ 在 (Button , EventArgs )
+ 在 FineUIPro.Button.RaisePostBackEvent(String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+ 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+出错时间:05/21/2023 19:42:45
+出错文件:http://localhost:1295/CQMS/ManageReport/ManagerMonthC.aspx
+IP地址:::1
+操作人员:JT
+
+出错时间:05/21/2023 19:42:45
+
+
+错误信息开始=====>
+错误类型:NullReferenceException
+错误信息:未将对象引用设置到对象的实例。
+错误堆栈:
+ 在 FineUIPro.Web.CQMS.ManageReport.ManagerMonthC.BindGrid() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\ManageReport\ManagerMonthC.aspx.cs:行号 73
+ 在 FineUIPro.Web.CQMS.ManageReport.ManagerMonthC.btnNew_Click(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\ManageReport\ManagerMonthC.aspx.cs:行号 611
+ 在 FineUIPro.Button.OnClick(EventArgs e)
+ 在 (Button , EventArgs )
+ 在 FineUIPro.Button.RaisePostBackEvent(String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+ 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+出错时间:05/21/2023 19:50:07
+出错文件:http://localhost:1295/CQMS/ManageReport/ManagerMonthC.aspx
+IP地址:::1
+操作人员:JT
+
+出错时间:05/21/2023 19:50:07
+
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index dcc69df1..fffde1f4 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -473,6 +473,7 @@
+
@@ -7742,6 +7743,13 @@
HJGLStatisc.aspx
+
+ ManagerMonthC.aspx
+ ASPXCodeBehind
+
+
+ ManagerMonthC.aspx
+
MonthReport.aspx
ASPXCodeBehind
diff --git a/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx b/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx
index 550c90a9..b9609a4d 100644
--- a/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx
@@ -34,7 +34,7 @@
-