ปรับปรุงสูตรการคำนวณต่างๆ

This commit is contained in:
Nakorn Rientrakrunchai
2020-08-16 16:20:47 +07:00
parent 9df224d42d
commit a1ff729171
14 changed files with 171 additions and 24 deletions

View File

@@ -51,16 +51,42 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_create_evaluation_detail_agreementViewModel>>(entities);
}
#endregion
#region Public Functions
#region Query Functions
public string GetWorkTimeText(DateTime? startDate, DateTime? endDate)
{
if (!endDate.HasValue || !startDate.HasValue)
return "";
int monthsApart = 12 * (startDate.Value.Year - endDate.Value.Year) + startDate.Value.Month - endDate.Value.Month;
if (Math.Abs(monthsApart) < 4)
{
return "ปฏิบัติงานไม่ครบ 4 เดือน";
}
return "";
}
public eva_create_evaluation_detail_agreementWithSelectionViewModel Get(int id)
{
var allemp = emp.GetListByemployee_type(null, null);
var endDate = (from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
join fk_eva_create_evaluation10 in _repository.Context.eva_create_evaluation on m_eva_create_evaluation_detail_agreement.create_evaluation_id equals fk_eva_create_evaluation10.id
into eva_create_evaluationResult10
from fk_eva_create_evaluationResult10 in eva_create_evaluationResult10.DefaultIfEmpty()
join i in _repository.Context.eva_performance_plan_detail
on fk_eva_create_evaluationResult10.performance_plan_id equals i.performance_plan_id
where m_eva_create_evaluation_detail_agreement.id == id
select i.end_date).Max();
var data = (
from m_eva_create_evaluation_detail_agreement in _repository.Context.eva_create_evaluation_detail
@@ -101,7 +127,8 @@ namespace TodoAPI2.Models
org_id_external_linkage_external_name = fk_external_employee.department_name,
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record,
remark_hrm_work_record = fk_external_employee.remark_hrm_work_record
+ GetWorkTimeText(fk_external_employee.packing_date, endDate),
isActive = m_eva_create_evaluation_detail_agreement.isActive,
Created = m_eva_create_evaluation_detail_agreement.created,