diff --git a/ApiControllers/vw_limit_frame_planControllers.cs b/ApiControllers/vw_limit_frame_planControllers.cs new file mode 100644 index 0000000..f140904 --- /dev/null +++ b/ApiControllers/vw_limit_frame_planControllers.cs @@ -0,0 +1,403 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Logging; +using TTSW.Controllers; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.Data; +using Microsoft.Extensions.Configuration; +using System.IO; +using System.Net; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/vw_limit_frame_plan")] + public class vw_limit_frame_planController : BaseController + { + #region Private Variables + private ILogger _logger; + private Ivw_limit_frame_planService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public vw_limit_frame_planController(ILogger logger, Ivw_limit_frame_planService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get specific item by id + /// + /// + /// + /// Return Get specific item by id + /// Returns the item + /// Error Occurred + [HttpGet("{id}")] + [ProducesResponseType(typeof(vw_limit_frame_planWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Get(Guid id) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetWithSelection(id); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult Get.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(vw_limit_frame_planWithSelectionViewModel), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetBlankItem() + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.GetBlankItem(); + + return Ok(result); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetBlankItem.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by executed_date + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetList(DateTime? executed_date) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListByexecuted_date(executed_date)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetList.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Get list items by search + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("GetListBySearch")] + [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult GetListBySearch(vw_limit_frame_planSearchModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + return Ok(_repository.GetListBySearch(model)); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception in IActionResult GetListBySearch.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("vw_limit_frame_plan_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult vw_limit_frame_plan_report(vw_limit_frame_planReportRequestModel model) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var httpclient = new WebClient(); + string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL"); + string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite"); + string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username"); + string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password"); + + string url = $"{mainurl}{reportsite}/xxใส่ชื่อรายงานตรงนี้xx.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + + if (model.filetype == "xlsx") + { + url += "&ignorePagination=true"; + } + + var data = httpclient.DownloadData(url); + var stream = new MemoryStream(data); + + return File(stream, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + /// + /// Create new item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPost("")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Insert([FromBody] vw_limit_frame_planInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Insert(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"เพิ่มข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while insert.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update item + /// + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Update(Guid id, [FromBody] vw_limit_frame_planInputModel model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + var result = _repository.Update(id, model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"แก้ไขข้อมูล เรียบร้อย"; + message.data = result; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while update {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Delete item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpDelete("{id}")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult Delete(Guid id) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.Delete(id); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ลบข้อมูล เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while delete {id.ToString()}.", ex); + return StatusCode(500, $"{id.ToString()}. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Update multiple item + /// + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("UpdateMultiple")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult UpdateMultiple([FromBody] List model) + { + if (ModelState.IsValid) + { + try + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + string rowCount = _repository.UpdateMultiple(model, true); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = "ปรับปรุงข้อมูลเรียบร้อย จำนวน "+rowCount+" รายการ"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while UpdateMultiple.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + /// + /// Refresh AutoField of all items + /// + /// + /// + /// Response Result Message + /// Response Result Message + /// If the model is invalid + /// Error Occurred + [HttpPut("RefreshAutoField")] + [ProducesResponseType(typeof(CommonResponseMessage), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult RefreshAutoField() + { + if (ModelState.IsValid) + { + try + { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); + _repository.RefreshAutoFieldOfAllData(); + var message = new CommonResponseMessage(); + message.code = "200"; + message.message = $"ปรับปรุง Auto Field ของทุก record เรียบร้อย"; + message.data = null; + return Ok(message); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while RefreshAutoField.", ex); + return StatusCode(500, $"มีปัญหาระหว่างการปรับปรุง Auto Field. {ex.Message}"); + } + } + + return BadRequest(ModelState); + } + + + + } +} diff --git a/EXCEL/eva_limit_frame_plan.xlsx b/EXCEL/eva_limit_frame_plan.xlsx index ecde55d..4183ac2 100644 Binary files a/EXCEL/eva_limit_frame_plan.xlsx and b/EXCEL/eva_limit_frame_plan.xlsx differ diff --git a/EXCEL/eva_limit_frame_plan@vw_limit_frame_plan.xlsx b/EXCEL/eva_limit_frame_plan@vw_limit_frame_plan.xlsx new file mode 100644 index 0000000..a139572 Binary files /dev/null and b/EXCEL/eva_limit_frame_plan@vw_limit_frame_plan.xlsx differ diff --git a/Migrations/25640304122731_AddTotalSalary.Designer.cs b/Migrations/25640304122731_AddTotalSalary.Designer.cs new file mode 100644 index 0000000..b4d5604 --- /dev/null +++ b/Migrations/25640304122731_AddTotalSalary.Designer.cs @@ -0,0 +1,922 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using TTSW.EF; + +namespace tb320eva.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("25640304122731_AddTotalSalary")] + partial class AddTotalSalary + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.Property("id"); + + b.Property("command_no") + .HasMaxLength(4000); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("imported_date"); + + b.Property("imported_file") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("limit"); + + b.Property("limit_frame"); + + b.Property("limit_frame_quota"); + + b.Property("limit_quota"); + + b.Property("managed_by"); + + b.Property("percentage"); + + b.Property("report_type") + .HasMaxLength(1000); + + b.Property("theDate"); + + b.Property("theRound"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_id"); + + b.ToTable("eva_adjust_postponement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.Property("id"); + + b.Property("adjust_postponement_id"); + + b.Property("adjust_postponement_quota_id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("level_this_time") + .HasMaxLength(1000); + + b.Property("middle"); + + b.Property("migration_eva_result") + .HasMaxLength(1000); + + b.Property("migration_total_score"); + + b.Property("new_cost_living"); + + b.Property("new_sarary"); + + b.Property("new_sarary_with_quota"); + + b.Property("order_at_this_time"); + + b.Property("org_at_this_time"); + + b.Property("other_money_at_this_time"); + + b.Property("position_allowance_at_this_time"); + + b.Property("position_this_time") + .HasMaxLength(1000); + + b.Property("promoted_percentage"); + + b.Property("receive_quota"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("sarary"); + + b.Property("total_promote"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("adjust_postponement_id"); + + b.HasIndex("adjust_postponement_quota_id"); + + b.ToTable("eva_adjust_postponement_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("performance_plan_id"); + + b.Property("score1"); + + b.Property("score2"); + + b.Property("supervisor1_id"); + + b.Property("supervisor2_id"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_create_evaluation"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluation_detailEntity", b => + { + b.Property("id"); + + b.Property("Final_summary_chief"); + + b.Property("Final_summary_competency_chief"); + + b.Property("Final_summary_competency_supervisor"); + + b.Property("Final_summary_competency_supervisor1A"); + + b.Property("Final_summary_competency_supervisor2A"); + + b.Property("Final_summary_supervisor"); + + b.Property("Final_summary_supervisor1A"); + + b.Property("Final_summary_supervisor2A"); + + b.Property("achievement_chief"); + + b.Property("achievement_supervisor"); + + b.Property("achievement_supervisor1A"); + + b.Property("achievement_supervisor2A"); + + b.Property("chief"); + + b.Property("chief_a"); + + b.Property("chief_a_date"); + + b.Property("chief_a_reject_reason") + .HasMaxLength(1000); + + b.Property("chief_a_remark") + .HasMaxLength(1000); + + b.Property("chief_a_result") + .HasMaxLength(1); + + b.Property("competency_chief"); + + b.Property("competency_supervisor"); + + b.Property("competency_supervisor1A"); + + b.Property("competency_supervisor2A"); + + b.Property("create_evaluation_id"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("isActive"); + + b.Property("level_score_chief") + .HasMaxLength(255); + + b.Property("level_score_supervisor") + .HasMaxLength(255); + + b.Property("level_score_supervisor1A") + .HasMaxLength(255); + + b.Property("level_score_supervisor2A") + .HasMaxLength(255); + + b.Property("score_chief"); + + b.Property("score_supervisor"); + + b.Property("score_supervisor1A"); + + b.Property("score_supervisor2A"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_chief_a") + .HasMaxLength(1); + + b.Property("status_chief_a_click_date"); + + b.Property("status_chief_click_date"); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("status_self_a") + .HasMaxLength(1); + + b.Property("status_self_a_click_date"); + + b.Property("status_self_click_date"); + + b.Property("status_supervisor") + .HasMaxLength(1); + + b.Property("status_supervisor1A") + .HasMaxLength(1); + + b.Property("status_supervisor1A_click_date"); + + b.Property("status_supervisor2A") + .HasMaxLength(1); + + b.Property("status_supervisor2A_click_date"); + + b.Property("status_supervisor_click_date"); + + b.Property("supervisor1"); + + b.Property("supervisor1A"); + + b.Property("supervisor1A_date"); + + b.Property("supervisor1A_remark") + .HasMaxLength(1000); + + b.Property("supervisor1A_result") + .HasMaxLength(1); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("supervisor2"); + + b.Property("supervisor2A"); + + b.Property("supervisor2A_date"); + + b.Property("supervisor2A_remark") + .HasMaxLength(1000); + + b.Property("supervisor2A_result") + .HasMaxLength(1); + + b.Property("supervisor2_date"); + + b.Property("supervisor2_remark") + .HasMaxLength(1000); + + b.Property("supervisor2_result") + .HasMaxLength(1); + + b.Property("total_summary_chief"); + + b.Property("total_summary_competency_chief"); + + b.Property("total_summary_competency_supervisor"); + + b.Property("total_summary_competency_supervisor1A"); + + b.Property("total_summary_competency_supervisor2A"); + + b.Property("total_summary_supervisor"); + + b.Property("total_summary_supervisor1A"); + + b.Property("total_summary_supervisor2A"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_create_evaluation_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.Property("id"); + + b.Property("achievement") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("thefile") + .HasMaxLength(1000); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_achievement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.Property("id"); + + b.Property("behavior") + .HasMaxLength(1000); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("score"); + + b.Property("score2"); + + b.Property("score3"); + + b.Property("score4"); + + b.Property("sumary"); + + b.Property("sumary2"); + + b.Property("sumary3"); + + b.Property("sumary4"); + + b.Property("target_score1") + .HasMaxLength(255); + + b.Property("target_score2") + .HasMaxLength(255); + + b.Property("target_score3") + .HasMaxLength(255); + + b.Property("target_score4") + .HasMaxLength(255); + + b.Property("target_score5") + .HasMaxLength(255); + + b.Property("updated"); + + b.Property("weight"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_behavior"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_groupEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("thegroup") + .HasMaxLength(255); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_evaluation_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("evaluation_group_id"); + + b.Property("isActive"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("evaluation_group_id"); + + b.ToTable("eva_evaluation_group_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("indicators") + .HasMaxLength(4000); + + b.Property("isActive"); + + b.Property("mission_detail") + .HasMaxLength(4000); + + b.Property("mission_no"); + + b.Property("target") + .HasMaxLength(4000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("create_evaluation_detail_id"); + + b.ToTable("eva_evaluation_operating_agreement"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_idp_planEntity", b => + { + b.Property("id"); + + b.Property("create_evaluation_detail_id"); + + b.Property("created"); + + b.Property("develop") + .HasMaxLength(1000); + + b.Property("development_method") + .HasMaxLength(1000); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("period_text") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_idp_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_level_scoreEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_level_score"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.Property("id"); + + b.Property("cost_of_living"); + + b.Property("created"); + + b.Property("employee_id"); + + b.Property("frame_group_guid"); + + b.Property("isActive"); + + b.Property("level_text") + .HasMaxLength(1000); + + b.Property("monthly_remuneration"); + + b.Property("order_of_data"); + + b.Property("org_id"); + + b.Property("position_allowance"); + + b.Property("position_text") + .HasMaxLength(1000); + + b.Property("salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_group_guid"); + + b.ToTable("eva_limit_frame_employee"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("frame_plan_guid"); + + b.Property("group_guid"); + + b.Property("isActive"); + + b.Property("limit_frame_295"); + + b.Property("remark") + .HasMaxLength(4000); + + b.Property("total_salary"); + + b.Property("total_salary_limit"); + + b.Property("total_salary_limit_rounded"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("frame_plan_guid"); + + b.HasIndex("group_guid"); + + b.ToTable("eva_limit_frame_group"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.Property("id"); + + b.Property("created"); + + b.Property("executed_date"); + + b.Property("isActive"); + + b.Property("limit_frame_005"); + + b.Property("limit_frame_005_total"); + + b.Property("limit_frame_005_total_rounded"); + + b.Property("plan_guid"); + + b.Property("salary_adjustment_date"); + + b.Property("status_chief") + .HasMaxLength(1); + + b.Property("status_self") + .HasMaxLength(1); + + b.Property("supervisor1"); + + b.Property("supervisor1_date"); + + b.Property("supervisor1_remark") + .HasMaxLength(1000); + + b.Property("supervisor1_result") + .HasMaxLength(1); + + b.Property("total_salary"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("plan_guid"); + + b.ToTable("eva_limit_frame_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_planEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("fiscal_year"); + + b.Property("isActive"); + + b.Property("theTime"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_performance_plan"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("created"); + + b.Property("end_date"); + + b.Property("isActive"); + + b.Property("list_no"); + + b.Property("performance_plan_id"); + + b.Property("remark") + .HasMaxLength(1000); + + b.Property("start_date"); + + b.Property("step") + .HasMaxLength(1000); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("performance_plan_id"); + + b.ToTable("eva_performance_plan_detail"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.Property("id") + .ValueGeneratedOnAdd(); + + b.Property("code") + .HasMaxLength(255); + + b.Property("created"); + + b.Property("detail") + .HasMaxLength(1000); + + b.Property("isActive"); + + b.Property("level_score_id"); + + b.Property("max_score"); + + b.Property("min_score"); + + b.Property("promoted_percentage"); + + b.Property("updated"); + + b.HasKey("id"); + + b.HasIndex("level_score_id"); + + b.ToTable("eva_promoted_percentage"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_salary_cylinderEntity", b => + { + b.Property("id"); + + b.Property("cost_living"); + + b.Property("created"); + + b.Property("isActive"); + + b.Property("middle"); + + b.Property("position_level"); + + b.Property("position_type"); + + b.Property("temporary_min"); + + b.Property("themax"); + + b.Property("themin"); + + b.Property("updated"); + + b.HasKey("id"); + + b.ToTable("eva_salary_cylinder"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluationEntity", "eva_create_evaluation") + .WithMany() + .HasForeignKey("create_evaluation_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_adjust_postponement_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement") + .WithMany() + .HasForeignKey("adjust_postponement_id"); + + b.HasOne("TodoAPI2.Models.eva_adjust_postponementEntity", "eva_adjust_postponement_quota") + .WithMany() + .HasForeignKey("adjust_postponement_quota_id") + .HasConstraintName("FK_eva_adjust_postponement_detail_eva_adjust_postponement_adj~1"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_create_evaluationEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_achievementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_behaviorEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_group_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group") + .WithMany() + .HasForeignKey("evaluation_group_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_evaluation_operating_agreementEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_create_evaluation_detailEntity", "eva_create_evaluation_detail_create_evaluation_detail_id") + .WithMany() + .HasForeignKey("create_evaluation_detail_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_employeeEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_groupEntity", "eva_limit_frame_group_frame_group_guid") + .WithMany() + .HasForeignKey("frame_group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_groupEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_limit_frame_planEntity", "eva_limit_frame_plan_frame_plan_guid") + .WithMany() + .HasForeignKey("frame_plan_guid"); + + b.HasOne("TodoAPI2.Models.eva_evaluation_groupEntity", "eva_evaluation_group_group_guid") + .WithMany() + .HasForeignKey("group_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_limit_frame_planEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan_plan_guid") + .WithMany() + .HasForeignKey("plan_guid"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_performance_plan_detailEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_performance_planEntity", "eva_performance_plan") + .WithMany() + .HasForeignKey("performance_plan_id"); + }); + + modelBuilder.Entity("TodoAPI2.Models.eva_promoted_percentageEntity", b => + { + b.HasOne("TodoAPI2.Models.eva_level_scoreEntity", "eva_level_score") + .WithMany() + .HasForeignKey("level_score_id"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/25640304122731_AddTotalSalary.cs b/Migrations/25640304122731_AddTotalSalary.cs new file mode 100644 index 0000000..e03ab6b --- /dev/null +++ b/Migrations/25640304122731_AddTotalSalary.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace tb320eva.Migrations +{ + public partial class AddTotalSalary : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "total_salary", + table: "eva_limit_frame_plan", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "total_salary", + table: "eva_limit_frame_plan"); + } + } +} diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index 9de865c..b4e6928 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -694,6 +694,8 @@ namespace tb320eva.Migrations b.Property("supervisor1_result") .HasMaxLength(1); + b.Property("total_salary"); + b.Property("updated"); b.HasKey("id"); diff --git a/Models/eva_limit_frame_employee/eva_limit_frame_employeeService.cs b/Models/eva_limit_frame_employee/eva_limit_frame_employeeService.cs index 7cbca11..699decb 100644 --- a/Models/eva_limit_frame_employee/eva_limit_frame_employeeService.cs +++ b/Models/eva_limit_frame_employee/eva_limit_frame_employeeService.cs @@ -126,7 +126,7 @@ namespace TodoAPI2.Models && (!model.employee_id.HasValue || m_eva_limit_frame_employee.employee_id == model.employee_id) - orderby m_eva_limit_frame_employee.created descending + orderby m_eva_limit_frame_employee.order_of_data select new eva_limit_frame_employeeViewModel() { id = m_eva_limit_frame_employee.id, diff --git a/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs b/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs index 257baa4..b9aa21e 100644 --- a/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs +++ b/Models/eva_limit_frame_group/eva_limit_frame_groupService.cs @@ -130,7 +130,7 @@ namespace TodoAPI2.Models remark = m_eva_limit_frame_group.remark, frame_plan_guid_eva_limit_frame_plan_executed_date = fk_eva_limit_frame_planResult1.executed_date, - group_guid_eva_evaluation_group_code = fk_eva_evaluation_groupResult2.code, + group_guid_eva_evaluation_group_code = fk_eva_evaluation_groupResult2.thegroup, isActive = m_eva_limit_frame_group.isActive, Created = m_eva_limit_frame_group.created, diff --git a/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs b/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs index 4e5a0e8..aaec12d 100644 --- a/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs +++ b/Models/eva_limit_frame_plan/eva_limit_frame_planEntity.cs @@ -46,6 +46,8 @@ namespace TodoAPI2.Models public decimal? limit_frame_005_total_rounded { get; set; } + public decimal? total_salary { get; set; } + public void SetAutoField(DataContext context) { @@ -54,7 +56,12 @@ namespace TodoAPI2.Models public void DoAfterInsertUpdate(DataContext context) { - + total_salary = (from i in context.eva_limit_frame_employee + join j in context.eva_limit_frame_group + on i.frame_group_guid equals j.id + select i.salary).Sum(); + limit_frame_005_total = total_salary * limit_frame_005 / 100; + limit_frame_005_total_rounded = MyHelper.RoundOff(limit_frame_005_total.Value, 10); } } diff --git a/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs b/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs index 6dd48f6..7cf4c07 100644 --- a/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs +++ b/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs @@ -161,49 +161,7 @@ namespace TodoAPI2.Models var entity = GetEntity(model); entity.id = Guid.NewGuid(); - var all_group = (from i in _repository.Context.eva_evaluation_group - select i); - foreach(var x in all_group) - { - var all_emp = (from j in _repository.Context.eva_evaluation_group_detail - join k in emp.GetAllEmployee() on j.employee_id equals k.id - join m in ext.GetSortingDep() on k.department_id equals m.external_id - where j.evaluation_group_id == x.id - orderby m.external_code, - k.hpt_position_type_id, - k.hpl_position_level_id, - k.employee_no - select k); - - var new_frame_group = new eva_limit_frame_groupEntity(); - new_frame_group.id = Guid.NewGuid(); - new_frame_group.frame_plan_guid = entity.id; - new_frame_group.group_guid = x.id; - new_frame_group.limit_frame_295 = (decimal?)2.95; - new_frame_group.total_salary = all_emp.Sum(z => z.salary); - new_frame_group.total_salary_limit = (new_frame_group.total_salary * new_frame_group.limit_frame_295 / 100); - new_frame_group.total_salary_limit_rounded = new_frame_group.total_salary_limit; - _repository.Context.Add(new_frame_group); - - int i = 1; - foreach (var y in all_emp) - { - var new_emp = new eva_limit_frame_employeeEntity(); - new_emp.id = Guid.NewGuid(); - new_emp.frame_group_guid = new_frame_group.id; - new_emp.employee_id = y.id; - new_emp.org_id = y.department_id; - new_emp.position_text = y.position_name; - new_emp.level_text = y.position_level_text; - new_emp.salary = y.salary; - new_emp.position_allowance = y.position_allowance; - new_emp.monthly_remuneration = y.other_money; - new_emp.cost_of_living = y.cost_of_living; - new_emp.order_of_data = i; - i++; - _repository.Context.Add(new_emp); - } - } + entity.SetAutoField(_repository.Context); @@ -322,18 +280,7 @@ namespace TodoAPI2.Models } public void Delete(Guid id) { - var all_group = (from i in _repository.Context.eva_limit_frame_group - where i.frame_plan_guid == id - select i); - foreach (var x in all_group) - { - var all_emp = from i in _repository.Context.eva_limit_frame_employee - where i.frame_group_guid == x.id - select i; - _repository.Context.RemoveRange(all_emp); - } - - _repository.Context.RemoveRange(all_group); + _repository.Delete(id); diff --git a/Models/vw_limit_frame_plan/Ivw_limit_frame_planService.cs b/Models/vw_limit_frame_plan/Ivw_limit_frame_planService.cs new file mode 100644 index 0000000..500e130 --- /dev/null +++ b/Models/vw_limit_frame_plan/Ivw_limit_frame_planService.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; + +namespace TodoAPI2.Models +{ + public interface Ivw_limit_frame_planService : IBaseService2 + { + new vw_limit_frame_planViewModel Insert(vw_limit_frame_planInputModel model, bool is_force_save); + new vw_limit_frame_planViewModel Update(Guid id, vw_limit_frame_planInputModel model, bool is_force_save); + List GetListByexecuted_date(DateTime? executed_date); + List GetListBySearch(vw_limit_frame_planSearchModel model); + + string UpdateMultiple(List model, bool is_force_save); + vw_limit_frame_planWithSelectionViewModel GetWithSelection(Guid id); + vw_limit_frame_planWithSelectionViewModel GetBlankItem(); + + void RefreshAutoFieldOfAllData(); + eva_limit_frame_planEntity GetEntity(Guid id); + DataContext GetContext(); + + + + } +} + diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planInputModel.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planInputModel.cs new file mode 100644 index 0000000..86eca03 --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planInputModel.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planInputModel + { + + public Guid? id { get; set; } + + public Guid? plan_guid { get; set; } + + public DateTime? executed_date { get; set; } + + public decimal? limit_frame_005 { get; set; } + + public DateTime? salary_adjustment_date { get; set; } + + public decimal? total_salary { get; set; } + + public decimal? limit_frame_005_total { get; set; } + + public decimal? limit_frame_005_total_rounded { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planReportRequestModel.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planReportRequestModel.cs new file mode 100644 index 0000000..75a80db --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planReportRequestModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planReportRequestModel : vw_limit_frame_planSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planSearchModel.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planSearchModel.cs new file mode 100644 index 0000000..0a07c29 --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planSearchModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planSearchModel + { + + public Guid id { get; set; } + + public DateTime? executed_date { get; set; } + + } +} + diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs new file mode 100644 index 0000000..7f9fb38 --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planService.cs @@ -0,0 +1,363 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; +using TodoAPI2.Models; +using System.IO; +using System.Web; +using System.Net; +using TTSW.Configure; +using Microsoft.Extensions.Options; +using System.Data; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planService : Ivw_limit_frame_planService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; + + public vw_limit_frame_planService(IBaseRepository2 repository, IMyDatabase mydb, + Iexternal_linkageService inext, Iexternal_employeeService inemp) + { + _repository = repository; + db = mydb; + ext = inext; + emp = inemp; + } + + #region Private Functions + private eva_limit_frame_planEntity GetEntity(vw_limit_frame_planInputModel model) + { + return Mapper.Map(model); + } + private List GetEntityList(List models) + { + return Mapper.Map>(models); + } + private vw_limit_frame_planViewModel GetDto(eva_limit_frame_planEntity entity) + { + return Mapper.Map(entity); + } + private List GetDtoList(List entities) + { + return Mapper.Map>(entities); + } + + #endregion + + #region Public Functions + #region Query Functions + + public vw_limit_frame_planViewModel Get(Guid id) + { + var entity = _repository.Get(id); + + return GetDto(entity); + } + + public eva_limit_frame_planEntity GetEntity(Guid id) + { + var entity = _repository.Get(id); + + return entity; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + public vw_limit_frame_planWithSelectionViewModel GetWithSelection(Guid id) + { + var entity = _repository.Get(id); + var i = Mapper.Map(entity); + i.item_plan_guid = (from x in _repository.Context.eva_performance_plan select x).ToList(); + + + return i; + } + public vw_limit_frame_planWithSelectionViewModel GetBlankItem() + { + var i = new vw_limit_frame_planWithSelectionViewModel(); + i.item_plan_guid = (from x in _repository.Context.eva_performance_plan select x).ToList(); + + + return i; + } + + public List GetListByexecuted_date(DateTime? executed_date) + { + var model = new vw_limit_frame_planSearchModel(); + model.executed_date = executed_date; + return GetListBySearch(model); + } + + public List GetListBySearch(vw_limit_frame_planSearchModel model) + { + var data = ( + from m_vw_limit_frame_plan in _repository.Context.eva_limit_frame_plan + + join fk_eva_performance_plan1 in _repository.Context.eva_performance_plan on m_vw_limit_frame_plan.plan_guid equals fk_eva_performance_plan1.id + into eva_performance_planResult1 + from fk_eva_performance_planResult1 in eva_performance_planResult1.DefaultIfEmpty() + + + where + 1 == 1 + && (!model.executed_date.HasValue || m_vw_limit_frame_plan.executed_date == model.executed_date) + + + orderby m_vw_limit_frame_plan.created descending + select new vw_limit_frame_planViewModel() + { + id = m_vw_limit_frame_plan.id, + plan_guid = m_vw_limit_frame_plan.plan_guid, + executed_date = m_vw_limit_frame_plan.executed_date, + limit_frame_005 = m_vw_limit_frame_plan.limit_frame_005, + salary_adjustment_date = m_vw_limit_frame_plan.salary_adjustment_date, + total_salary = m_vw_limit_frame_plan.total_salary, + limit_frame_005_total = m_vw_limit_frame_plan.limit_frame_005_total, + limit_frame_005_total_rounded = m_vw_limit_frame_plan.limit_frame_005_total_rounded, + + plan_guid_eva_performance_plan_fiscal_year = fk_eva_performance_planResult1.display_text, + + isActive = m_vw_limit_frame_plan.isActive, + Created = m_vw_limit_frame_plan.created, + Updated = m_vw_limit_frame_plan.updated + } + ).Take(1000).ToList(); + + return data; + } + + #endregion + + #region Manipulation Functions + + + + public vw_limit_frame_planViewModel Insert(vw_limit_frame_planInputModel model, bool is_force_save) + { + var entity = GetEntity(model); + entity.id = Guid.NewGuid(); + entity.limit_frame_005 = (decimal?)0.05; + + var all_group = (from i in _repository.Context.eva_evaluation_group + select i); + foreach (var x in all_group) + { + var all_emp = (from j in _repository.Context.eva_evaluation_group_detail + join k in emp.GetAllEmployee() on j.employee_id equals k.id + join m in ext.GetSortingDep() on k.department_id equals m.external_id + where j.evaluation_group_id == x.id + orderby m.external_code, + k.hpt_position_type_id, + k.hpl_position_level_id, + k.employee_no + select k); + + var new_frame_group = new eva_limit_frame_groupEntity(); + new_frame_group.id = Guid.NewGuid(); + new_frame_group.frame_plan_guid = entity.id; + new_frame_group.group_guid = x.id; + new_frame_group.limit_frame_295 = (decimal?)2.95; + new_frame_group.total_salary = all_emp.Sum(z => z.salary); + new_frame_group.total_salary_limit = (new_frame_group.total_salary * new_frame_group.limit_frame_295 / 100); + new_frame_group.total_salary_limit_rounded = MyHelper.RoundOff(new_frame_group.total_salary_limit.Value, 10); + _repository.Context.Add(new_frame_group); + + int i = 1; + foreach (var y in all_emp) + { + var new_emp = new eva_limit_frame_employeeEntity(); + new_emp.id = Guid.NewGuid(); + new_emp.frame_group_guid = new_frame_group.id; + new_emp.employee_id = y.id; + new_emp.org_id = y.department_id; + new_emp.position_text = y.position_name; + new_emp.level_text = y.position_level_text; + new_emp.salary = y.salary; + new_emp.position_allowance = y.position_allowance; + new_emp.monthly_remuneration = y.other_money; + new_emp.cost_of_living = y.cost_of_living; + new_emp.order_of_data = i; + i++; + _repository.Context.Add(new_emp); + } + } + + entity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var inserted = _repository.Insert(entity); + entity.DoAfterInsertUpdate(_repository.Context); + _repository.Context.SaveChanges(); + return Get(inserted.id); + } + else + { + _repository.InsertWithoutCommit(entity); + entity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(entity); + } + } + + public vw_limit_frame_planViewModel Update(Guid id, vw_limit_frame_planInputModel model, bool is_force_save) + { + var existingEntity = _repository.Get(id); + if (existingEntity != null) + { + existingEntity.plan_guid = model.plan_guid; + existingEntity.executed_date = model.executed_date; + existingEntity.limit_frame_005 = model.limit_frame_005; + existingEntity.salary_adjustment_date = model.salary_adjustment_date; + existingEntity.total_salary = model.total_salary; + existingEntity.limit_frame_005_total = model.limit_frame_005_total; + existingEntity.limit_frame_005_total_rounded = model.limit_frame_005_total_rounded; + + existingEntity.SetAutoField(_repository.Context); + + if (is_force_save) + { + var updated = _repository.Update(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + _repository.Context.SaveChanges(); + return Get(updated.id); + } + else + { + _repository.UpdateWithoutCommit(id, existingEntity); + existingEntity.DoAfterInsertUpdate(_repository.Context); + return Mapper.Map(existingEntity); + } + } + else + throw new NotificationException("No data to update"); + } + + public string UpdateMultiple(List model, bool is_force_save) + { + 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.plan_guid = i.plan_guid; + existingEntity.executed_date = i.executed_date; + existingEntity.limit_frame_005 = i.limit_frame_005; + existingEntity.salary_adjustment_date = i.salary_adjustment_date; + existingEntity.total_salary = i.total_salary; + existingEntity.limit_frame_005_total = i.limit_frame_005_total; + existingEntity.limit_frame_005_total_rounded = i.limit_frame_005_total_rounded; + + existingEntity.SetAutoField(_repository.Context); + _repository.UpdateWithoutCommit(i.id.Value, existingEntity); + } + } + else if (i.active_mode == "1" && !i.id.HasValue) // add + { + var entity = GetEntity(i); + entity.id = Guid.NewGuid(); + entity.SetAutoField(_repository.Context); + _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 + } + } + if (is_force_save) + { + _repository.Context.SaveChanges(); + } + + return model.Count().ToString(); + } + + public vw_limit_frame_planViewModel SetAsActive(Guid id) + { + var updated = _repository.SetAsActive(id); + + return Get(updated.id); + } + public vw_limit_frame_planViewModel SetAsInactive(Guid id) + { + var updated = _repository.SetAsInActive(id); + + return Get(updated.id); + } + public void Delete(Guid id) + { + var all_group = (from i in _repository.Context.eva_limit_frame_group + where i.frame_plan_guid == id + select i); + foreach (var x in all_group) + { + var all_emp = from i in _repository.Context.eva_limit_frame_employee + where i.frame_group_guid == x.id + select i; + _repository.Context.RemoveRange(all_emp); + } + + _repository.Context.RemoveRange(all_group); + + _repository.Delete(id); + + return; + } + + public void RefreshAutoFieldOfAllData() + { + var all_items = from i in _repository.Context.eva_limit_frame_plan + select i; + foreach (var item in all_items) + { + item.SetAutoField(_repository.Context); + } + _repository.Context.SaveChanges(); + } + + private Dictionary GetLookupForLog() + { + var i = new Dictionary(); + + + i.Add("plan_guid", "แผนการประเมิน"); + i.Add("plan_guid_eva_performance_plan_fiscal_year", "แผนการประเมิน"); + i.Add("executed_date", "วันที่ตั้งกรอบวงเงิน"); + i.Add("txt_executed_date", "วันที่ตั้งกรอบวงเงิน"); + i.Add("limit_frame_005", "กรอบวงเงินที่กันไว้"); + i.Add("salary_adjustment_date", "เลื่อนเงินเดือนวันที่"); + i.Add("txt_salary_adjustment_date", "เลื่อนเงินเดือนวันที่"); + i.Add("total_salary", "รวมอัตราเงินเดือน"); + i.Add("limit_frame_005_total", "กันวงเงินไว้"); + i.Add("limit_frame_005_total_rounded", "กันวงเงินใช้จริง"); + + return i; + } + + #endregion + + #region Match Item + + #endregion + + #endregion + } +} + diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planViewModel.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planViewModel.cs new file mode 100644 index 0000000..2829182 --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planViewModel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Threading.Tasks; +using TTSW.EF; +using TTSW.Utils; +using TTSW.Constant; +using TTSW.Common; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planViewModel : BaseViewModel2 + { + + public Guid? plan_guid { get; set; } + + public DateTime? executed_date { get; set; } + + public string txt_executed_date { get { return MyHelper.GetDateStringForReport(this.executed_date); } } + + public decimal? limit_frame_005 { get; set; } + + public DateTime? salary_adjustment_date { get; set; } + + public string txt_salary_adjustment_date { get { return MyHelper.GetDateStringForReport(this.salary_adjustment_date); } } + + public decimal? total_salary { get; set; } + + public decimal? limit_frame_005_total { get; set; } + + public decimal? limit_frame_005_total_rounded { get; set; } + + public string plan_guid_eva_performance_plan_fiscal_year { get; set; } + + } +} \ No newline at end of file diff --git a/Models/vw_limit_frame_plan/vw_limit_frame_planWithSelectionViewModel.cs b/Models/vw_limit_frame_plan/vw_limit_frame_planWithSelectionViewModel.cs new file mode 100644 index 0000000..7cd64ba --- /dev/null +++ b/Models/vw_limit_frame_plan/vw_limit_frame_planWithSelectionViewModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TodoAPI2.Models +{ + public class vw_limit_frame_planWithSelectionViewModel: vw_limit_frame_planViewModel + { + public List item_plan_guid { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index dcc7159..07f8c78 100644 --- a/Startup.cs +++ b/Startup.cs @@ -323,6 +323,8 @@ namespace Test01 services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -598,6 +600,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/Utils/MyHelper.cs b/Utils/MyHelper.cs index 20481f3..19f3754 100644 --- a/Utils/MyHelper.cs +++ b/Utils/MyHelper.cs @@ -331,4 +331,9 @@ public class MyHelper string var = !string.IsNullOrEmpty(env_var) ? env_var : Configuration[variable]; return var; } + + public static decimal RoundOff(decimal i, decimal round_number) + { + return (Math.Round(i / round_number)) * round_number; + } } diff --git a/ViewControllers/vw_limit_frame_planViewControllers.cs b/ViewControllers/vw_limit_frame_planViewControllers.cs new file mode 100644 index 0000000..aee3aec --- /dev/null +++ b/ViewControllers/vw_limit_frame_planViewControllers.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using TodoAPI2.Models; +using STAFF_API.Models; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; +using TodoAPI2.Controllers; + +namespace TodoAPI2.Controllers +{ + public class vw_limit_frame_planViewController : Controller + { + private ILogger _logger; + private Ivw_limit_frame_planService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public vw_limit_frame_planViewController(ILogger logger, Ivw_limit_frame_planService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + public IActionResult vw_limit_frame_plan() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + public IActionResult vw_limit_frame_plan_d() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + //public IActionResult vw_limit_frame_plan_report() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + //public IActionResult vw_limit_frame_plan_inline() + //{ + // if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + //} + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} + + diff --git a/Views/eva_limit_frame_employeeView/eva_limit_frame_employee.cshtml b/Views/eva_limit_frame_employeeView/eva_limit_frame_employee.cshtml index 7214d56..5f06a29 100644 --- a/Views/eva_limit_frame_employeeView/eva_limit_frame_employee.cshtml +++ b/Views/eva_limit_frame_employeeView/eva_limit_frame_employee.cshtml @@ -17,60 +17,60 @@
- - + + -
-
-
-
- - -
+
+
+
+
+ + +
-
- - -
+
+ + +
-
- - -
-
-
-
- - -
+
+ + +
+
+
+
+ + +
-
- - -
-
-
-
- - -
+
+ + +
+
+
+
+ + +
-
- - -
+
+ + +
-
- - -
-
-
-
- - -
-
+
+ + +
+
+
+
+ + +
+
@@ -95,51 +95,51 @@ - +
-
ค้นหา eva_limit_frame_employee
-
-
- -
- - -
+
ค้นหา eva_limit_frame_employee
+
+
-
- - -
+
+ + +
-
- - - -
+
+ + +
-
-
+
+ + + +
- + + + +
- - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -147,13 +147,13 @@ @section FooterPlaceHolder{ - - + + } diff --git a/Views/eva_limit_frame_groupView/eva_limit_frame_group.cshtml b/Views/eva_limit_frame_groupView/eva_limit_frame_group.cshtml index b95a730..de37107 100644 --- a/Views/eva_limit_frame_groupView/eva_limit_frame_group.cshtml +++ b/Views/eva_limit_frame_groupView/eva_limit_frame_group.cshtml @@ -17,44 +17,44 @@
- - + + -
-
-
-
- - -
+
+
+
+
+ + +
-
- - -
-
-
-
- - -
+
+ + +
+
+
+
+ + +
-
- - -
+
+ + +
-
- - -
-
-
-
- - -
-
+
+ + +
+
+
+
+ + +
+
@@ -79,48 +79,48 @@ - +
-
ค้นหา eva_limit_frame_group
-
-
- -
- - -
+
ค้นหา eva_limit_frame_group
+
+
-
- - -
+
+ + +
-
- - - -
+
+ + +
-
-
+
+ + + +
-
เครื่องมือเครื่องมือ
+ + + +
- - - - - - - - - - - + + + + + + + + + + + @@ -128,13 +128,13 @@ @section FooterPlaceHolder{ - - + + } diff --git a/Views/eva_limit_frame_groupView/eva_limit_frame_group_d.cshtml b/Views/eva_limit_frame_groupView/eva_limit_frame_group_d.cshtml index c24f1b4..9b748d8 100644 --- a/Views/eva_limit_frame_groupView/eva_limit_frame_group_d.cshtml +++ b/Views/eva_limit_frame_groupView/eva_limit_frame_group_d.cshtml @@ -2,9 +2,89 @@ @inject IConfiguration Configuration @{ ViewData["Title"] = "eva_limit_frame_group"; - Layout = "_LayoutDirect"; + Layout = "_LayoutDirect"; } + + +
@@ -15,89 +95,115 @@ + +
-
บันทึกข้อมูล eva_limit_frame_group
+
วงเงินที่ใช้ในการเลื่อนเงินเดือนของแต่ละกอง/ส่วนงาน
-
- กรุณากรอกข้อมูลลงในแบบฟอร์ม -
-
-
+
+
- - + + -
-
-
-
- - +
+
+ + +
+ +
+ + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + +
-
- - -
-
-
-
- - -
- -
- - -
- -
- - -
-
-
-
- - -
-
- - - - - - - -
-
- - -
-
- + + +
+ +
+
รายชื่อพนักงานและอัตราเงินเดือน ณ กำหนดกรอบวงเงิน
+
เครื่องมือเครื่องมือ
+ + + + + + + + + + + + + + + + + + +
เครื่องมือ
@section FooterPlaceHolder{ - - + + + } diff --git a/Views/home/index2.cshtml b/Views/home/index2.cshtml index 936629a..bcccc3b 100644 --- a/Views/home/index2.cshtml +++ b/Views/home/index2.cshtml @@ -31,7 +31,7 @@
  • ·กำหนดแผนการประเมินเพื่อปรับเลื่อนเงินเดือน
    • ·กำหนดระดับผลการประเมิน
      diff --git a/Views/vw_limit_frame_planView/vw_limit_frame_plan.cshtml b/Views/vw_limit_frame_planView/vw_limit_frame_plan.cshtml new file mode 100644 index 0000000..89d636d --- /dev/null +++ b/Views/vw_limit_frame_planView/vw_limit_frame_plan.cshtml @@ -0,0 +1,108 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "vw_limit_frame_plan"; +} + + + +
      +
      +
      + @Configuration["SiteInformation:modulename"] +
      +
      +
      + +
      +
      + +
      +
      วงเงินที่ใช้ในการเลื่อนเงินเดือน
      +
      +
      + +
      + + +
      + +
      +
      + + + + + + + + + + + + + + + + + +
      เครื่องมือ
      +
      + +@section FooterPlaceHolder{ + + +} + diff --git a/Views/vw_limit_frame_planView/vw_limit_frame_plan_d.cshtml b/Views/vw_limit_frame_planView/vw_limit_frame_plan_d.cshtml new file mode 100644 index 0000000..9ac9dcc --- /dev/null +++ b/Views/vw_limit_frame_planView/vw_limit_frame_plan_d.cshtml @@ -0,0 +1,155 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "vw_limit_frame_plan"; + Layout = "_LayoutDirect"; +} + + + + +
      +
      +
      + @Configuration["SiteInformation:modulename"] +
      +
      +
      + +
      +
      + +
      +
      บันทึกข้อมูล วงเงินที่ใช้ในการเลื่อนเงินเดือน
      + +
      +
      + +
      +
      + + + + +
      +
      + + +
      + +
      + + +
      + +
      + + +
      +
      +
      +
      + + +
      + +
      + + +
      +
      +
      +
      + + +
      + +
      + + +
      +
      + + +
      +
      +
      +
      + +
      +
      + + + +
      +
      + +
      + +
      + +
      +
      วงเงินที่ใช้ในการเลื่อนเงินเดือนของแต่ละกอง/ส่วนงาน
      + + + + + + + + + + + + + + + +
      เครื่องมือ
      +
      + +@section FooterPlaceHolder{ + + + + +} + diff --git a/tb320eva.csproj b/tb320eva.csproj index c2eea93..3b3c6c0 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -86,6 +86,8 @@ + + @@ -109,6 +111,8 @@ + + Always diff --git a/tb320eva.xml b/tb320eva.xml index 9288550..1c68e5d 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -4329,16 +4329,6 @@ - - - Get specific item by id - - - - Return Get specific item by id - Returns the item - Error Occurred - Get Blank Item @@ -4349,26 +4339,6 @@ Returns the item Error Occurred - - - Get list items by frame_plan_guid - - - - Return list of items by specifced keyword - Returns the item - Error Occurred - - - - Get list items by search - - - - Return list of items by specifced keyword - Returns the item - Error Occurred - Download Report @@ -4379,66 +4349,6 @@ Returns the item Error Occurred - - - Create new item - - - - - Response Result Message - Response Result Message - If the model is invalid - Error Occurred - - - - Update item - - - - - - Response Result Message - Response Result Message - If the model is invalid - Error Occurred - - - - Delete item - - - - - Response Result Message - Response Result Message - If the model is invalid - Error Occurred - - - - Update multiple item - - - - - Response Result Message - Response Result Message - If the model is invalid - Error Occurred - - - - Refresh AutoField of all items - - - - Response Result Message - Response Result Message - If the model is invalid - Error Occurred - Default constructure for dependency injection @@ -4872,6 +4782,124 @@ Returns the item Error Occurred + + + Default constructure for dependency injection + + + + + + + + Get specific item by id + + + + Return Get specific item by id + Returns the item + Error Occurred + + + + Get Blank Item + + + + Return a blank item + Returns the item + Error Occurred + + + + Get list items by executed_date + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Get list items by search + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Download Report + + + + Return list of items by specifced keyword + Returns the item + Error Occurred + + + + Create new item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update item + + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Delete item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Update multiple item + + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + + + + Refresh AutoField of all items + + + + Response Result Message + Response Result Message + If the model is invalid + Error Occurred + Default constructure for dependency injection @@ -5252,6 +5280,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection diff --git a/wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js b/wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js index c227b3a..de7c030 100644 --- a/wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js +++ b/wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js @@ -5,48 +5,48 @@ var eva_limit_frame_employee_API = "/api/eva_limit_frame_employee/"; function eva_limit_frame_employee_GetSearchParameter() { var eva_limit_frame_employeeSearchObject = new Object(); -eva_limit_frame_employeeSearchObject.frame_group_guid = $("#s_eva_limit_frame_employee_frame_group_guid").val(); -eva_limit_frame_employeeSearchObject.employee_id = $("#s_eva_limit_frame_employee_employee_id").val(); + eva_limit_frame_employeeSearchObject.frame_group_guid = getUrlParameter("id"); + eva_limit_frame_employeeSearchObject.employee_id = $("#s_eva_limit_frame_employee_employee_id").val(); return eva_limit_frame_employeeSearchObject; } function eva_limit_frame_employee_FeedDataToSearchForm(data) { -$("#s_eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid); -DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_employee_employee_id"), data, "id", "external_name", "item_employee_id", data.employee_id); + $("#s_eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid); + DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_employee_employee_id"), data, "id", "external_name", "item_employee_id", data.employee_id); } //================= Form Data Customizaiton ========================================= function eva_limit_frame_employee_FeedDataToForm(data) { -$("#eva_limit_frame_employee_id").val(data.id); -$("#eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid); -DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id"), data, "id", "external_name", "item_employee_id", data.employee_id); -DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id); -$("#eva_limit_frame_employee_position_text").val(data.position_text); -$("#eva_limit_frame_employee_level_text").val(data.level_text); -$("#eva_limit_frame_employee_salary").val(data.salary); -$("#eva_limit_frame_employee_position_allowance").val(data.position_allowance); -$("#eva_limit_frame_employee_monthly_remuneration").val(data.monthly_remuneration); -$("#eva_limit_frame_employee_cost_of_living").val(data.cost_of_living); -$("#eva_limit_frame_employee_order_of_data").val(data.order_of_data); - + $("#eva_limit_frame_employee_id").val(data.id); + $("#eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid); + DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id); + DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id); + $("#eva_limit_frame_employee_position_text").val(data.position_text); + $("#eva_limit_frame_employee_level_text").val(data.level_text); + $("#eva_limit_frame_employee_salary").val(data.salary); + $("#eva_limit_frame_employee_position_allowance").val(data.position_allowance); + $("#eva_limit_frame_employee_monthly_remuneration").val(data.monthly_remuneration); + $("#eva_limit_frame_employee_cost_of_living").val(data.cost_of_living); + $("#eva_limit_frame_employee_order_of_data").val(data.order_of_data); + console.log(data); } function eva_limit_frame_employee_GetFromForm() { var eva_limit_frame_employeeObject = new Object(); -eva_limit_frame_employeeObject.id = $("#eva_limit_frame_employee_id").val(); -eva_limit_frame_employeeObject.frame_group_guid = $("#eva_limit_frame_employee_frame_group_guid").val(); -eva_limit_frame_employeeObject.employee_id = $("#eva_limit_frame_employee_employee_id").val(); -eva_limit_frame_employeeObject.org_id = $("#eva_limit_frame_employee_org_id").val(); -eva_limit_frame_employeeObject.position_text = $("#eva_limit_frame_employee_position_text").val(); -eva_limit_frame_employeeObject.level_text = $("#eva_limit_frame_employee_level_text").val(); -eva_limit_frame_employeeObject.salary = $("#eva_limit_frame_employee_salary").val(); -eva_limit_frame_employeeObject.position_allowance = $("#eva_limit_frame_employee_position_allowance").val(); -eva_limit_frame_employeeObject.monthly_remuneration = $("#eva_limit_frame_employee_monthly_remuneration").val(); -eva_limit_frame_employeeObject.cost_of_living = $("#eva_limit_frame_employee_cost_of_living").val(); -eva_limit_frame_employeeObject.order_of_data = $("#eva_limit_frame_employee_order_of_data").val(); + eva_limit_frame_employeeObject.id = $("#eva_limit_frame_employee_id").val(); + eva_limit_frame_employeeObject.frame_group_guid = getUrlParameter("id"); + eva_limit_frame_employeeObject.employee_id = $("#eva_limit_frame_employee_employee_id").val(); + eva_limit_frame_employeeObject.org_id = $("#eva_limit_frame_employee_org_id").val(); + eva_limit_frame_employeeObject.position_text = $("#eva_limit_frame_employee_position_text").val(); + eva_limit_frame_employeeObject.level_text = $("#eva_limit_frame_employee_level_text").val(); + eva_limit_frame_employeeObject.salary = $("#eva_limit_frame_employee_salary").val(); + eva_limit_frame_employeeObject.position_allowance = $("#eva_limit_frame_employee_position_allowance").val(); + eva_limit_frame_employeeObject.monthly_remuneration = $("#eva_limit_frame_employee_monthly_remuneration").val(); + eva_limit_frame_employeeObject.cost_of_living = $("#eva_limit_frame_employee_cost_of_living").val(); + eva_limit_frame_employeeObject.order_of_data = $("#eva_limit_frame_employee_order_of_data").val(); return eva_limit_frame_employeeObject; @@ -55,14 +55,14 @@ eva_limit_frame_employeeObject.order_of_data = $("#eva_limit_frame_employee_orde function eva_limit_frame_employee_InitialForm(s) { var successFunc = function (result) { eva_limit_frame_employee_FeedDataToForm(result); - eva_limit_frame_employee_FeedDataToSearchForm(result); + eva_limit_frame_employee_FeedDataToSearchForm(result); if (s) { // Incase model popup $("#eva_limit_frame_employeeModel").modal("show"); } - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_employee_API + "GetBlankItem", successFunc, AlertDanger); } @@ -89,15 +89,15 @@ function eva_limit_frame_employee_SetEditForm(a) { eva_limit_frame_employee_editMode = "UPDATE"; eva_limit_frame_employee_FeedDataToForm(result); $("#eva_limit_frame_employeeModel").modal("show"); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_employee_API + a, successFunc, AlertDanger); } function eva_limit_frame_employee_SetCreateForm(s) { eva_limit_frame_employee_editMode = "CREATE"; - eva_limit_frame_employee_InitialForm(s); + eva_limit_frame_employee_InitialForm(s); } function eva_limit_frame_employee_RefreshTable() { @@ -115,8 +115,7 @@ var eva_limit_frame_employee_customValidation = function (group) { }; function eva_limit_frame_employee_PutUpdate() { - if (!ValidateForm('eva_limit_frame_employee', eva_limit_frame_employee_customValidation)) - { + if (!ValidateForm('eva_limit_frame_employee', eva_limit_frame_employee_customValidation)) { return; } @@ -126,22 +125,22 @@ function eva_limit_frame_employee_PutUpdate() { if (eva_limit_frame_employee_editMode === "UPDATE") { var successFunc1 = function (result) { $("#eva_limit_frame_employeeModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_employee_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxPutRequest(apisite + eva_limit_frame_employee_API + data.id, data, successFunc1, AlertDanger); } // Create mode else { var successFunc2 = function (result) { $("#eva_limit_frame_employeeModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_employee_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxPostRequest(apisite + eva_limit_frame_employee_API, data, successFunc2, AlertDanger); } } @@ -150,11 +149,11 @@ function eva_limit_frame_employee_GoDelete(a) { if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { var successFunc = function (result) { $("#eva_limit_frame_employeeModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_employee_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxDeleteRequest(apisite + eva_limit_frame_employee_API + a, null, successFunc, AlertDanger); } } @@ -164,37 +163,38 @@ function eva_limit_frame_employee_GoDelete(a) { var eva_limit_frame_employeeTableV; var eva_limit_frame_employee_setupTable = function (result) { - tmp = '"'; + tmp = '"'; + var groupColumn = 3; eva_limit_frame_employeeTableV = $('#eva_limit_frame_employeeTable').DataTable({ "processing": true, "serverSide": false, "data": result, - //"select": { + //"select": { // "style": 'multi' //}, "columns": [ - //{ "data": "" }, - { "data": "id" }, - { "data": "id" }, - { "data": "frame_group_guid_eva_limit_frame_group_group_guid" }, - { "data": "employee_id_external_linkage_external_name" }, - { "data": "org_id_external_linkage_external_name" }, - { "data": "position_text" }, - { "data": "level_text" }, - { "data": "salary" }, - { "data": "position_allowance" }, - { "data": "monthly_remuneration" }, - { "data": "cost_of_living" }, - { "data": "order_of_data" }, + //{ "data": "" }, + { "data": "id" }, + { "data": "order_of_data" }, + { "data": "employee_id_external_linkage_external_name" }, + { "data": "org_id_external_linkage_external_name" }, + { "data": "position_text" }, + { "data": "level_text" }, + { "data": "salary" }, + { "data": "position_allowance" }, + { "data": "monthly_remuneration" }, + { "data": "cost_of_living" }, + ], "columnDefs": [ { "targets": 0, //1, "data": "id", "render": function (data, type, row, meta) { - return " "; + return " "; } }, + { "visible": false, "targets": groupColumn } //{ // targets: 0, // data: "", @@ -202,20 +202,35 @@ var eva_limit_frame_employee_setupTable = function (result) { // orderable: false, // className: 'select-checkbox' //} - ], + ], "language": { "url": appsite + "/DataTables-1.10.16/thai.json" }, "paging": true, - "searching": false + "searching": false, + "drawCallback": function (settings) { + var api = this.api(); + var rows = api.rows({ page: 'current' }).nodes(); + var last = null; + + api.column(groupColumn, { page: 'current' }).data().each(function (group, i) { + if (last !== group) { + $(rows).eq(i).before( + '' + group + '' + ); + + last = group; + } + }); + } }); - endLoad(); + endLoad(); }; function eva_limit_frame_employee_InitiateDataTable() { - startLoad(); - var p = $.param(eva_limit_frame_employee_GetSearchParameter()); - AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?"+p, eva_limit_frame_employee_setupTable, AlertDanger); + startLoad(); + var p = $.param(eva_limit_frame_employee_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?" + p, eva_limit_frame_employee_setupTable, AlertDanger); } function eva_limit_frame_employee_DoSearch() { @@ -223,10 +238,10 @@ function eva_limit_frame_employee_DoSearch() { var eva_limit_frame_employee_reload = function (result) { eva_limit_frame_employeeTableV.destroy(); eva_limit_frame_employee_setupTable(result); - endLoad(); + endLoad(); }; - startLoad(); - AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?"+p, eva_limit_frame_employee_reload, AlertDanger); + startLoad(); + AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?" + p, eva_limit_frame_employee_reload, AlertDanger); } function eva_limit_frame_employee_GetSelect(f) { diff --git a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group.js b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group.js index f1795e0..ad02c34 100644 --- a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group.js +++ b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group.js @@ -5,42 +5,42 @@ var eva_limit_frame_group_API = "/api/eva_limit_frame_group/"; function eva_limit_frame_group_GetSearchParameter() { var eva_limit_frame_groupSearchObject = new Object(); -eva_limit_frame_groupSearchObject.frame_plan_guid = $("#s_eva_limit_frame_group_frame_plan_guid").val(); -eva_limit_frame_groupSearchObject.group_guid = $("#s_eva_limit_frame_group_group_guid").val(); + eva_limit_frame_groupSearchObject.frame_plan_guid = getUrlParameter("id"); + eva_limit_frame_groupSearchObject.group_guid = $("#s_eva_limit_frame_group_group_guid").val(); return eva_limit_frame_groupSearchObject; } function eva_limit_frame_group_FeedDataToSearchForm(data) { -$("#s_eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); -DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid); + $("#s_eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); + DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid); } //================= Form Data Customizaiton ========================================= function eva_limit_frame_group_FeedDataToForm(data) { -$("#eva_limit_frame_group_id").val(data.id); -$("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); -DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid); -$("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295); -$("#eva_limit_frame_group_total_salary").val(data.total_salary); -$("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit); -$("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded); -$("#eva_limit_frame_group_remark").val(data.remark); + $("#eva_limit_frame_group_id").val(data.id); + $("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); + DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid); + $("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295); + $("#eva_limit_frame_group_total_salary").val(data.total_salary); + $("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit); + $("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded); + $("#eva_limit_frame_group_remark").val(data.remark); } function eva_limit_frame_group_GetFromForm() { var eva_limit_frame_groupObject = new Object(); -eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val(); -eva_limit_frame_groupObject.frame_plan_guid = $("#eva_limit_frame_group_frame_plan_guid").val(); -eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val(); -eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val(); -eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val(); -eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val(); -eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val(); -eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); + eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val(); + eva_limit_frame_groupObject.frame_plan_guid = $("#eva_limit_frame_group_frame_plan_guid").val(); + eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val(); + eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val(); + eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val(); + eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val(); + eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val(); + eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); return eva_limit_frame_groupObject; @@ -49,14 +49,14 @@ eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); function eva_limit_frame_group_InitialForm(s) { var successFunc = function (result) { eva_limit_frame_group_FeedDataToForm(result); - eva_limit_frame_group_FeedDataToSearchForm(result); + eva_limit_frame_group_FeedDataToSearchForm(result); if (s) { // Incase model popup $("#eva_limit_frame_groupModel").modal("show"); } - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_group_API + "GetBlankItem", successFunc, AlertDanger); } @@ -72,10 +72,10 @@ function eva_limit_frame_group_GoCreate() { function eva_limit_frame_group_GoEdit(a) { // Incase model popup - eva_limit_frame_group_SetEditForm(a); + //eva_limit_frame_group_SetEditForm(a); // Incase open new page - //window_open(appsite + "/eva_limit_frame_groupView/eva_limit_frame_group_d?id=" + a); + window_open(appsite + "/eva_limit_frame_groupView/eva_limit_frame_group_d?id=" + a); } function eva_limit_frame_group_SetEditForm(a) { @@ -83,15 +83,15 @@ function eva_limit_frame_group_SetEditForm(a) { eva_limit_frame_group_editMode = "UPDATE"; eva_limit_frame_group_FeedDataToForm(result); $("#eva_limit_frame_groupModel").modal("show"); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_group_API + a, successFunc, AlertDanger); } function eva_limit_frame_group_SetCreateForm(s) { eva_limit_frame_group_editMode = "CREATE"; - eva_limit_frame_group_InitialForm(s); + eva_limit_frame_group_InitialForm(s); } function eva_limit_frame_group_RefreshTable() { @@ -109,8 +109,7 @@ var eva_limit_frame_group_customValidation = function (group) { }; function eva_limit_frame_group_PutUpdate() { - if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation)) - { + if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation)) { return; } @@ -120,22 +119,22 @@ function eva_limit_frame_group_PutUpdate() { if (eva_limit_frame_group_editMode === "UPDATE") { var successFunc1 = function (result) { $("#eva_limit_frame_groupModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_group_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxPutRequest(apisite + eva_limit_frame_group_API + data.id, data, successFunc1, AlertDanger); } // Create mode else { var successFunc2 = function (result) { $("#eva_limit_frame_groupModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_group_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxPostRequest(apisite + eva_limit_frame_group_API, data, successFunc2, AlertDanger); } } @@ -144,11 +143,11 @@ function eva_limit_frame_group_GoDelete(a) { if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { var successFunc = function (result) { $("#eva_limit_frame_groupModel").modal("hide"); - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_group_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxDeleteRequest(apisite + eva_limit_frame_group_API + a, null, successFunc, AlertDanger); } } @@ -158,32 +157,30 @@ function eva_limit_frame_group_GoDelete(a) { var eva_limit_frame_groupTableV; var eva_limit_frame_group_setupTable = function (result) { - tmp = '"'; + tmp = '"'; eva_limit_frame_groupTableV = $('#eva_limit_frame_groupTable').DataTable({ "processing": true, "serverSide": false, "data": result, - //"select": { + //"select": { // "style": 'multi' //}, "columns": [ - //{ "data": "" }, - { "data": "id" }, - { "data": "id" }, - { "data": "frame_plan_guid_eva_limit_frame_plan_executed_date" }, - { "data": "group_guid_eva_evaluation_group_code" }, - { "data": "limit_frame_295" }, - { "data": "total_salary" }, - { "data": "total_salary_limit" }, - { "data": "total_salary_limit_rounded" }, - { "data": "remark" }, + //{ "data": "" }, + { "data": "id" }, + { "data": "group_guid_eva_evaluation_group_code" }, + { "data": "limit_frame_295" }, + { "data": "total_salary" }, + { "data": "total_salary_limit" }, + { "data": "total_salary_limit_rounded" }, + { "data": "remark" }, ], "columnDefs": [ { "targets": 0, //1, "data": "id", "render": function (data, type, row, meta) { - return " "; + return " "; } }, //{ @@ -193,20 +190,20 @@ var eva_limit_frame_group_setupTable = function (result) { // orderable: false, // className: 'select-checkbox' //} - ], + ], "language": { "url": appsite + "/DataTables-1.10.16/thai.json" }, - "paging": true, - "searching": false + "paging": false, + "searching": false }); - endLoad(); + endLoad(); }; function eva_limit_frame_group_InitiateDataTable() { - startLoad(); - var p = $.param(eva_limit_frame_group_GetSearchParameter()); - AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?"+p, eva_limit_frame_group_setupTable, AlertDanger); + startLoad(); + var p = $.param(eva_limit_frame_group_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?" + p, eva_limit_frame_group_setupTable, AlertDanger); } function eva_limit_frame_group_DoSearch() { @@ -214,10 +211,10 @@ function eva_limit_frame_group_DoSearch() { var eva_limit_frame_group_reload = function (result) { eva_limit_frame_groupTableV.destroy(); eva_limit_frame_group_setupTable(result); - endLoad(); + endLoad(); }; - startLoad(); - AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?"+p, eva_limit_frame_group_reload, AlertDanger); + startLoad(); + AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?" + p, eva_limit_frame_group_reload, AlertDanger); } function eva_limit_frame_group_GetSelect(f) { diff --git a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js index c7a974f..bbb3884 100644 --- a/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js +++ b/wwwroot/js/eva_limit_frame_group/eva_limit_frame_group_d.js @@ -4,27 +4,27 @@ var eva_limit_frame_group_API = "/api/eva_limit_frame_group/"; //================= Form Data Customizaiton ========================================= function eva_limit_frame_group_FeedDataToForm(data) { -$("#eva_limit_frame_group_id").val(data.id); -$("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); -DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid); -$("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295); -$("#eva_limit_frame_group_total_salary").val(data.total_salary); -$("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit); -$("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded); -$("#eva_limit_frame_group_remark").val(data.remark); + $("#eva_limit_frame_group_id").val(data.id); + $("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid); + DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "thegroup", "item_group_guid", data.group_guid); + $("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295); + $("#eva_limit_frame_group_total_salary").val(data.total_salary); + $("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit); + $("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded); + $("#eva_limit_frame_group_remark").val(data.remark); } function eva_limit_frame_group_GetFromForm() { var eva_limit_frame_groupObject = new Object(); -eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val(); -eva_limit_frame_groupObject.frame_plan_guid = $("#eva_limit_frame_group_frame_plan_guid").val(); -eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val(); -eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val(); -eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val(); -eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val(); -eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val(); -eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); + eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val(); + eva_limit_frame_groupObject.frame_plan_guid = $("#eva_limit_frame_group_frame_plan_guid").val(); + eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val(); + eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val(); + eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val(); + eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val(); + eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val(); + eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); return eva_limit_frame_groupObject; @@ -33,9 +33,9 @@ eva_limit_frame_groupObject.remark = $("#eva_limit_frame_group_remark").val(); function eva_limit_frame_group_InitialForm() { var successFunc = function (result) { eva_limit_frame_group_FeedDataToForm(result); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_group_API + "GetBlankItem", successFunc, AlertDanger); } @@ -45,15 +45,15 @@ function eva_limit_frame_group_SetEditForm(a) { var successFunc = function (result) { eva_limit_frame_group_editMode = "UPDATE"; eva_limit_frame_group_FeedDataToForm(result); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxGetRequest(apisite + eva_limit_frame_group_API + a, successFunc, AlertDanger); } function eva_limit_frame_group_SetCreateForm() { eva_limit_frame_group_editMode = "CREATE"; - eva_limit_frame_group_InitialForm(); + eva_limit_frame_group_InitialForm(); } //================= Update and Delete ========================================= @@ -63,8 +63,7 @@ var eva_limit_frame_group_customValidation = function (group) { }; function eva_limit_frame_group_PutUpdate() { - if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation)) - { + if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation)) { return; } var data = eva_limit_frame_group_GetFromForm(); @@ -72,19 +71,19 @@ function eva_limit_frame_group_PutUpdate() { //Update Mode if (eva_limit_frame_group_editMode === "UPDATE") { var successFunc1 = function (result) { - AlertSuccess(result.code+" "+result.message); - endLoad(); + AlertSuccess(result.code + " " + result.message); + endLoad(); }; - startLoad(); + startLoad(); AjaxPutRequest(apisite + eva_limit_frame_group_API + data.id, data, successFunc1, AlertDanger); } // Create mode else { var successFunc2 = function (result) { - AlertSuccess(result.code+" "+result.message); - endLoad(); + AlertSuccess(result.code + " " + result.message); + endLoad(); }; - startLoad(); + startLoad(); AjaxPostRequest(apisite + eva_limit_frame_group_API, data, successFunc2, AlertDanger); } } @@ -92,11 +91,11 @@ function eva_limit_frame_group_PutUpdate() { function eva_limit_frame_group_GoDelete(a) { if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) { var successFunc = function (result) { - AlertSuccess(result.code+" "+result.message); + AlertSuccess(result.code + " " + result.message); eva_limit_frame_group_RefreshTable(); - endLoad(); + endLoad(); }; - startLoad(); + startLoad(); AjaxDeleteRequest(apisite + eva_limit_frame_group_API + a, null, successFunc, AlertDanger); } } diff --git a/wwwroot/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js b/wwwroot/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js index 6cbd74d..f724494 100644 --- a/wwwroot/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js +++ b/wwwroot/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js @@ -4,7 +4,7 @@ function rep_eva_limit_frame_plan_GetSearchParameter(fileType) { var rep_eva_limit_frame_planSearchObject = new Object(); -rep_eva_limit_frame_planSearchObject.frame_plan_guid = $("#s_rep_eva_limit_frame_plan_frame_plan_guid").val(); + rep_eva_limit_frame_planSearchObject.frame_plan_guid = getUrlParameter("id"); rep_eva_limit_frame_planSearchObject.fileType = fileType; @@ -15,7 +15,7 @@ rep_eva_limit_frame_planSearchObject.frame_plan_guid = $("#s_rep_eva_limit_frame } function rep_eva_limit_frame_plan_FeedDataToSearchForm(data) { -DropDownClearFormAndFeedWithData($("#s_rep_eva_limit_frame_plan_frame_plan_guid"), data, "id", "executed_date", "item_frame_plan_guid", data.frame_plan_guid); + DropDownClearFormAndFeedWithData($("#s_rep_eva_limit_frame_plan_frame_plan_guid"), data, "id", "executed_date", "item_frame_plan_guid", data.frame_plan_guid); } @@ -46,10 +46,11 @@ function rep_eva_limit_frame_plan_DoSearch(fileType) { var report_url = apisite + "/api/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report?" + p; - if (fileType === "pdf") { + if (fileType === "pdf") { $("#report_result").attr("src", report_url); $("#report_result").show(); //window.open(report_url); + $("#report_xModel").modal("show"); } else { $("#report_result").hide(); window.open(report_url); diff --git a/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan.js b/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan.js new file mode 100644 index 0000000..7bf9a1e --- /dev/null +++ b/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan.js @@ -0,0 +1,234 @@ +var vw_limit_frame_plan_editMode = "CREATE"; +var vw_limit_frame_plan_API = "/api/vw_limit_frame_plan/"; + +//================= Search Customizaiton ========================================= + +function vw_limit_frame_plan_GetSearchParameter() { + var vw_limit_frame_planSearchObject = new Object(); + //vw_limit_frame_planSearchObject.executed_date = formatDateForGetParameter(getDate($("#s_vw_limit_frame_plan_executed_date").val())); + + return vw_limit_frame_planSearchObject; +} + +function vw_limit_frame_plan_FeedDataToSearchForm(data) { + $("#s_vw_limit_frame_plan_executed_date").val(formatDate(data.executed_date)); + +} + +//================= Form Data Customizaiton ========================================= + +function vw_limit_frame_plan_FeedDataToForm(data) { + $("#vw_limit_frame_plan_id").val(data.id); + DropDownClearFormAndFeedWithData($("#vw_limit_frame_plan_plan_guid"), data, "id", "display_text", "item_plan_guid", data.plan_guid); + $("#vw_limit_frame_plan_executed_date").val(formatDate(data.executed_date)); + $("#vw_limit_frame_plan_limit_frame_005").val(data.limit_frame_005); + $("#vw_limit_frame_plan_salary_adjustment_date").val(formatDate(data.salary_adjustment_date)); + $("#vw_limit_frame_plan_total_salary").val(data.total_salary); + $("#vw_limit_frame_plan_limit_frame_005_total").val(data.limit_frame_005_total); + $("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(data.limit_frame_005_total_rounded); + +} + +function vw_limit_frame_plan_GetFromForm() { + var vw_limit_frame_planObject = new Object(); + vw_limit_frame_planObject.id = $("#vw_limit_frame_plan_id").val(); + vw_limit_frame_planObject.plan_guid = $("#vw_limit_frame_plan_plan_guid").val(); + vw_limit_frame_planObject.executed_date = getDate($("#vw_limit_frame_plan_executed_date").val()); + vw_limit_frame_planObject.limit_frame_005 = $("#vw_limit_frame_plan_limit_frame_005").val(); + vw_limit_frame_planObject.salary_adjustment_date = getDate($("#vw_limit_frame_plan_salary_adjustment_date").val()); + vw_limit_frame_planObject.total_salary = $("#vw_limit_frame_plan_total_salary").val(); + vw_limit_frame_planObject.limit_frame_005_total = $("#vw_limit_frame_plan_limit_frame_005_total").val(); + vw_limit_frame_planObject.limit_frame_005_total_rounded = $("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(); + + + return vw_limit_frame_planObject; +} + +function vw_limit_frame_plan_InitialForm(s) { + var successFunc = function (result) { + vw_limit_frame_plan_FeedDataToForm(result); + vw_limit_frame_plan_FeedDataToSearchForm(result); + if (s) { + // Incase model popup + $("#vw_limit_frame_planModel").modal("show"); + } + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + vw_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function vw_limit_frame_plan_GoCreate() { + // Incase model popup + vw_limit_frame_plan_SetCreateForm(true); + + // Incase open new page + //window_open(appsite + "/vw_limit_frame_planView/vw_limit_frame_plan_d"); +} + +function vw_limit_frame_plan_GoEdit(a) { + // Incase model popup + //vw_limit_frame_plan_SetEditForm(a); + + // Incase open new page + window_open(appsite + "/vw_limit_frame_planView/vw_limit_frame_plan_d?id=" + a); +} + +function vw_limit_frame_plan_SetEditForm(a) { + var successFunc = function (result) { + vw_limit_frame_plan_editMode = "UPDATE"; + vw_limit_frame_plan_FeedDataToForm(result); + $("#vw_limit_frame_planModel").modal("show"); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + vw_limit_frame_plan_API + a, successFunc, AlertDanger); +} + +function vw_limit_frame_plan_SetCreateForm(s) { + vw_limit_frame_plan_editMode = "CREATE"; + vw_limit_frame_plan_InitialForm(s); +} + +function vw_limit_frame_plan_RefreshTable() { + // Incase model popup + vw_limit_frame_plan_DoSearch(); + + // Incase open new page + //window.parent.vw_limit_frame_plan_DoSearch(); +} + +//================= Update and Delete ========================================= + +var vw_limit_frame_plan_customValidation = function (group) { + return ""; +}; + +function vw_limit_frame_plan_PutUpdate() { + if (!ValidateForm('vw_limit_frame_plan', vw_limit_frame_plan_customValidation)) { + return; + } + + var data = vw_limit_frame_plan_GetFromForm(); + + //Update Mode + if (vw_limit_frame_plan_editMode === "UPDATE") { + var successFunc1 = function (result) { + $("#vw_limit_frame_planModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + vw_limit_frame_plan_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + vw_limit_frame_plan_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + $("#vw_limit_frame_planModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + vw_limit_frame_plan_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + vw_limit_frame_plan_API, data, successFunc2, AlertDanger); + } +} + +function vw_limit_frame_plan_GoDelete(a) { + if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) { + var successFunc = function (result) { + $("#vw_limit_frame_planModel").modal("hide"); + AlertSuccess(result.code + " " + result.message); + vw_limit_frame_plan_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + vw_limit_frame_plan_API + a, null, successFunc, AlertDanger); + } +} + +//================= Data Table ========================================= + +var vw_limit_frame_planTableV; + +var vw_limit_frame_plan_setupTable = function (result) { + tmp = '"'; + vw_limit_frame_planTableV = $('#vw_limit_frame_planTable').DataTable({ + "processing": true, + "serverSide": false, + "data": result, + //"select": { + // "style": 'multi' + //}, + "columns": [ + //{ "data": "" }, + { "data": "id" }, + { "data": "plan_guid_eva_performance_plan_fiscal_year" }, + { "data": "txt_executed_date" }, + { "data": "limit_frame_005" }, + { "data": "txt_salary_adjustment_date" }, + { "data": "total_salary" }, + { "data": "limit_frame_005_total" }, + { "data": "limit_frame_005_total_rounded" }, + ], + "columnDefs": [ + { + "targets": 0, //1, + "data": "id", + "render": function (data, type, row, meta) { + return " "; + } + }, + //{ + // targets: 0, + // data: "", + // defaultContent: '', + // orderable: false, + // className: 'select-checkbox' + //} + ], + "language": { + "url": appsite + "/DataTables-1.10.16/thai.json" + }, + "paging": true, + "searching": false + }); + endLoad(); +}; + +function vw_limit_frame_plan_InitiateDataTable() { + startLoad(); + var p = $.param(vw_limit_frame_plan_GetSearchParameter()); + AjaxGetRequest(apisite + "/api/vw_limit_frame_plan/GetListBySearch?" + p, vw_limit_frame_plan_setupTable, AlertDanger); +} + +function vw_limit_frame_plan_DoSearch() { + var p = $.param(vw_limit_frame_plan_GetSearchParameter()); + var vw_limit_frame_plan_reload = function (result) { + vw_limit_frame_planTableV.destroy(); + vw_limit_frame_plan_setupTable(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + "/api/vw_limit_frame_plan/GetListBySearch?" + p, vw_limit_frame_plan_reload, AlertDanger); +} + +function vw_limit_frame_plan_GetSelect(f) { + var vw_limit_frame_plan_selectitem = []; + $.each(vw_limit_frame_planTableV.rows('.selected').data(), function (key, value) { + vw_limit_frame_plan_selectitem.push(value[f]); + }); + alert(vw_limit_frame_plan_selectitem); +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + + + diff --git a/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan_d.js b/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan_d.js new file mode 100644 index 0000000..24eec32 --- /dev/null +++ b/wwwroot/js/vw_limit_frame_plan/vw_limit_frame_plan_d.js @@ -0,0 +1,109 @@ +var vw_limit_frame_plan_editMode = "CREATE"; +var vw_limit_frame_plan_API = "/api/vw_limit_frame_plan/"; + +//================= Form Data Customizaiton ========================================= + +function vw_limit_frame_plan_FeedDataToForm(data) { + $("#vw_limit_frame_plan_id").val(data.id); + DropDownClearFormAndFeedWithData($("#vw_limit_frame_plan_plan_guid"), data, "id", "display_text", "item_plan_guid", data.plan_guid); + $("#vw_limit_frame_plan_executed_date").val(formatDate(data.executed_date)); + $("#vw_limit_frame_plan_limit_frame_005").val(data.limit_frame_005); + $("#vw_limit_frame_plan_salary_adjustment_date").val(formatDate(data.salary_adjustment_date)); + $("#vw_limit_frame_plan_total_salary").val(data.total_salary); + $("#vw_limit_frame_plan_limit_frame_005_total").val(data.limit_frame_005_total); + $("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(data.limit_frame_005_total_rounded); + +} + +function vw_limit_frame_plan_GetFromForm() { + var vw_limit_frame_planObject = new Object(); + vw_limit_frame_planObject.id = $("#vw_limit_frame_plan_id").val(); + vw_limit_frame_planObject.plan_guid = $("#vw_limit_frame_plan_plan_guid").val(); + vw_limit_frame_planObject.executed_date = getDate($("#vw_limit_frame_plan_executed_date").val()); + vw_limit_frame_planObject.limit_frame_005 = $("#vw_limit_frame_plan_limit_frame_005").val(); + vw_limit_frame_planObject.salary_adjustment_date = getDate($("#vw_limit_frame_plan_salary_adjustment_date").val()); + vw_limit_frame_planObject.total_salary = $("#vw_limit_frame_plan_total_salary").val(); + vw_limit_frame_planObject.limit_frame_005_total = $("#vw_limit_frame_plan_limit_frame_005_total").val(); + vw_limit_frame_planObject.limit_frame_005_total_rounded = $("#vw_limit_frame_plan_limit_frame_005_total_rounded").val(); + + + return vw_limit_frame_planObject; +} + +function vw_limit_frame_plan_InitialForm() { + var successFunc = function (result) { + vw_limit_frame_plan_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + vw_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Form Mode Setup and Flow ========================================= + +function vw_limit_frame_plan_SetEditForm(a) { + var successFunc = function (result) { + vw_limit_frame_plan_editMode = "UPDATE"; + vw_limit_frame_plan_FeedDataToForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + vw_limit_frame_plan_API + a, successFunc, AlertDanger); +} + +function vw_limit_frame_plan_SetCreateForm() { + vw_limit_frame_plan_editMode = "CREATE"; + vw_limit_frame_plan_InitialForm(); +} + +//================= Update and Delete ========================================= + +var vw_limit_frame_plan_customValidation = function (group) { + return ""; +}; + +function vw_limit_frame_plan_PutUpdate() { + if (!ValidateForm('vw_limit_frame_plan', vw_limit_frame_plan_customValidation)) { + return; + } + var data = vw_limit_frame_plan_GetFromForm(); + + //Update Mode + if (vw_limit_frame_plan_editMode === "UPDATE") { + var successFunc1 = function (result) { + AlertSuccess(result.code + " " + result.message); + endLoad(); + }; + startLoad(); + AjaxPutRequest(apisite + vw_limit_frame_plan_API + data.id, data, successFunc1, AlertDanger); + } + // Create mode + else { + var successFunc2 = function (result) { + AlertSuccess(result.code + " " + result.message); + endLoad(); + }; + startLoad(); + AjaxPostRequest(apisite + vw_limit_frame_plan_API, data, successFunc2, AlertDanger); + } +} + +function vw_limit_frame_plan_GoDelete(a) { + if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) { + var successFunc = function (result) { + AlertSuccess(result.code + " " + result.message); + vw_limit_frame_plan_RefreshTable(); + endLoad(); + }; + startLoad(); + AjaxDeleteRequest(apisite + vw_limit_frame_plan_API + a, null, successFunc, AlertDanger); + } +} + +//================= File Upload ========================================= + + + +//================= Multi-Selection Function ========================================= + +