ปรับปรุงสูตรการคำนวณต่างๆ
This commit is contained in:
@@ -85,10 +85,50 @@ namespace TodoAPI2.Models
|
||||
return GetListBySearch(model);
|
||||
}
|
||||
|
||||
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 List<eva_adjust_postponement_detail_quota_02ViewModel> GetListBySearch(eva_adjust_postponement_detail_quota_02SearchModel model)
|
||||
{
|
||||
var all_emp = emp.GetListByemployee_type(null, null);
|
||||
|
||||
var endDate = (from m_eva_adjust_postponement_detail_quota_02 in _repository.Context.eva_adjust_postponement_detail
|
||||
|
||||
join fk_eva_adjust_postponement1 in _repository.Context.eva_adjust_postponement on m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id equals fk_eva_adjust_postponement1.id
|
||||
into eva_adjust_postponementResult1
|
||||
from fk_eva_adjust_postponementResult1 in eva_adjust_postponementResult1.DefaultIfEmpty()
|
||||
|
||||
join fk_eva_adjust_postponement1A in _repository.Context.eva_adjust_postponement on m_eva_adjust_postponement_detail_quota_02.adjust_postponement_id equals fk_eva_adjust_postponement1A.id
|
||||
into eva_adjust_postponementResult1A
|
||||
from fk_eva_adjust_postponementResult1A in eva_adjust_postponementResult1A.DefaultIfEmpty()
|
||||
|
||||
join create_detail in _repository.Context.eva_create_evaluation_detail
|
||||
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_detail.create_evaluation_id
|
||||
into create_detailResult
|
||||
from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
|
||||
|
||||
join create_data in _repository.Context.eva_create_evaluation
|
||||
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
|
||||
into create_dataResult
|
||||
from fk_create_dataResult in create_dataResult.DefaultIfEmpty()
|
||||
|
||||
join i in _repository.Context.eva_performance_plan_detail
|
||||
on fk_create_dataResult.performance_plan_id equals i.performance_plan_id
|
||||
|
||||
where m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id == model.adjust_postponement_quota_id
|
||||
|
||||
select i.end_date).Max();
|
||||
|
||||
var data = (
|
||||
from m_eva_adjust_postponement_detail_quota_02 in _repository.Context.eva_adjust_postponement_detail
|
||||
|
||||
@@ -113,6 +153,11 @@ namespace TodoAPI2.Models
|
||||
into create_detailResult
|
||||
from fk_create_detailResult in create_detailResult.DefaultIfEmpty()
|
||||
|
||||
join create_data in _repository.Context.eva_create_evaluation
|
||||
on fk_eva_adjust_postponementResult1A.create_evaluation_id equals create_data.id
|
||||
into create_dataResult
|
||||
from fk_create_dataResult in create_dataResult.DefaultIfEmpty()
|
||||
|
||||
where 1==1
|
||||
//&& (m_eva_adjust_postponement_detail_quota_02.id == model.id || !model.id.HasValue)
|
||||
&& (m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id == model.adjust_postponement_quota_id || !model.adjust_postponement_quota_id.HasValue)
|
||||
@@ -131,14 +176,14 @@ namespace TodoAPI2.Models
|
||||
adjust_postponement_quota_id = m_eva_adjust_postponement_detail_quota_02.adjust_postponement_quota_id,
|
||||
employee_id = m_eva_adjust_postponement_detail_quota_02.employee_id,
|
||||
sarary = m_eva_adjust_postponement_detail_quota_02.sarary,
|
||||
// cost_living = m_eva_adjust_postponement_detail_quota_02.cost_living,
|
||||
//cost_living = m_eva_adjust_postponement_detail_quota_02.cost_living,
|
||||
cost_living = fk_external_linkageResult2.cost_of_living,
|
||||
middle = m_eva_adjust_postponement_detail_quota_02.middle,
|
||||
promoted_percentage = m_eva_adjust_postponement_detail_quota_02.promoted_percentage,
|
||||
total_promote = m_eva_adjust_postponement_detail_quota_02.total_promote,
|
||||
new_sarary = m_eva_adjust_postponement_detail_quota_02.new_sarary,
|
||||
new_cost_living = m_eva_adjust_postponement_detail_quota_02.new_cost_living,
|
||||
remark = m_eva_adjust_postponement_detail_quota_02.remark,
|
||||
remark = GetWorkTimeText(fk_external_linkageResult2.packing_date, endDate),
|
||||
receive_quota = m_eva_adjust_postponement_detail_quota_02.receive_quota,
|
||||
new_sarary_with_quota = m_eva_adjust_postponement_detail_quota_02.new_sarary_with_quota,
|
||||
emp_code = fk_external_linkageResult2.employee_no,
|
||||
@@ -153,6 +198,9 @@ namespace TodoAPI2.Models
|
||||
position_allowance = fk_external_linkageResult2.position_allowance,
|
||||
other_money = fk_external_linkageResult2.other_money,
|
||||
|
||||
startDate = fk_external_linkageResult2.packing_date,
|
||||
endDate = endDate,
|
||||
|
||||
isActive = m_eva_adjust_postponement_detail_quota_02.isActive,
|
||||
Created = m_eva_adjust_postponement_detail_quota_02.created,
|
||||
Updated = m_eva_adjust_postponement_detail_quota_02.updated
|
||||
|
||||
@@ -57,5 +57,8 @@ namespace TodoAPI2.Models
|
||||
public decimal? position_allowance { get; set; }
|
||||
|
||||
public decimal? other_money { get; set; }
|
||||
|
||||
public DateTime? startDate { get; set; }
|
||||
public DateTime? endDate { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user