ปรับปรุงเฉพาะส่วนที่เกี่ยวกับรายงาน และการประมวลผล

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-04-06 21:46:39 +07:00
parent 58cc8018af
commit 4623ca3ff3
4 changed files with 71 additions and 2 deletions

View File

@@ -276,6 +276,15 @@ namespace TodoAPI2.Models
public vw_limit_frame_planViewModel Update(Guid id, vw_limit_frame_planInputModel model, bool is_force_save)
{
var existingEntity = _repository.Get(id);
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
select i;
if (existingEntity != null)
{
existingEntity.plan_guid = model.plan_guid;
@@ -286,6 +295,27 @@ namespace TodoAPI2.Models
existingEntity.limit_frame_005_total = model.limit_frame_005_total;
existingEntity.limit_frame_005_total_rounded = model.limit_frame_005_total_rounded;
foreach (var x in from i in _repository.Context.eva_limit_frame_group where i.frame_plan_guid == id select i)
{
x.remark = "";
foreach (var y in from z in _repository.Context.eva_limit_frame_employee where z.frame_group_guid == x.id orderby z.order_of_data select z)
{
int j = 1;
if (y.help_org_id.HasValue)
{
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 (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++;
}
}
}
existingEntity.SetAutoField(_repository.Context);
if (is_force_save)