เสร็จงานอนุมัติ ปรับเลื่อนเงินเดือน และ โควต้า
This commit is contained in:
@@ -23,6 +23,8 @@ namespace TodoAPI2.Models
|
||||
rep_eva_savemessageReportRequestModel setModelFor_rep_eva_savemessageReport(rep_eva_savemessageReportRequestModel model);
|
||||
DataContext GetContext();
|
||||
|
||||
void updateAllpostponement(int id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,39 @@ namespace TodoAPI2.Models
|
||||
|
||||
return GetDto(entity);
|
||||
}
|
||||
|
||||
private string isStringNull(string a, string b)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(a)) return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
private T isNull<T>(T a, T b)
|
||||
{
|
||||
if (a != null) return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
public void updateAllpostponement(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
|
||||
var postponement = from x in _repository.Context.eva_adjust_postponement
|
||||
where x.fiscal_year == entity.fiscal_year
|
||||
&& x.theRound == entity.theRound
|
||||
&& x.id != entity.id
|
||||
select x;
|
||||
|
||||
foreach(var i in postponement)
|
||||
{
|
||||
//i.postponement_status = entity.postponement_status;
|
||||
i.quota_status = entity.quota_status;
|
||||
i.quota_final_status = entity.quota_final_status;
|
||||
}
|
||||
|
||||
_repository.Context.SaveChanges();
|
||||
}
|
||||
|
||||
public eva_adjust_postponement_quotaWithSelectionViewModel GetWithSelection(int id)
|
||||
{
|
||||
var entity = _repository.Get(id);
|
||||
@@ -84,6 +117,19 @@ namespace TodoAPI2.Models
|
||||
select new external_linkageViewModel { external_id = x.theRound, external_name = x.theRound.ToString() }
|
||||
).Distinct().OrderByDescending(x => x.external_id).ToList();
|
||||
|
||||
var postponement = from x in _repository.Context.eva_adjust_postponement
|
||||
join e in emp.GetAllEmployee() on isNull(x.managed_by, x.postponement_status_by) equals e.id
|
||||
join v in ext.GetAgreeDisagree4() on isStringNull(x.postponement_status, "W") equals v.external_code
|
||||
join c in _repository.Context.eva_create_evaluation on x.create_evaluation_id equals c.id
|
||||
join d in _repository.Context.eva_evaluation_group on c.evaluation_group_id equals d.id
|
||||
where x.fiscal_year == entity.fiscal_year
|
||||
&& x.theRound == entity.theRound
|
||||
&& x.id != entity.id
|
||||
select d.thegroup + " โดย " + e.fullname + " " + v.external_name;
|
||||
|
||||
|
||||
i.approve_status = postponement.ToList();
|
||||
|
||||
return i;
|
||||
}
|
||||
public eva_adjust_postponement_quotaWithSelectionViewModel GetBlankItem()
|
||||
|
||||
@@ -10,5 +10,7 @@ namespace TodoAPI2.Models
|
||||
public List<external_employeeViewModel> item_managed_by { get; set; }
|
||||
public List<external_linkageViewModel> item_fiscal_year_search { get; set; }
|
||||
public List<external_linkageViewModel> item_theRound_search { get; set; }
|
||||
public List<string> approve_status { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,18 +23,20 @@ namespace TodoAPI2.Models
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
|
||||
private Ieva_adjust_postponement_quotaService quotaStatus;
|
||||
public eva_adjust_postponement_update_statusService(
|
||||
IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb,
|
||||
Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_adjust_postponement_quotaService inquotaStatus
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
quotaStatus = inquotaStatus;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -183,6 +185,9 @@ namespace TodoAPI2.Models
|
||||
existingEntity.postponement_status_note = model.postponement_status_note;
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
|
||||
//quotaStatus.updateAllpostponement(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -23,15 +23,18 @@ namespace TodoAPI2.Models
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_adjust_postponement_quotaService quotaStatus;
|
||||
|
||||
public eva_adjust_quota_update_final_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb, Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp)
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_adjust_postponement_quotaService inquotaStatus)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
quotaStatus = inquotaStatus;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -164,13 +167,18 @@ namespace TodoAPI2.Models
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_final_statusViewModel Update(int id,
|
||||
eva_adjust_quota_update_final_statusInputModel model, bool is_force_save, int? updateby)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
if(model.quota_final_status == "Y" && existingEntity.quota_status != "Y")
|
||||
{
|
||||
throw new Exception("ผู้อนุมัติวงเงินที่กันไว้ คนแรก, ยังไม่ได้อนุมัติ วงเงินที่กันไว้");
|
||||
}
|
||||
|
||||
existingEntity.quota_final_status = model.quota_final_status;
|
||||
existingEntity.quota_final_status_date = DateTime.Now;
|
||||
existingEntity.quota_final_status_by = updateby;
|
||||
@@ -183,6 +191,9 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
|
||||
quotaStatus.updateAllpostponement(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -23,16 +23,19 @@ namespace TodoAPI2.Models
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
private Iexternal_employeeService emp;
|
||||
private Ieva_adjust_postponement_quotaService quotaStatus;
|
||||
|
||||
public eva_adjust_quota_update_statusService(IBaseRepository2<eva_adjust_postponementEntity, int> repository,
|
||||
IMyDatabase mydb,
|
||||
Iexternal_linkageService inext,
|
||||
Iexternal_employeeService inemp)
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_adjust_postponement_quotaService inquotaStatus)
|
||||
{
|
||||
_repository = repository;
|
||||
db = mydb;
|
||||
ext = inext;
|
||||
emp = inemp;
|
||||
quotaStatus = inquotaStatus;
|
||||
}
|
||||
|
||||
#region Private Functions
|
||||
@@ -165,12 +168,26 @@ namespace TodoAPI2.Models
|
||||
return newkey.Value;
|
||||
}
|
||||
|
||||
|
||||
public eva_adjust_quota_update_statusViewModel Update(int id, eva_adjust_quota_update_statusInputModel model, bool is_force_save, int? updateby)
|
||||
{
|
||||
var existingEntity = _repository.Get(id);
|
||||
|
||||
if (existingEntity != null)
|
||||
{
|
||||
if (model.quota_status == "Y")
|
||||
{
|
||||
var postponement = from x in _repository.Context.eva_adjust_postponement
|
||||
where x.fiscal_year == existingEntity.fiscal_year
|
||||
&& x.theRound == existingEntity.theRound
|
||||
&& x.id != existingEntity.id
|
||||
&& x.postponement_status != "Y"
|
||||
select x;
|
||||
if (postponement.Count() > 0)
|
||||
{
|
||||
throw new Exception("ยังมีบางหน่วยงาน ยังไม่ได้อนุมัติ ปรับเลื่อนค่าตอบแทน");
|
||||
}
|
||||
}
|
||||
|
||||
existingEntity.quota_status = model.quota_status;
|
||||
existingEntity.quota_status_date = DateTime.Now;
|
||||
existingEntity.quota_status_by = updateby;
|
||||
@@ -184,6 +201,9 @@ namespace TodoAPI2.Models
|
||||
}
|
||||
|
||||
var updated = _repository.Update(id, existingEntity);
|
||||
|
||||
quotaStatus.updateAllpostponement(id);
|
||||
|
||||
return Get(updated.id);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -454,6 +454,9 @@ namespace TodoAPI2.Models
|
||||
|| ((m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor1_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor1_id : fk_eva_create_evaluationResult10.supervisor1_id))
|
||||
|| ((m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor2_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor2_id : fk_eva_create_evaluationResult10.supervisor2_id))
|
||||
|| ((int?[])special_person).Contains(emp_id)
|
||||
|
||||
|| ((m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id).HasValue && emp_id == (m_eva_create_evaluation_detail_process.supervisor3_id.HasValue ? m_eva_create_evaluation_detail_process.supervisor3_id : fk_eva_create_evaluationResult10.supervisor3_id))
|
||||
|
||||
)
|
||||
&& (!model.employee_id.HasValue || m_eva_create_evaluation_detail_process.employee_id == model.employee_id)
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
<td>
|
||||
|
||||
<button type="button" onclick="javascript:eva_adjust_postponement_normal_PutUpdate()"><i class="fa fa-save"></i>บันทึก</button>
|
||||
<button id="savebtn" type="button" onclick="javascript:eva_adjust_postponement_normal_PutUpdate()"><i class="fa fa-save"></i>บันทึก</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -153,7 +153,7 @@
|
||||
<div class="col-md-12">
|
||||
<button style="display:none;" class="btn btn-info" type="button" onclick="javascript:Oneva_adjust_postponement_detail_normal_02_promoted_percentageChanged(true)">คำนวณค่าครองชีพใหม่ ตามเกณฑ์เงินเดือน 13,285</button>
|
||||
|
||||
<button class="btn btn-info" onclick="javascript:eva_adjust_postponement_update_status_SetEditForm(getUrlParameter('id'), true);">อนุมัติและส่งต่อ</button>
|
||||
<button class="btn btn-info" onclick="javascript:eva_adjust_postponement_update_status_SetEditForm(getUrlParameter('id'), true);">อนุมัติและส่งต่อ ปรับเลื่อนค่าตอบแทน</button>
|
||||
|
||||
<span id="statusapprove"></span>
|
||||
|
||||
|
||||
@@ -226,11 +226,17 @@
|
||||
<div class="title"><div class="line"></div>รายชื่อบุคลลากร</div>
|
||||
|
||||
<div class="tools">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>สถานะ ปรับเลื่อนค่าตอบแทน</p>
|
||||
<span id="previousstatus"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<button style="display:none;" class="btn btn-info" type="button" onclick="javascript:CalculateRemainQuota(true)">คำนวณค่าครองชีพใหม่ ตามเกณฑ์เงินเดือน 13,285</button>
|
||||
<button type="button" class="btn btn-submit" onclick="javascript:rep_eva_savemessage_DoSearch('pdf')">พิมพ์ บันทึกข้อความ</button>
|
||||
<button class="btn btn-info thesubmit" onclick="javascript:eva_adjust_quota_update_status_GoEdit(getUrlParameter('id'), true);">อนุมัติและส่ง</button>
|
||||
<button class="btn btn-info thesubmit" onclick="javascript:eva_adjust_quota_update_status_GoEdit(getUrlParameter('id'), true);">อนุมัติและส่ง วงเงินที่กันไว้</button>
|
||||
<span id="statusapprove" class="thesubmit"></span>
|
||||
<button class="btn btn-info thesubmit2" onclick="javascript:eva_adjust_quota_update_final_status_GoEdit(getUrlParameter('id'), true);">อนุมัติและแสดงแก่พนักงาน</button>
|
||||
<span id="statusfinalapprove" class="thesubmit2"></span>
|
||||
@@ -293,6 +299,11 @@
|
||||
} else {
|
||||
eva_adjust_postponement_quota_SetCreateForm();
|
||||
}
|
||||
|
||||
$("#eva_adjust_quota_update_status_quota_status_submit_to").select2({
|
||||
dropdownParent: $('#eva_adjust_quota_update_statusModel')
|
||||
});
|
||||
|
||||
SetupValidationRemark("eva_adjust_postponement_quota");
|
||||
SetupValidationRemark("eva_adjust_postponement_detail_quota");
|
||||
SetupValidationRemark("eva_adjust_quota_update_status");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"connectionStrings": {
|
||||
"mainDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2_eva2;User ID=postgres;Password=ZdPr0jects;",
|
||||
"externalDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2_eva2;User ID=postgres;Password=ZdPr0jects;"
|
||||
"mainDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;",
|
||||
"externalDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;"
|
||||
//"mainDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;",
|
||||
//"externalDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;"
|
||||
},
|
||||
|
||||
@@ -163,7 +163,7 @@ function eva_adjust_postponement_detail_normal_02_Get(a, blankItem) {
|
||||
tag += '<td><p id="eva_adjust_postponement_detail_normal_02_reward_old_' + (i + 1) + '" /></td>';
|
||||
|
||||
tag += '<td><p id="eva_adjust_postponement_detail_normal_02_middle_' + (i + 1) + '" /></td>';
|
||||
tag += '<td><input class="form-control" onchange="Oneva_adjust_postponement_detail_normal_02_promoted_percentageChanged(true)" type="number" id="eva_adjust_postponement_detail_normal_02_promoted_percentage_' + (i + 1) + '" /></td>';
|
||||
tag += '<td><input class="form-control edittext" onchange="Oneva_adjust_postponement_detail_normal_02_promoted_percentageChanged(true)" type="number" id="eva_adjust_postponement_detail_normal_02_promoted_percentage_' + (i + 1) + '" /></td>';
|
||||
tag += '<td><input disabled class="form-control" id="eva_adjust_postponement_detail_normal_02_total_promote_' + (i + 1) + '" /></td>';
|
||||
|
||||
tag += '<td><p id="eva_adjust_postponement_detail_normal_02_new_sarary_' + (i + 1) + '" /></td>';
|
||||
@@ -225,6 +225,7 @@ function eva_adjust_postponement_detail_normal_02_Get(a, blankItem) {
|
||||
});
|
||||
//eva_adjust_postponement_detail_normal_02_Summary();
|
||||
Oneva_adjust_postponement_detail_normal_02_promoted_percentageChanged(true);
|
||||
checkEnableForm();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
|
||||
@@ -23,6 +23,15 @@ function eva_adjust_postponement_quota_FeedDataToForm(data) {
|
||||
|
||||
//console.log(data);
|
||||
|
||||
var previousstatus = "";
|
||||
|
||||
$.each(data.approve_status, function (index, value) {
|
||||
//console.log(index + ": " + value);
|
||||
previousstatus += "<li>" + value + "</li>"
|
||||
});
|
||||
|
||||
$("#previousstatus").html("<ol>"+previousstatus+"</ol>");
|
||||
|
||||
quota_status_submit_to = data.quota_status_submit_to;
|
||||
managed_by = data.managed_by;
|
||||
|
||||
|
||||
@@ -17,9 +17,19 @@ function eva_adjust_postponement_update_status_FeedDataToSearchForm(data) {
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function checkEnableForm() {
|
||||
if ($("#eva_adjust_postponement_update_status_postponement_status").val() === "Y") {
|
||||
$(".edittext").attr("disabled", true);
|
||||
$("#savebtn").hide();
|
||||
} else {
|
||||
$(".edittext").attr("disabled", false);
|
||||
$("#savebtn").show();
|
||||
}
|
||||
}
|
||||
|
||||
function eva_adjust_postponement_update_status_FeedDataToForm(data) {
|
||||
$("#eva_adjust_postponement_update_status_id").val(data.id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_update_status_postponement_status"), data, "id", "external_name", "item_postponement_status", data.postponement_status);
|
||||
DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_update_status_postponement_status"), data, "external_code", "external_name", "item_postponement_status", data.postponement_status);
|
||||
$("#eva_adjust_postponement_update_status_postponement_status_date").val(formatDate(data.postponement_status_date));
|
||||
DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_update_status_postponement_status_by"), data, "id", "fullname", "item_postponement_status_by", data.postponement_status_by);
|
||||
$("#eva_adjust_postponement_update_status_postponement_status_note").val(data.postponement_status_note);
|
||||
@@ -31,6 +41,7 @@ function eva_adjust_postponement_update_status_FeedDataToForm(data) {
|
||||
|
||||
//console.log(data);
|
||||
|
||||
checkEnableForm();
|
||||
}
|
||||
|
||||
function eva_adjust_postponement_update_status_GetFromForm() {
|
||||
@@ -127,7 +138,8 @@ function eva_adjust_postponement_update_status_PutUpdate() {
|
||||
//eva_adjust_postponement_update_status_RefreshTable();
|
||||
|
||||
eva_adjust_postponement_update_status_SetEditForm(getUrlParameter('id'), false);
|
||||
|
||||
window.location.reload();
|
||||
console.log("window.location.reload()");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
|
||||
@@ -28,7 +28,8 @@ function eva_adjust_quota_update_final_status_FeedDataToForm(data) {
|
||||
var statusfinalText = $("#eva_adjust_quota_update_final_status_quota_final_status option:selected").text();
|
||||
if ($("#eva_adjust_quota_update_final_status_quota_final_status_by option:selected").text() !== "")
|
||||
statusfinalText += " โดย " + $("#eva_adjust_quota_update_final_status_quota_final_status_by option:selected").text();
|
||||
$("#statusfinalapprove").text(statusfinalText);
|
||||
|
||||
if (statusfinalText !== "กรุณาเลือก โดย กรุณาเลือก") $("#statusfinalapprove").text(statusfinalText);
|
||||
}
|
||||
|
||||
function eva_adjust_quota_update_final_status_GetFromForm() {
|
||||
@@ -122,11 +123,14 @@ function showHideForm() {
|
||||
//console.log("CON 2");
|
||||
}
|
||||
|
||||
$(".thesubmit").hide();
|
||||
//$(".thesubmit").hide();
|
||||
$(".thesubmit2").hide();
|
||||
|
||||
if (parseInt(getCookie("emp_id")) === quota_status_submit_to) $(".thesubmit2").show();
|
||||
if (parseInt(getCookie("emp_id")) === managed_by) $(".thesubmit").show();
|
||||
//if (parseInt(getCookie("emp_id")) === managed_by) $(".thesubmit").show();
|
||||
|
||||
//console.log(managed_by);
|
||||
//console.log(getCookie("emp_id"));
|
||||
|
||||
if ($("#eva_adjust_quota_update_status_quota_status").val() !== "Y")
|
||||
{
|
||||
|
||||
@@ -28,7 +28,8 @@ function eva_adjust_quota_update_status_FeedDataToForm(data) {
|
||||
var statusText = $("#eva_adjust_quota_update_status_quota_status option:selected").text();
|
||||
if ($("#eva_adjust_quota_update_status_quota_status_by option:selected").text() !== "")
|
||||
statusText += " โดย " + $("#eva_adjust_quota_update_status_quota_status_by option:selected").text();
|
||||
$("#statusapprove").text(statusText);
|
||||
|
||||
if (statusText != "กรุณาเลือก โดย กรุณาเลือก") $("#statusapprove").text(statusText);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user