ปรับปรุง การอนุมัติแบบข้อตกลง ของ ผอ
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user