ย้ายช่อง input และทำ sum รวมค่าจาก table วงเงินที่ใช้ในการเลื่อนเงินเดือนของแต่ละกอง/ส่วนงาน ทำวัน อังคาร ที่ 13/07/2564 เวลา 20.00 - 00.00 น.

This commit is contained in:
Pairat Sangprasert
2021-07-14 00:01:21 +07:00
parent 5f69d9c1df
commit c2de2c63fb
3 changed files with 93 additions and 42 deletions

View File

@@ -55,61 +55,30 @@
<input class="form-control" type="hidden" id="vw_limit_frame_plan_id" />
<div class='row'>
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<label id="lab_vw_limit_frame_plan_plan_guid" for="vw_limit_frame_plan_plan_guid">แผนการประเมิน</label>
<select disabled class="form-control" id="vw_limit_frame_plan_plan_guid" iLabel="แผนการประเมิน" iRequire="false" iGroup="vw_limit_frame_plan"></select>
</div>
<div class="form-group col-md-4">
<label id="lab_vw_limit_frame_plan_executed_date" for="vw_limit_frame_plan_executed_date">วันที่ตั้งกรอบวงเงิน</label>
<input class="form-control" type="text" id="vw_limit_frame_plan_executed_date" data-provide="datepicker" data-date-language="th-th" iLabel="วันที่ตั้งกรอบวงเงิน" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
<div class="form-group col-md-4">
<div class="form-group col-md-6">
<label id="lab_vw_limit_frame_plan_salary_adjustment_date" for="vw_limit_frame_plan_salary_adjustment_date">เลื่อนเงินเดือนวันที่</label>
<input class="form-control" type="text" id="vw_limit_frame_plan_salary_adjustment_date" data-provide="datepicker" data-date-language="th-th" iLabel="เลื่อนเงินเดือนวันที่" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-4">
<div class='row d-none'>
<div class="form-group col-md-12">
<label id="lab_vw_limit_frame_plan_total_salary" for="vw_limit_frame_plan_total_salary">รวมอัตราเงินเดือน</label>
<input disabled class="form-control" type="text" id="vw_limit_frame_plan_total_salary" iLabel="รวมอัตราเงินเดือน" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
<div class="form-group col-md-4">
<label id="lab_vw_limit_frame_plan_limit_frame_005" for="vw_limit_frame_plan_limit_frame_005">กรอบวงเงินที่กันไว้</label>
<input class="form-control" type="number" id="vw_limit_frame_plan_limit_frame_005" iLabel="กรอบวงเงินที่กันไว้" iRequire="false" iGroup="vw_limit_frame_plan"
onchange="changeDigitsLimitFrame(), funcCalculateCeilTotalRoundedLimitFramePlan(event)" />
<input disabled class="form-control" type="hidden" id="vw_limit_frame_plan_total_salary" iLabel="รวมอัตราเงินเดือน" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-4">
<label id="lab_vw_limit_frame_plan_limit_frame_005_total" for="vw_limit_frame_plan_limit_frame_005_total">กันวงเงินไว้</label>
<input disabled class="form-control" type="text" id="vw_limit_frame_plan_limit_frame_005_total" iLabel="กันวงเงินไว้" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
<div class="form-group col-md-4">
<label id="lab_vw_limit_frame_plan_limit_frame_005_total_rounded" for="vw_limit_frame_plan_limit_frame_005_total_rounded">กันวงเงินใช้จริง</label>
<input disabled class="form-control" type="text" id="vw_limit_frame_plan_limit_frame_005_total_rounded" iLabel="กันวงเงินใช้จริง" iRequire="false" iGroup="vw_limit_frame_plan" />
</div>
</div>
</div>
</div>
</div>
</section>
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-outline" onclick="javascript:window_close()" style="background-color: #fff;">ยกเลิก</button>
<button type="button" class="btn btn-submit" onclick="javascript:vw_limit_frame_plan_PutUpdate()">บันทึก</button>
<button class="btn btn-info" onclick="javascript:rep_eva_limit_frame_plan_DoSearch('pdf');">พิมพ์วงเงินที่ใช้ในการเลื่อนเงินเดือนของพนักงาน</button>
</div>
</div>
</section>
<br/>
@@ -120,18 +89,63 @@
<table id="eva_limit_frame_groupTable" class="display table table-bordered table-striped">
<thead>
<tr>
<!--<th>เลือก</th>-->
<th>เครื่องมือ</th>
<th><label id='h_eva_limit_frame_group_num_row'>ลำดับที่</label></th>
<th><label id='h_eva_limit_frame_group_group_guid'>กลุ่มการประเมิน</label></th>
<th><label id='h_eva_limit_frame_group_limit_frame_295'>วงเงินบริหาร</label></th>
<th><label id='h_eva_limit_frame_group_total_salary'>อัตราเงินเดือนรวม</label></th>
<th><label id='h_eva_limit_frame_group_limit_frame_295'>วงเงินบริหาร</label></th>
<th><label id='h_eva_limit_frame_group_total_salary_limit'>วงเงินในการเลื่อนเงินเดือน</label></th>
<th><label id='h_eva_limit_frame_group_total_salary_limit_rounded'>วงเงินในการเลื่อนเงินเดือน ที่ใช้จริง</label></th>
<th><label id='h_eva_limit_frame_group_emp_qty'>จำนวนพนักงาน</label></th>
<th width="40%"><label id='h_eva_limit_frame_group_remark'>หมายเหตุ</label></th>
</tr>
</thead>
<tbody></tbody>
<tfoot>
<tr>
<td colspan="3">
<label id="lab_vw_limit_frame_plan_executed_date" for="vw_limit_frame_plan_executed_date">รวมอัตราเงินเดือน ณ วันที่</label>
<input class="form-control" type="text" id="vw_limit_frame_plan_executed_date" data-provide="datepicker" data-date-language="th-th" iLabel="รวมอัตราเงินเดือน ณ วันที่" iRequire="false" iGroup="vw_limit_frame_plan" />
</td>
<td id="sum_total_salary"></td>
<td></td>
<td id="sum_total_salary_limit"></td>
<td id="sum_total_salary_limit_rounded"></td>
<td id="sum_emp_qty"></td>
<td></td>
</tr>
<tr>
<td colspan="3">
<label id="lab_vw_limit_frame_plan_limit_frame_005" for="vw_limit_frame_plan_limit_frame_005">กรอบวงเงินที่กันไว้</label>
<input class="form-control" type="number" id="vw_limit_frame_plan_limit_frame_005" iLabel="กรอบวงเงินที่กันไว้" iRequire="false" iGroup="vw_limit_frame_plan"
onchange="changeDigitsLimitFrame(), funcCalculateCeilTotalRoundedLimitFramePlan(event), changeForRealLimitFrame()" />
</td>
<td>
<label id="lab_vw_limit_frame_plan_limit_frame_005_total" for="vw_limit_frame_plan_limit_frame_005_total">กันวงเงินไว้</label>
<input disabled class="form-control" type="text" id="vw_limit_frame_plan_limit_frame_005_total" iLabel="กันวงเงินไว้" iRequire="false" iGroup="vw_limit_frame_plan" />
</td>
<td colspan="5"></td>
</tr>
<tr>
<td colspan="3" id="text_real_limit_frame">
</td>
<td>
<label id="lab_vw_limit_frame_plan_limit_frame_005_total_rounded" for="vw_limit_frame_plan_limit_frame_005_total_rounded">กันวงเงินใช้จริง</label>
<input disabled class="form-control" type="text" id="vw_limit_frame_plan_limit_frame_005_total_rounded" iLabel="กันวงเงินใช้จริง" iRequire="false" iGroup="vw_limit_frame_plan" />
</td>
<td colspan="5"></td>
</tr>
</tfoot>
</table>
<div class="row mt-2">
<div class="form-group col-md-12">
<button type="button" class="btn btn-outline" onclick="javascript:window_close()" style="background-color: #fff;">ยกเลิก</button>
<button type="button" class="btn btn-submit" onclick="javascript:vw_limit_frame_plan_PutUpdate()">บันทึก</button>
<button class="btn btn-info" onclick="javascript:rep_eva_limit_frame_plan_DoSearch('pdf');">พิมพ์วงเงินที่ใช้ในการเลื่อนเงินเดือนของพนักงาน</button>
</div>
</div>
</section>
@section FooterPlaceHolder{

View File

@@ -158,11 +158,19 @@ function eva_limit_frame_group_GoDelete(a) {
var eva_limit_frame_groupTableV;
var eva_limit_frame_group_setupTable = function (result) {
let num_row = 1;
let sum_total_salary = 0;
let sum_total_salary_limit = 0;
let sum_total_salary_limit_rounded = 0;
let sum_emp_qty = 0;
$.each(result, function (index_result, obj_result) {
/*console.log("index_result", index_result);
console.log("obj_result", obj_result);*/
sum_total_salary += Number(obj_result.total_salary);
sum_total_salary_limit += Number(obj_result.total_salary_limit);
sum_total_salary_limit_rounded += Number(obj_result.total_salary_limit_rounded);
var currency_total_salary = coreFormatPrice(obj_result.total_salary, limit_frame_group_digits);
var currency_total_salary_limit = coreFormatPrice(obj_result.total_salary_limit, limit_frame_group_digits);
var currency_total_salary_limit_rounded = coreFormatPrice(obj_result.total_salary_limit_rounded, limit_frame_group_digits);
@@ -170,9 +178,22 @@ var eva_limit_frame_group_setupTable = function (result) {
obj_result.total_salary = currency_total_salary;
obj_result.total_salary_limit = currency_total_salary_limit;
obj_result.total_salary_limit_rounded = currency_total_salary_limit_rounded;
obj_result.num_row = num_row;
obj_result.emp_qty = 0;
sum_emp_qty += obj_result.emp_qty;
num_row++;
});
/*console.log("sum_total_salary", sum_total_salary);
console.log("sum_total_salary_limit", sum_total_salary_limit);
console.log("sum_total_salary_limit_rounded", sum_total_salary_limit_rounded);
console.log("sum_emp_qty", sum_emp_qty);*/
$("#sum_total_salary").text(coreFormatPrice(sum_total_salary, limit_frame_group_digits));
$("#sum_total_salary_limit").text(coreFormatPrice(sum_total_salary_limit, limit_frame_group_digits));
$("#sum_total_salary_limit_rounded").text(coreFormatPrice(sum_total_salary_limit_rounded, limit_frame_group_digits));
$("#sum_emp_qty").text(sum_emp_qty);
tmp = '"';
eva_limit_frame_groupTableV = $('#eva_limit_frame_groupTable').DataTable({
"processing": true,
@@ -182,13 +203,14 @@ var eva_limit_frame_group_setupTable = function (result) {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "num_row" },
{ "data": "group_guid_eva_evaluation_group_code" },
{ "data": "limit_frame_295" },
{ "data": "total_salary" },
{ "data": "limit_frame_295" },
{ "data": "total_salary_limit" },
{ "data": "total_salary_limit_rounded" },
{ "data": "emp_qty" },
{ "data": "remark_formatted" },
],
"columnDefs": [

View File

@@ -14,6 +14,8 @@ function vw_limit_frame_plan_FeedDataToForm(data) {
$("#vw_limit_frame_plan_limit_frame_005_total").val(coreFormatPrice(data.limit_frame_005_total, limit_frame_digits));
$("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(coreFormatPrice(data.limit_frame_005_total_rounded, limit_frame_digits));
// สำหรับ แสดง กันวงเงินร้อยละ ใช้จริง
changeForRealLimitFrame();
}
function vw_limit_frame_plan_GetFromForm() {
@@ -138,4 +140,17 @@ function funcCalculateCeilTotalRoundedLimitFramePlan(params) {
}
var set_salary_limit_rounded = cal_ceil + after_cal;
$("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(coreFormatPrice(set_salary_limit_rounded, limit_frame_digits));
}
function changeForRealLimitFrame() {
let val_input_limit_frame = $("#vw_limit_frame_plan_limit_frame_005").val();
let real_limit_frame = 0;
if (val_input_limit_frame) {
real_limit_frame = Number(val_input_limit_frame);
}
real_limit_frame = real_limit_frame.toFixed(2);
/*console.log(real_limit_frame);*/
$("#text_real_limit_frame").text("กันวงเงินร้อยละ " + real_limit_frame + " ใช้จริง");
return real_limit_frame;
}