From 61f067f1509c5faabfc7f059346c0b83680602d3 Mon Sep 17 00:00:00 2001 From: nakorn Date: Thu, 17 Mar 2022 16:12:32 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B8=E0=B8=87=20=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B8=B8=E0=B8=A1=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=95?= =?UTF-8?q?=E0=B8=81=E0=B8=A5=E0=B8=87=20=E0=B8=82=E0=B8=AD=E0=B8=87=20?= =?UTF-8?q?=E0=B8=9C=E0=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ApiControllers/rep_eva_xControllers.cs | 13 ++++++-- ...reate_evaluation_detail_firstdocService.cs | 4 ++- ...reate_evaluation_detail_review0AService.cs | 8 ++--- ...eate_evaluation_detail_statusInputModel.cs | 2 ++ ..._create_evaluation_detail_statusService.cs | 1 + .../eva_limit_frame_groupService.cs | 33 ++++++++++++------- .../vw_limit_frame_planService.cs | 30 +++++++++++------ ...create_evaluation_detail_firstdoc_d.cshtml | 2 ++ ...eva_create_evaluation_detail_firstdoc_d.js | 3 +- .../eva_create_evaluation_detail_status_d.js | 3 ++ 10 files changed, 70 insertions(+), 29 deletions(-) diff --git a/ApiControllers/rep_eva_xControllers.cs b/ApiControllers/rep_eva_xControllers.cs index 7642536..c4d0f02 100644 --- a/ApiControllers/rep_eva_xControllers.cs +++ b/ApiControllers/rep_eva_xControllers.cs @@ -280,6 +280,10 @@ namespace TodoAPI2.Controllers if (p1.chief_fullname == p1.supervisor2_fullname) { url = $"{mainurl}{reportsite}/rep_eva_x{k}A.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}"; + if (!string.IsNullOrEmpty(p1.supervisor3A_fullname)) + { + url = $"{mainurl}{reportsite}/rep_eva_x{k}AC.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}"; + } } else { @@ -401,8 +405,8 @@ namespace TodoAPI2.Controllers where n.performance_plan_id == x2.id select n.start_date).Min(); var end = (from n in context.eva_performance_plan_detail - where n.performance_plan_id == x2.id - select n.end_date).Min(); + where n.performance_plan_id == x2.id + select n.end_date).Max(); var text = MyHelper.GetDateStringForReport(start) + " ถึง " + MyHelper.GetDateStringForReport(end); if(x2.theTime == 1) { @@ -414,6 +418,11 @@ namespace TodoAPI2.Controllers } } + if (string.IsNullOrEmpty(i.round2_text)) + { + i.round2_text = $"1 เมษายน {p.fiscal_year} ถึง 30 กันยายน {p.fiscal_year}"; + } + var detail = (from x in context.eva_create_evaluation_detail where x.id == detail_id select x).FirstOrDefault(); diff --git a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs index d578b88..ff858e2 100644 --- a/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs +++ b/Models/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdocService.cs @@ -128,7 +128,7 @@ namespace TodoAPI2.Models status_chief = m_eva_create_evaluation_detail_agreement.status_chief, status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a, status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor, - status_supervisor_a = null, + status_supervisor_a = m_eva_create_evaluation_detail_agreement.status_supervisor_a, org_id_external_linkage_external_name = fk_external_employee.department_name, @@ -445,6 +445,7 @@ namespace TodoAPI2.Models status_chief = m_eva_create_evaluation_detail_agreement.status_chief, status_chief_a = m_eva_create_evaluation_detail_agreement.status_chief_a, status_supervisor = m_eva_create_evaluation_detail_agreement.status_supervisor, + status_supervisor_a = m_eva_create_evaluation_detail_agreement.status_supervisor_a, org_id_external_linkage_external_name = !string.IsNullOrEmpty(fk_external_linkageResult11.external_name) ? fk_external_linkageResult11.external_name : fk_external_linkageResult12.external_name, @@ -453,6 +454,7 @@ namespace TodoAPI2.Models status_self_a_click_date = m_eva_create_evaluation_detail_agreement.status_self_a_click_date, status_chief_a_click_date = m_eva_create_evaluation_detail_agreement.status_chief_a_click_date, status_supervisor_click_date = m_eva_create_evaluation_detail_agreement.status_supervisor_click_date, + status_supervisor_a_click_date = m_eva_create_evaluation_detail_agreement.status_supervisor_a_click_date, plan_round_year = checkNull(fk_planResult.theTime) + "/" + checkNull(fk_planResult.fiscal_year), diff --git a/Models/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0AService.cs b/Models/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0AService.cs index a0ac579..ad02025 100644 --- a/Models/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0AService.cs +++ b/Models/eva_create_evaluation_detail_review0A/eva_create_evaluation_detail_review0AService.cs @@ -187,10 +187,10 @@ namespace TodoAPI2.Models where k.id == model.id select k).FirstOrDefault(); - if (current_detail.status_chief_a == "Y") - { - throw new Exception("ผู้ประเมิน อนุมัติข้อตกลงไปแล้ว บันทึกไม่ได้"); - } + //if (current_detail.status_chief_a == "Y") + //{ + // throw new Exception("ผู้ประเมิน อนุมัติข้อตกลงไปแล้ว บันทึกไม่ได้"); + //} existingEntity.create_evaluation_id = model.create_evaluation_id; existingEntity.chief_a = model.chief_a; diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs index 47aca51..4d8ce55 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusInputModel.cs @@ -26,6 +26,8 @@ namespace TodoAPI2.Models public string status_chief_a { get; set; } + public string status_supervisor_a { get; set; } + public string status_supervisor { get; set; } public string status_supervisor1A { get; set; } diff --git a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs index 89f18ed..0cb7f1f 100644 --- a/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs +++ b/Models/eva_create_evaluation_detail_status/eva_create_evaluation_detail_statusService.cs @@ -200,6 +200,7 @@ namespace TodoAPI2.Models existingEntity.status_chief = model.status_chief; existingEntity.status_self_a = model.status_self_a; existingEntity.status_chief_a = model.status_chief_a; + existingEntity.status_supervisor_a = model.status_supervisor_a; existingEntity.status_supervisor = model.status_supervisor; existingEntity.status_supervisor1A = model.status_supervisor1A; existingEntity.status_supervisor2A = model.status_supervisor2A; diff --git a/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs b/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs index 0ee13f4..4cfab76 100644 --- a/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs +++ b/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs @@ -183,15 +183,23 @@ namespace TodoAPI2.Models { var existingEntity = _repository.Get(id); - var plan = (from i in _repository.Context.eva_limit_frame_plan where i.plan_guid == existingEntity.frame_plan_guid select i).FirstOrDefault(); + var plan = (from i in _repository.Context.eva_limit_frame_plan + where i.id == existingEntity.frame_plan_guid + select i).FirstOrDefault(); + + var start = (from n in _repository.Context.eva_performance_plan_detail + where n.performance_plan_id == plan.plan_guid + select n.start_date).Min(); + var end = (from n in _repository.Context.eva_performance_plan_detail + where n.performance_plan_id == plan.plan_guid + select n.end_date).Max(); var all_all_emp = emp.GetAllEmployee(); var mapping_dept = emp.GetDeptMapping(); var working_record = from i in emp.GetWorkingRecord() -// where -//plan.executed_date.HasValue -//&& i.start_date <= plan.executed_date -//&& i.end_date >= plan.executed_date + where +i.start_date >= start +&& i.end_date <= end select i; if (existingEntity != null) @@ -212,13 +220,16 @@ namespace TodoAPI2.Models { var theemp = (from q in all_all_emp where q.id == y.employee_id select q).FirstOrDefault(); var thedetail = (from r in working_record where r.employee_id == y.employee_id select r).FirstOrDefault(); - var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault(); - if (theemp != null && thedetail != null && help_at != null) + if(thedetail != null) { - if (existingEntity.remark != "") existingEntity.remark += "\n"; - existingEntity.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}"; - } - j++; + var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault(); + if (theemp != null && help_at != null) + { + if (existingEntity.remark != "") existingEntity.remark += "\n"; + existingEntity.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}"; + } + j++; + } } } diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs index 9560ec1..9f964c5 100644 --- a/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs @@ -150,12 +150,19 @@ namespace TodoAPI2.Models entity.id = Guid.NewGuid(); entity.limit_frame_005 = (decimal?)0.05; + var start = (from n in _repository.Context.eva_performance_plan_detail + where n.performance_plan_id == model.plan_guid + select n.start_date).Min(); + var end = (from n in _repository.Context.eva_performance_plan_detail + where n.performance_plan_id == model.plan_guid + select n.end_date).Max(); + var all_all_emp = emp.GetAllEmployee(); var mapping_dept = emp.GetDeptMapping(); - var working_record = from i in emp.GetWorkingRecord() where - model.executed_date.HasValue - && i.start_date <= model.executed_date - && i.end_date >= model.executed_date + var working_record = from i in emp.GetWorkingRecord() + where +i.start_date >= start +&& i.end_date <= end select i; var result_frame_group = new List(); var result_frame_employee = new List(); @@ -242,13 +249,16 @@ namespace TodoAPI2.Models { var theemp = (from q in all_all_emp where q.id == y.employee_id select q).FirstOrDefault(); var thedetail = (from r in working_record where r.employee_id == y.employee_id select r).FirstOrDefault(); - var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault(); - if(theemp != null && thedetail != null && help_at != null) + if(thedetail != null) { - if (x.remark != "") x.remark += "\n"; - x.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}"; - } - j++; + var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault(); + if (theemp != null && help_at != null) + { + if (x.remark != "") x.remark += "\n"; + x.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}"; + } + j++; + } } } } diff --git a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml index a8f802d..0fc995c 100644 --- a/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml +++ b/Views/eva_create_evaluation_detail_firstdocView/eva_create_evaluation_detail_firstdoc_d.cshtml @@ -319,6 +319,8 @@ function CheckPermission() { + console.log("status_supervisor_a =" + status_supervisor_a); + $(".status_self").hide(); $(".status_chief").hide(); $(".status_supervisor").hide(); diff --git a/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js b/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js index 34f5901..a18c87c 100644 --- a/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js +++ b/wwwroot/js/eva_create_evaluation_detail_firstdoc/eva_create_evaluation_detail_firstdoc_d.js @@ -70,12 +70,13 @@ function eva_create_evaluation_detail_firstdoc_InitialForm() { function eva_create_evaluation_detail_firstdoc_SetEditForm(a) { var successFunc = function (result) { - console.log(result) + //console.log(result) eva_create_evaluation_detail_firstdoc_editMode = "UPDATE"; eva_create_evaluation_detail_firstdoc_FeedDataToForm(result); endLoad(); }; startLoad(); + console.log(apisite + eva_create_evaluation_detail_firstdoc_API + a); AjaxGetRequest(apisite + eva_create_evaluation_detail_firstdoc_API + a, successFunc, AlertDanger); } diff --git a/wwwroot/js/eva_create_evaluation_detail_status/eva_create_evaluation_detail_status_d.js b/wwwroot/js/eva_create_evaluation_detail_status/eva_create_evaluation_detail_status_d.js index 498b6eb..5ceff1d 100644 --- a/wwwroot/js/eva_create_evaluation_detail_status/eva_create_evaluation_detail_status_d.js +++ b/wwwroot/js/eva_create_evaluation_detail_status/eva_create_evaluation_detail_status_d.js @@ -88,6 +88,9 @@ function eva_create_evaluation_detail_status_PutUpdate(a) { else if (a === "nextB") { data.status_chief_a = "Y"; } + else if (a === "nextC") { + data.status_supervisor_a = "Y"; + } else if (a === "next0") { data.status_self = "Y"; }