เพิ่มคอลัม เงินประจำตำแหน่ง และค่าตอบแทน รายเดือน

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-07-08 15:15:40 +07:00
parent 3a00d8c0f4
commit d17f470c8c
11 changed files with 1209 additions and 56 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace tb320eva.Migrations
{
public partial class Updatesalary_cylinder : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "monthly_compensation",
table: "eva_salary_cylinder",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "position_allowance",
table: "eva_salary_cylinder",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "monthly_compensation",
table: "eva_salary_cylinder");
migrationBuilder.DropColumn(
name: "position_allowance",
table: "eva_salary_cylinder");
}
}
}

View File

@@ -929,6 +929,10 @@ namespace tb320eva.Migrations
b.Property<decimal?>("middle");
b.Property<decimal?>("monthly_compensation");
b.Property<decimal?>("position_allowance");
b.Property<int?>("position_level");
b.Property<int?>("position_type");

View File

@@ -30,6 +30,8 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
}
}

View File

@@ -30,6 +30,10 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
public string active_mode { get; set; }
}
}

View File

@@ -20,14 +20,14 @@ namespace TodoAPI2.Models
public class eva_salary_cylinderService : Ieva_salary_cylinderService
{
private IBaseRepository2<eva_salary_cylinderEntity, int> _repository;
private IMyDatabase db;
private Iexternal_linkageService ext;
private IMyDatabase db;
private Iexternal_linkageService ext;
public eva_salary_cylinderService(IBaseRepository2<eva_salary_cylinderEntity, int> repository, IMyDatabase mydb, Iexternal_linkageService inext)
{
_repository = repository;
db = mydb;
ext = inext;
db = mydb;
ext = inext;
}
#region Private Functions
@@ -47,7 +47,7 @@ namespace TodoAPI2.Models
{
return Mapper.Map<List<eva_salary_cylinderViewModel>>(entities);
}
#endregion
#region Public Functions
@@ -93,7 +93,7 @@ namespace TodoAPI2.Models
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
where m_eva_salary_cylinder.position_type == position_type || !position_type.HasValue
where m_eva_salary_cylinder.position_type == position_type || !position_type.HasValue
orderby m_eva_salary_cylinder.created descending
select new eva_salary_cylinderViewModel()
@@ -105,7 +105,9 @@ namespace TodoAPI2.Models
themin = m_eva_salary_cylinder.themin,
themax = m_eva_salary_cylinder.themax,
middle = m_eva_salary_cylinder.middle,
cost_living = m_eva_salary_cylinder.cost_living ,
cost_living = m_eva_salary_cylinder.cost_living,
position_allowance = m_eva_salary_cylinder.position_allowance,
monthly_compensation = m_eva_salary_cylinder.monthly_compensation,
position_type_external_linkage_external_name = fk_external_linkageResult1.external_name,
position_level_external_linkage_external_name = fk_external_linkageResult2.external_name,
@@ -119,7 +121,7 @@ namespace TodoAPI2.Models
return data;
}
public List<eva_salary_cylinderViewModel> GetListBySearch(eva_salary_cylinderSearchModel model)
public List<eva_salary_cylinderViewModel> GetListBySearch(eva_salary_cylinderSearchModel model)
{
var data = (
from m_eva_salary_cylinder in _repository.Context.eva_salary_cylinder
@@ -133,7 +135,7 @@ namespace TodoAPI2.Models
from fk_external_linkageResult2 in external_linkageResult2.DefaultIfEmpty()
where 1==1
where 1 == 1
&& (m_eva_salary_cylinder.position_type == model.position_type || !model.position_type.HasValue)
@@ -147,7 +149,9 @@ namespace TodoAPI2.Models
themin = m_eva_salary_cylinder.themin,
themax = m_eva_salary_cylinder.themax,
middle = m_eva_salary_cylinder.middle,
cost_living = m_eva_salary_cylinder.cost_living ,
cost_living = m_eva_salary_cylinder.cost_living,
position_allowance = m_eva_salary_cylinder.position_allowance,
monthly_compensation = m_eva_salary_cylinder.monthly_compensation,
position_type_external_linkage_external_name = fk_external_linkageResult1.external_name,
position_level_external_linkage_external_name = fk_external_linkageResult2.external_name,
@@ -170,10 +174,10 @@ namespace TodoAPI2.Models
int? newkey = 0;
var x = (from i in _repository.Context.eva_salary_cylinder
orderby i.id descending
select i).Take(1).ToList();
orderby i.id descending
select i).Take(1).ToList();
if(x.Count > 0)
if (x.Count > 0)
{
newkey = x[0].id + 1;
}
@@ -189,7 +193,7 @@ namespace TodoAPI2.Models
var inserted = _repository.Insert(entity);
return Get(inserted.id);
}
@@ -204,33 +208,35 @@ namespace TodoAPI2.Models
existingEntity.themin = model.themin;
existingEntity.themax = model.themax;
existingEntity.middle = model.middle;
existingEntity.cost_living = model.cost_living ;
existingEntity.cost_living = model.cost_living;
existingEntity.position_allowance = model.position_allowance;
existingEntity.monthly_compensation = model.monthly_compensation;
var updated = _repository.Update(id, existingEntity);
return Get(updated.id);
}
else
throw new NotificationException("No data to update");
throw new NotificationException("No data to update");
}
public string UpdateMultiple(List<eva_salary_cylinderInputModel> model)
public string UpdateMultiple(List<eva_salary_cylinderInputModel> model)
{
foreach(var i in model)
foreach (var i in model)
{
if (i.active_mode == "1" && i.id.HasValue) // update
{
{
var existingEntity = _repository.Get(i.id.Value);
if (existingEntity != null)
{
existingEntity.position_type = i.position_type;
existingEntity.position_level = i.position_level;
existingEntity.temporary_min = i.temporary_min;
existingEntity.themin = i.themin;
existingEntity.themax = i.themax;
existingEntity.middle = i.middle;
existingEntity.cost_living = i.cost_living ;
existingEntity.position_type = i.position_type;
existingEntity.position_level = i.position_level;
existingEntity.temporary_min = i.temporary_min;
existingEntity.themin = i.themin;
existingEntity.themax = i.themax;
existingEntity.middle = i.middle;
existingEntity.cost_living = i.cost_living;
existingEntity.position_allowance = i.position_allowance;
existingEntity.monthly_compensation = i.monthly_compensation;
_repository.UpdateWithoutCommit(i.id.Value, existingEntity);
}
@@ -242,15 +248,15 @@ namespace TodoAPI2.Models
_repository.InsertWithoutCommit(entity);
}
else if (i.active_mode == "0" && i.id.HasValue) // remove
{
{
_repository.DeleteWithoutCommit(i.id.Value);
}
else if (i.active_mode == "0" && !i.id.HasValue)
{
// nothing to do
}
}
}
_repository.Context.SaveChanges();
_repository.Context.SaveChanges();
return model.Count().ToString();
}

View File

@@ -28,6 +28,10 @@ namespace TodoAPI2.Models
public decimal? cost_living { get; set; }
public decimal? position_allowance { get; set; }
public decimal? monthly_compensation { get; set; }
public string position_type_external_linkage_external_name { get; set; }
public string position_level_external_linkage_external_name { get; set; }

View File

@@ -32,33 +32,41 @@
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_salary_cylinder_temporary_min" for="eva_salary_cylinder_temporary_min">ขั้นต่ำชั่วคราว</label>
<input placeholder="0.00" class="form-control money mask_plugin" type="text" id="eva_salary_cylinder_temporary_min" iLabel="ขั้นต่ำชั่วคราว" iRequire="true" iGroup="eva_salary_cylinder" />
<input class="form-control" type="number" id="eva_salary_cylinder_temporary_min" iLabel="ขั้นต่ำชั่วคราว" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
<div class="form-group col-md-6">
<label id="lab_eva_salary_cylinder_themin" for="eva_salary_cylinder_themin">ขั้นต่ำ</label>
<input placeholder="0.00" class="form-control money mask_plugin" type="text" id="eva_salary_cylinder_themin" iLabel="ขั้นต่ำ" iRequire="true" iGroup="eva_salary_cylinder" />
<input class="form-control" type="number" id="eva_salary_cylinder_themin" iLabel="ขั้นต่ำ" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-6">
<label id="lab_eva_salary_cylinder_themax" for="eva_salary_cylinder_themax">ขั้นสูง</label>
<input placeholder="0.00" class="form-control money mask_plugin" type="text" id="eva_salary_cylinder_themax" iLabel="ขั้นสูง" iRequire="true" iGroup="eva_salary_cylinder" />
<input class="form-control" type="number" id="eva_salary_cylinder_themax" iLabel="ขั้นสูง" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
<div class="form-group col-md-6">
<label id="lab_eva_salary_cylinder_middle" for="eva_salary_cylinder_middle">ค่ากลาง</label>
<input placeholder="0.00" class="form-control money mask_plugin" type="text" id="eva_salary_cylinder_middle" iLabel="ค่ากลาง" iRequire="true" iGroup="eva_salary_cylinder" />
<input class="form-control" type="number" id="eva_salary_cylinder_middle" iLabel="ค่ากลาง" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
</div>
<div class='row'>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label id="lab_eva_salary_cylinder_cost_living " for="eva_salary_cylinder_cost_living ">ค่าครองชีพ</label>
<input placeholder="0.00" class="form-control money mask_plugin" type="text" id="eva_salary_cylinder_cost_living " iLabel="ค่าครองชีพ" iRequire="true" iGroup="eva_salary_cylinder" />
<input class="form-control" type="number" id="eva_salary_cylinder_cost_living" iLabel="ค่าครองชีพ" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_salary_cylinder_position_allowance" for="eva_salary_cylinder_position_allowance">เงินประจำตำแหน่ง</label>
<input class="form-control" type="number" id="eva_salary_cylinder_position_allowance" iLabel="เงินประจำตำแหน่ง" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
<div class="form-group col-md-4">
<label id="lab_eva_salary_cylinder_monthly_compensation" for="eva_salary_cylinder_monthly_compensation">ค่าตอบแทนรายเดือน</label>
<input class="form-control" type="number" id="eva_salary_cylinder_monthly_compensation" iLabel="ค่าตอบแทนรายเดือน" iRequire="true" iGroup="eva_salary_cylinder" />
</div>
</div>
</div>
</div>
</div>
@@ -114,7 +122,8 @@
<th><label id='h_eva_salary_cylinder_themax'>ขั้นสูง</label></th>
<th><label id='h_eva_salary_cylinder_middle'>ค่ากลาง</label></th>
<th><label id='h_eva_salary_cylinder_cost_living '>ค่าครองชีพ</label></th>
<th><label id='h_eva_salary_cylinder_position_allowance'>เงินประจำตำแหน่ง</label></th>
<th><label id='h_eva_salary_cylinder_monthly_compensation'>ค่าตอบแทนรายเดือน</label></th>
</tr>
</thead>
<tbody></tbody>

View File

@@ -39,6 +39,8 @@ function eva_adjust_postponement_normal_FeedDataToForm(data) {
DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_normal_managed_by"), data, "id", "fullname", "item_managed_by", getCookie("emp_id"));
//DropDownClearFormAndFeedWithData($("#eva_adjust_postponement_normal_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
$("#eva_salary_cylinder_position_allowance").val(data.position_allowance);
$("#eva_salary_cylinder_monthly_compensation").val(data.monthly_compensation);
}
function eva_adjust_postponement_normal_GetFromForm() {
@@ -55,6 +57,8 @@ function eva_adjust_postponement_normal_GetFromForm() {
eva_adjust_postponement_normalObject.managed_by = $("#eva_adjust_postponement_normal_managed_by").val();
//eva_adjust_postponement_normalObject.org_id = $("#eva_adjust_postponement_normal_org_id").val();
eva_salary_cylinderObject.position_allowance = $("#eva_salary_cylinder_position_allowance").val();
eva_salary_cylinderObject.monthly_compensation = $("#eva_salary_cylinder_monthly_compensation").val();
return eva_adjust_postponement_normalObject;
}

View File

@@ -21,17 +21,13 @@ function eva_salary_cylinder_FeedDataToForm(data) {
$("#eva_salary_cylinder_id").val(data.id);
DropDownClearFormAndFeedWithData($("#eva_salary_cylinder_position_type"), data, "id", "external_name", "item_position_type", data.position_type);
DropDownClearFormAndFeedWithData($("#eva_salary_cylinder_position_level"), data, "id", "external_name", "item_position_level", data.position_level);
// $("#eva_salary_cylinder_temporary_min").val(data.temporary_min);
// $("#eva_salary_cylinder_themin").val(data.themin);
// $("#eva_salary_cylinder_themax").val(data.themax);
// $("#eva_salary_cylinder_middle").val(data.middle);
// $("#eva_salary_cylinder_cost_living").val(data.cost_living);
$("#eva_salary_cylinder_temporary_min").maskMoney('mask',data.temporary_min);
$("#eva_salary_cylinder_themin").maskMoney('mask',data.themin);
$("#eva_salary_cylinder_themax").maskMoney('mask',data.themax);
$("#eva_salary_cylinder_middle").maskMoney('mask',data.middle);
$("#eva_salary_cylinder_cost_living").maskMoney('mask',data.cost_living);
$("#eva_salary_cylinder_temporary_min").val(data.temporary_min);
$("#eva_salary_cylinder_themin").val(data.themin);
$("#eva_salary_cylinder_themax").val(data.themax);
$("#eva_salary_cylinder_middle").val(data.middle);
$("#eva_salary_cylinder_cost_living").val(data.cost_living);
$("#eva_salary_cylinder_position_allowance").val(data.position_allowance);
$("#eva_salary_cylinder_monthly_compensation").val(data.monthly_compensation);
}
function eva_salary_cylinder_GetFromForm() {
@@ -39,12 +35,13 @@ function eva_salary_cylinder_GetFromForm() {
eva_salary_cylinderObject.id = $("#eva_salary_cylinder_id").val();
eva_salary_cylinderObject.position_type = $("#eva_salary_cylinder_position_type").val();
eva_salary_cylinderObject.position_level = $("#eva_salary_cylinder_position_level").val();
eva_salary_cylinderObject.temporary_min = $("#eva_salary_cylinder_temporary_min").val().replace(/[,-]/g,'');
eva_salary_cylinderObject.themin = $("#eva_salary_cylinder_themin").val().replace(/[,-]/g,'');
eva_salary_cylinderObject.themax = $("#eva_salary_cylinder_themax").val().replace(/[,-]/g,'');
eva_salary_cylinderObject.middle = $("#eva_salary_cylinder_middle").val().replace(/[,-]/g,'');
eva_salary_cylinderObject.cost_living = $("#eva_salary_cylinder_cost_living").val().replace(/[,-]/g,'');
eva_salary_cylinderObject.temporary_min = $("#eva_salary_cylinder_temporary_min").val();
eva_salary_cylinderObject.themin = $("#eva_salary_cylinder_themin").val();
eva_salary_cylinderObject.themax = $("#eva_salary_cylinder_themax").val();
eva_salary_cylinderObject.middle = $("#eva_salary_cylinder_middle").val();
eva_salary_cylinderObject.cost_living = $("#eva_salary_cylinder_cost_living").val();
eva_salary_cylinderObject.position_allowance = $("#eva_salary_cylinder_position_allowance").val();
eva_salary_cylinderObject.monthly_compensation = $("#eva_salary_cylinder_monthly_compensation").val();
return eva_salary_cylinderObject;
}
@@ -117,6 +114,7 @@ function eva_salary_cylinder_PutUpdate() {
}
var data = eva_salary_cylinder_GetFromForm();
console.log(data);
//Update Mode
if (eva_salary_cylinder_editMode === "UPDATE") {
@@ -176,6 +174,8 @@ var eva_salary_cylinder_setupTable = function (result) {
{ "data": "themax" },
{ "data": "middle" },
{ "data": "cost_living" },
{ "data": "position_allowance" },
{ "data": "monthly_compensation" },
],
"columnDefs": [
{
@@ -219,6 +219,20 @@ var eva_salary_cylinder_setupTable = function (result) {
"render": function (data, type, row, meta) {
return formatNumber(data);
}
},
{
"targets": 8,
"data": "position_allowance",
"render": function (data, type, row, meta) {
return formatNumber(data);
}
},
{
"targets": 9,
"data": "monthly_compensation",
"render": function (data, type, row, meta) {
return formatNumber(data);
}
}],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"