เตรียม UI รายงานแบบประเมิน

This commit is contained in:
Nakorn Rientrakrunchai
2020-08-29 19:19:13 +07:00
parent f4a7c9c814
commit 933c9f7b4f
31 changed files with 1575 additions and 10 deletions

View File

@@ -18,8 +18,8 @@ namespace TodoAPI2.Models
eva_create_evaluation_detail_processWithSelectionViewModel GetWithSelection(int id, int? emp_id, string path);
eva_create_evaluation_detail_processWithSelectionViewModel GetBlankItem();
eva_create_evaluation_detail_processWithSelectionViewModel Get(int id, int? emp_id, string path);
DataContext GetDataContext();
}
}

View File

@@ -92,6 +92,10 @@ namespace TodoAPI2.Models
var data = (
from m_eva_create_evaluation_detail_process in _repository.Context.eva_create_evaluation_detail
join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_process.create_evaluation_id equals fk_eva_create_evaluation10.id
into eva_create_evaluationResult10
from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty()
join fk_external_employee in allemp on m_eva_create_evaluation_detail_process.employee_id equals fk_external_employee.id
into external_employeeResult
from fk_external_employee in external_employeeResult.DefaultIfEmpty()
@@ -100,9 +104,19 @@ namespace TodoAPI2.Models
into external_chiefResult
from fk_external_chief in external_chiefResult.DefaultIfEmpty()
join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_process.create_evaluation_id equals fk_eva_create_evaluation10.id
into eva_create_evaluationResult10
from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty()
join fk_external_supervisor2 in allemp on fk_eva_create_evaluationResult10.employee_id equals fk_external_supervisor2.id
into external_supervisor2Result
from fk_external_supervisor2 in external_supervisor2Result.DefaultIfEmpty()
join fk_external_supervisor1A in allemp on fk_eva_create_evaluationResult10.supervisor1_id equals fk_external_supervisor1A.id
into external_supervisor1AResult
from fk_external_supervisor1A in external_supervisor1AResult.DefaultIfEmpty()
join fk_external_supervisor2A in allemp on fk_eva_create_evaluationResult10.supervisor2_id equals fk_external_supervisor2A.id
into external_supervisor2AResult
from fk_external_supervisor2A in external_supervisor2AResult.DefaultIfEmpty()
where m_eva_create_evaluation_detail_process.id == id
@@ -111,12 +125,16 @@ namespace TodoAPI2.Models
{
id = m_eva_create_evaluation_detail_process.id,
evaluation_round = fk_eva_create_evaluationResult10.eva_performance_plan.display_text,
selected_round = fk_eva_create_evaluationResult10.eva_performance_plan.theTime,
fiscal_year = fk_eva_create_evaluationResult10.eva_performance_plan.fiscal_year,
employee_code = fk_external_employee.employee_no,
employee_fullname = fk_external_employee.fullname,
employee_profile_picture = fk_external_employee.profile_picture,
employee_position = fk_external_employee.position_name,
employee_position_type = fk_external_employee.position_type_name,
employee_position_level = fk_external_employee.position_level_text,
employee_org = fk_external_employee.department_name,
employee_main_dept = ext.GetMainDept(fk_external_employee.department_id),
employee_id = m_eva_create_evaluation_detail_process.employee_id,
chief_fullname = fk_external_chief.fullname,
chief_position = fk_external_chief.position_name,
@@ -125,6 +143,13 @@ namespace TodoAPI2.Models
search_employee_code = fk_external_employee.employee_no,
search_employee_fullname = fk_external_employee.fullname,
supervisor2_fullname = fk_external_supervisor2.fullname,
supervisor2_position = fk_external_supervisor2.position_name,
supervisor1A_fullname = fk_external_supervisor1A.fullname,
supervisor1A_position = fk_external_supervisor1A.position_name,
supervisor2A_fullname = fk_external_supervisor2A.fullname,
supervisor2A_position = fk_external_supervisor2A.position_name,
org_id_external_linkage_external_name = fk_external_employee.department_name,
create_evaluation_score1 = fk_eva_create_evaluationResult10.score1,
@@ -355,6 +380,11 @@ namespace TodoAPI2.Models
return "";
}
public DataContext GetDataContext()
{
return _repository.Context;
}
#endregion

View File

@@ -20,6 +20,8 @@ namespace TodoAPI2.Models
public string employee_fullname { get; set; }
public string employee_profile_picture { get; set; }
public string employee_position { get; set; }
public string employee_position_type { get; set; }
@@ -28,12 +30,26 @@ namespace TodoAPI2.Models
public string employee_org { get; set; }
public string employee_main_dept { get; set; }
public int? employee_id { get; set; }
public string chief_fullname { get; set; }
public string chief_position { get; set; }
public string supervisor2_fullname { get; set; }
public string supervisor2_position { get; set; }
public string supervisor1A_fullname { get; set; }
public string supervisor1A_position { get; set; }
public string supervisor2A_fullname { get; set; }
public string supervisor2A_position { get; set; }
public int? create_evaluation_id { get; set; }
public int? org_id { get; set; }

View File

@@ -20,5 +20,8 @@ namespace TodoAPI2.Models
public DateTime? start_date { get; set; }
public DateTime? end_date { get; set; }
public int? selected_round { get; set; }
public int? fiscal_year { get; set; }
}
}

View File

@@ -21,7 +21,7 @@ namespace TodoAPI2.Models
eva_idp_planWithSelectionViewModel GetWithSelection(int id);
eva_idp_planWithSelectionViewModel GetBlankItem();
void RefreshAutoFieldOfAllData();
}
}

View File

@@ -14,8 +14,6 @@ namespace TodoAPI2.Models
{
public class eva_idp_planEntity : BaseEntity2<int>
{
public int? create_evaluation_detail_id { get; set; }
[MaxLength(1000)]
@@ -28,6 +26,25 @@ namespace TodoAPI2.Models
public DateTime? end_date { get; set; }
[MaxLength(1000)]
public string period_text { get; set; }
public void SetAutoField(DataContext context)
{
string temp = "";
if (start_date.HasValue)
{
temp = MyHelper.GetDateStringForReport(start_date);
}
if (end_date.HasValue)
{
temp += " ถึง " + MyHelper.GetDateStringForReport(end_date);
}
}
public void DoAfterInsertUpdate(DataContext context)
{
}
}
}

View File

@@ -139,7 +139,7 @@ namespace TodoAPI2.Models
entity.id = GetNewPrimaryKey();
entity.SetAutoField(_repository.Context);
var inserted = _repository.Insert(entity);
return Get(inserted.id);
@@ -156,7 +156,7 @@ namespace TodoAPI2.Models
existingEntity.start_date = model.start_date;
existingEntity.end_date = model.end_date;
existingEntity.SetAutoField(_repository.Context);
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
}
@@ -228,5 +228,16 @@ namespace TodoAPI2.Models
#endregion
#endregion
public void RefreshAutoFieldOfAllData()
{
var all_items = from i in _repository.Context.eva_idp_plan
select i;
foreach (var item in all_items)
{
item.SetAutoField(_repository.Context);
}
_repository.Context.SaveChanges();
}
}
}

View File

@@ -73,6 +73,7 @@ orgdata.id as department_id,orgdata.department_name,orgdata.department_code,he.s
he.employee_type_id, het.employee_type_name,opd.position_id as position_id,
u.email as user_email, u.id as user_id,hpl.position_level_name,
he.profile_picture,
he.position_level_id,
he.position_type_id,
hpl.position_level_id as hpl_position_level_id,
@@ -123,6 +124,7 @@ order by he.firstname, he.lastname;
{
var i = new external_employeeViewModel();
i.id = Convert.ToInt32(dr["id"]);
i.profile_picture = dr["profile_picture"].ToString();
i.position_number = dr["position_number"].ToString();
i.position_name = dr["position_name"].ToString();
i.fullname= dr["fullname"].ToString();

View File

@@ -54,6 +54,7 @@ namespace TodoAPI2.Models
public decimal? cost_of_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? other_money { get; set; }
public string profile_picture { get; set; }
public int? worked_month // ทำงานมาแล้วกี่เดือน
{

View File

@@ -35,6 +35,7 @@ namespace TodoAPI2.Models
List<external_linkageViewModel> GetSortingDep();
List<external_linkageViewModel> GetFiscalYear2();
List<external_linkageViewModel> GetThaiMonth();
string GetMainDept(int? dep_id);
}
}

View File

@@ -427,6 +427,28 @@ namespace TodoAPI2.Models
return all_result;
}
public string GetMainDept(int? dep_id)
{
var sql = string.Format(@"select data1.id,data1.department_name as p1,data2.department_name as p2
from public.{0}DepartmentData{0} data1
left join org_organization_chart_details detail
on data1.id=detail.department_id
left join public.{0}DepartmentData{0} data2
on data2.id=detail.parent_department_id
where data1.id={1};", '"'.ToString(), dep_id.ToString());
var para = db.GetParameterListNpgsql();
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
var result = "";
foreach (DataRow dr in dt.Rows)
{
if(dr["p2"] != null)
{
result = dr["p2"].ToString();
}
}
return result;
}
public List<external_linkageViewModel> GetChildInDep(int? dep_id)
{
var sql = string.Format(@"select data1.id,data1.department_name

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
namespace TodoAPI2.Models
{
public interface Irep_eva_xService
{
rep_eva_xWithSelectionViewModel GetBlankItem();
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class rep_eva_xInputModel
{
public Guid? id { get; set; }
public string detail_id { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class rep_eva_xInputModel2
{
public int? create_evaluation_detail_id { get; set; }
public string employee_fullname { get; set; }
public string employee_code { get; set; }
public string employee_position_type { get; set; }
public string employee_position_level { get; set; }
public string employee_org { get; set; }
public string employee_position { get; set; }
public string image_url { get; set; }
public string chief_fullname { get; set; }
public string chief_position { get; set; }
public string supervisor2_fullname { get; set; }
public string supervisor2_position { get; set; }
public string supervisor1A_fullname { get; set; }
public string supervisor1A_position { get; set; }
public string supervisor2A_fullname { get; set; }
public string supervisor2A_position { get; set; }
public string leave_period { get; set; }
public string main_dept { get; set; }
public int? selected_round { get; set; }
public string round1_text { get; set; }
public string round2_text { get; set; }
public decimal? total_summary_supervisor2A { get; set; }
public decimal? Final_summary_supervisor2A { get; set; }
public decimal? total_summary_competency_supervisor2A { get; set; }
public decimal? Final_summary_competency_supervisor2A { get; set; }
public decimal? achievement_supervisor2A { get; set; }
public decimal? competency_supervisor2A { get; set; }
public decimal? score_supervisor2A { get; set; }
public string level_score_supervisor2A { get; set; }
public decimal? w1 { get; set; }
public decimal? w2 { get; set; }
public decimal? sum_day_sick_leave { get; set; }
public decimal? count_sick_leave { get; set; }
public decimal? sum_day_personal_leave { get; set; }
public decimal? count_personal_leave { get; set; }
public decimal? sum_day_vacation_leave { get; set; }
public decimal? count_stop_working { get; set; }
public decimal? count_late_tad_processing_time_results { get; set; }
public decimal? count_absence_tad_processing_time_results { get; set; }
public decimal? sum_day_sick_personal_leave { get; set; }
public decimal? count_sick_personal_leave { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class rep_eva_xReportRequestModel : rep_eva_xSearchModel
{
public string filetype { get; set; }
public string contentType { get { return MyHelper.GetContentType(filetype); } }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class rep_eva_xSearchModel
{
public Guid id { get; set; }
public string detail_id { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
using TodoAPI2.Models;
using System.IO;
using System.Web;
using System.Net;
using TTSW.Configure;
using Microsoft.Extensions.Options;
using System.Data;
namespace TodoAPI2.Models
{
public class rep_eva_xService : Irep_eva_xService
{
private IBaseRepository<eva_level_scoreEntity, Guid> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
public rep_eva_xService(IBaseRepository<eva_level_scoreEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
}
public rep_eva_xWithSelectionViewModel GetBlankItem()
{
var i = new rep_eva_xWithSelectionViewModel();
return i;
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using TTSW.EF;
using TTSW.Utils;
using TTSW.Constant;
using TTSW.Common;
namespace TodoAPI2.Models
{
public class rep_eva_xViewModel : BaseViewModel2<Guid>
{
public string detail_id { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TodoAPI2.Models
{
public class rep_eva_xWithSelectionViewModel: rep_eva_xViewModel
{
}
}