ปรับปรุง report

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-09-26 17:36:59 +07:00
parent 14c7df9d17
commit 0aac403a33
5 changed files with 31 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ namespace TodoAPI2.Models
rep_summary_a01WithSelectionViewModel GetWithSelection(Guid id);
rep_summary_a01WithSelectionViewModel GetBlankItem();
string GetDisplayText(int? round_id);
}
}

View File

@@ -21,7 +21,7 @@ namespace TodoAPI2.Models
public int? round_id { get; set; }
public int? employee_id { get; set; }
public string round_text { get; set; }
}
}

View File

@@ -51,6 +51,31 @@ namespace TodoAPI2.Models
return i;
}
public string GetDisplayText(int? round_id)
{
var postponement = (from i in _repository.Context.eva_adjust_postponement
where i.id == round_id
select i).FirstOrDefault();
if(postponement != null)
{
var plan = (from i in _repository.Context.eva_performance_plan
where i.fiscal_year == postponement.fiscal_year
&& i.theTime == postponement.theRound
select i).FirstOrDefault();
if(plan != null)
{
var start = (from i in _repository.Context.eva_performance_plan_detail
where i.performance_plan_id == plan.id
select i.start_date).Min();
var end = (from i in _repository.Context.eva_performance_plan_detail
where i.performance_plan_id == plan.id
select i.end_date).Max();
return $"รอบที่ {postponement.theRound} ปี {postponement.fiscal_year} ({MyHelper.GetDateStringForReport(start)} - {MyHelper.GetDateStringForReport(end)})";
}
}
return null;
}
}
}