diff --git a/ApiControllers/rep_eva_limit_frame_planControllers.cs b/ApiControllers/rep_eva_limit_frame_planControllers.cs new file mode 100644 index 0000000..7abfaf8 --- /dev/null +++ b/ApiControllers/rep_eva_limit_frame_planControllers.cs @@ -0,0 +1,173 @@ +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; +using iTextSharp.text; +using iTextSharp.text.pdf; + +namespace TodoAPI2.Controllers +{ + //[Authorize] + [Produces("application/json")] + [Route("api/rep_eva_limit_frame_plan")] + public class rep_eva_limit_frame_planController : BaseController + { + #region Private Variables + private ILogger _logger; + private Irep_eva_limit_frame_planService _repository; + private IConfiguration Configuration { get; set; } + #endregion + + #region Properties + + #endregion + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public rep_eva_limit_frame_planController(ILogger logger, Irep_eva_limit_frame_planService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + /// + /// Get Blank Item + /// + /// + /// + /// Return a blank item + /// Returns the item + /// Error Occurred + [HttpGet("GetBlankItem")] + [ProducesResponseType(typeof(rep_eva_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}"); + } + } + + /// + /// Download Report + /// + /// + /// + /// Return list of items by specifced keyword + /// Returns the item + /// Error Occurred + [HttpGet("rep_eva_limit_frame_plan_report")] + [ProducesResponseType(typeof(FileStreamResult), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + //[ValidateAntiForgeryToken] + public IActionResult rep_eva_limit_frame_plan_report(rep_eva_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"); + + var plan = (from q in _repository.GetContext().eva_limit_frame_plan + where q.id == model.frame_plan_guid + select q).FirstOrDefault(); + var evaplan = (from r in _repository.GetContext().eva_performance_plan + where r.id == plan.plan_guid + select r).FirstOrDefault(); + var start_plan = (from s in _repository.GetContext().eva_performance_plan_detail + where s.performance_plan_id == plan.plan_guid + select s.start_date).Min(); + var end_plan = (from s in _repository.GetContext().eva_performance_plan_detail + where s.performance_plan_id == plan.plan_guid + select s.end_date).Max(); + + model.executed_date_text = MyHelper.GetDateStringForReport(plan.executed_date); + model.salary_adjustment_date_text = MyHelper.GetDateStringForReport(plan.salary_adjustment_date); + model.intro_desc = $"ปีงบประมาณ {evaplan.fiscal_year} รอบที่ {evaplan.theTime} ระหว่างวันที่ {MyHelper.GetDateStringForReport(start_plan)} ถึงวันที่ {MyHelper.GetDateStringForReport(end_plan)}"; + model.detail_desc = $"วงเงินในการพิจารณาเงินเดือน ปี {evaplan.fiscal_year} รอบที่ {evaplan.theTime} ( {MyHelper.GetDateStringForReport(start_plan)} ถึงวันที่ {MyHelper.GetDateStringForReport(end_plan)} )"; + + var stream = new MemoryStream(); + + Document document = new Document(); + PdfCopy writer = new PdfCopy(document, stream); + document.Open(); + + string url = $"{mainurl}{reportsite}/rep_frame_intro.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + var data = httpclient.DownloadData(url); + PdfReader reader = new PdfReader(data); + reader.ConsolidateNamedDestinations(); + for (int i = 1; i <= reader.NumberOfPages; i++) + { + PdfImportedPage page = writer.GetImportedPage(reader, i); + writer.AddPage(page); + } + reader.Close(); + + var all_group = (from t in _repository.GetContext().eva_limit_frame_group + where t.frame_plan_guid == model.frame_plan_guid + select t); + foreach(var u in all_group) + { + model.group_guid = u.id; + string url2 = $"{mainurl}{reportsite}/rep_eva_frame_detail.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}"; + var data2 = httpclient.DownloadData(url2); + PdfReader reader2 = new PdfReader(data2); + reader2.ConsolidateNamedDestinations(); + for (int i = 1; i <= reader2.NumberOfPages; i++) + { + PdfImportedPage page = writer.GetImportedPage(reader2, i); + writer.AddPage(page); + } + reader2.Close(); + } + + writer.Close(); + document.Close(); + + var data3 = stream.ToArray(); + var stream3 = new MemoryStream(data3); + + return File(stream3, model.contentType); + } + catch (Exception ex) + { + _logger.LogCritical($"Exception while GetReport.", ex); + return StatusCode(500, $"{ex.Message}"); + } + } + } +} diff --git a/EXCEL/eva_limit_frame_group.xlsx b/EXCEL/eva_limit_frame_group.xlsx index b9dee0d..8f3b893 100644 Binary files a/EXCEL/eva_limit_frame_group.xlsx and b/EXCEL/eva_limit_frame_group.xlsx differ diff --git a/EXCEL/eva_limit_frame_group@rep_eva_limit_frame_plan.xlsx b/EXCEL/eva_limit_frame_group@rep_eva_limit_frame_plan.xlsx new file mode 100644 index 0000000..d1cc530 Binary files /dev/null and b/EXCEL/eva_limit_frame_group@rep_eva_limit_frame_plan.xlsx differ 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 465228d..6dd48f6 100644 --- a/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs +++ b/Models/eva_limit_frame_plan/eva_limit_frame_planService.cs @@ -20,14 +20,17 @@ namespace TodoAPI2.Models public class eva_limit_frame_planService : Ieva_limit_frame_planService { private IBaseRepository2 _repository; - private IMyDatabase db; - private Iexternal_linkageService ext; + private IMyDatabase db; + private Iexternal_linkageService ext; + private Iexternal_employeeService emp; - public eva_limit_frame_planService(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + public eva_limit_frame_planService(IBaseRepository2 repository, IMyDatabase mydb, + Iexternal_linkageService inext, Iexternal_employeeService inemp) { _repository = repository; - db = mydb; - ext = inext; + db = mydb; + ext = inext; + emp = inemp; } #region Private Functions @@ -47,7 +50,7 @@ namespace TodoAPI2.Models { return Mapper.Map>(entities); } - + #endregion #region Public Functions @@ -94,12 +97,12 @@ namespace TodoAPI2.Models public List GetListByexecuted_date(DateTime? executed_date) { - var model = new eva_limit_frame_planSearchModel(); + var model = new eva_limit_frame_planSearchModel(); model.executed_date = executed_date; return GetListBySearch(model); } - public List GetListBySearch(eva_limit_frame_planSearchModel model) + public List GetListBySearch(eva_limit_frame_planSearchModel model) { var data = ( from m_eva_limit_frame_plan in _repository.Context.eva_limit_frame_plan @@ -113,8 +116,8 @@ namespace TodoAPI2.Models from fk_external_linkageResult7 in external_linkageResult7.DefaultIfEmpty() - where - 1 == 1 + where + 1 == 1 && (!model.executed_date.HasValue || m_eva_limit_frame_plan.executed_date == model.executed_date) @@ -158,9 +161,52 @@ 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); - entity.SetAutoField(_repository.Context); - if (is_force_save) { var inserted = _repository.Insert(entity); @@ -193,7 +239,7 @@ namespace TodoAPI2.Models 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); + existingEntity.SetAutoField(_repository.Context); if (is_force_save) { @@ -209,32 +255,32 @@ namespace TodoAPI2.Models } } else - throw new NotificationException("No data to update"); + throw new NotificationException("No data to update"); } - public string UpdateMultiple(List model, bool is_force_save) + public string UpdateMultiple(List model, bool is_force_save) { - foreach(var i in model) + foreach (var i in model) { if (i.active_mode == "1" && i.id.HasValue) // update - { + { var existingEntity = _repository.Get(i.id.Value); if (existingEntity != null) { - existingEntity.plan_guid = i.plan_guid; - existingEntity.executed_date = i.executed_date; - existingEntity.limit_frame_005 = i.limit_frame_005; - existingEntity.status_self = i.status_self; - existingEntity.status_chief = i.status_chief; - existingEntity.supervisor1 = i.supervisor1; - existingEntity.supervisor1_result = i.supervisor1_result; - existingEntity.supervisor1_remark = i.supervisor1_remark; - existingEntity.supervisor1_date = i.supervisor1_date; - existingEntity.salary_adjustment_date = i.salary_adjustment_date; - existingEntity.limit_frame_005_total = i.limit_frame_005_total; - existingEntity.limit_frame_005_total_rounded = i.limit_frame_005_total_rounded; + existingEntity.plan_guid = i.plan_guid; + existingEntity.executed_date = i.executed_date; + existingEntity.limit_frame_005 = i.limit_frame_005; + existingEntity.status_self = i.status_self; + existingEntity.status_chief = i.status_chief; + existingEntity.supervisor1 = i.supervisor1; + existingEntity.supervisor1_result = i.supervisor1_result; + existingEntity.supervisor1_remark = i.supervisor1_remark; + existingEntity.supervisor1_date = i.supervisor1_date; + existingEntity.salary_adjustment_date = i.salary_adjustment_date; + 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); + existingEntity.SetAutoField(_repository.Context); _repository.UpdateWithoutCommit(i.id.Value, existingEntity); } } @@ -242,22 +288,22 @@ namespace TodoAPI2.Models { var entity = GetEntity(i); entity.id = Guid.NewGuid(); - entity.SetAutoField(_repository.Context); + 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(); } @@ -276,12 +322,25 @@ 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); return; } - public void RefreshAutoFieldOfAllData() + public void RefreshAutoFieldOfAllData() { var all_items = from i in _repository.Context.eva_limit_frame_plan select i; @@ -292,7 +351,7 @@ namespace TodoAPI2.Models _repository.Context.SaveChanges(); } - private Dictionary GetLookupForLog() + private Dictionary GetLookupForLog() { var i = new Dictionary(); @@ -313,7 +372,7 @@ namespace TodoAPI2.Models i.Add("salary_adjustment_date", "เลื่อนเงินเดือนวันที่"); i.Add("txt_salary_adjustment_date", "เลื่อนเงินเดือนวันที่"); i.Add("limit_frame_005_total", "กันวงเงินไว้"); - i.Add("limit_frame_005_total_rounded", "กันวงเงินใช้จริง"); + i.Add("limit_frame_005_total_rounded", "กันวงเงินใช้จริง"); return i; } diff --git a/Models/rep_eva_limit_frame_plan/Irep_eva_limit_frame_planService.cs b/Models/rep_eva_limit_frame_plan/Irep_eva_limit_frame_planService.cs new file mode 100644 index 0000000..50e536c --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/Irep_eva_limit_frame_planService.cs @@ -0,0 +1,22 @@ +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 Irep_eva_limit_frame_planService + { + rep_eva_limit_frame_planWithSelectionViewModel GetBlankItem(); + DataContext GetContext(); + + + + } +} + diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planInputModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planInputModel.cs new file mode 100644 index 0000000..2c505e7 --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planInputModel.cs @@ -0,0 +1,24 @@ +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 rep_eva_limit_frame_planInputModel + { + + public Guid? id { get; set; } + + public Guid? frame_plan_guid { get; set; } + + public string active_mode { get; set; } + } +} + diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planReportRequestModel.cs new file mode 100644 index 0000000..5238fc6 --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_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 rep_eva_limit_frame_planReportRequestModel : rep_eva_limit_frame_planSearchModel + { + public string filetype { get; set; } + + public string contentType { get { return MyHelper.GetContentType(filetype); } } + } +} + diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planSearchModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planSearchModel.cs new file mode 100644 index 0000000..13d2354 --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planSearchModel.cs @@ -0,0 +1,28 @@ +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 rep_eva_limit_frame_planSearchModel + { + + public Guid id { get; set; } + + public Guid? frame_plan_guid { get; set; } + + public string salary_adjustment_date_text { get; set; } + public string executed_date_text { get; set; } + public string intro_desc { get; set; } + public string detail_desc { get; set; } + public Guid? group_guid { get; set; } + } +} + diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planService.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planService.cs new file mode 100644 index 0000000..32cafa9 --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planService.cs @@ -0,0 +1,49 @@ +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 rep_eva_limit_frame_planService : Irep_eva_limit_frame_planService + { + private IBaseRepository2 _repository; + private IMyDatabase db; + private Iexternal_linkageService ext; + + public rep_eva_limit_frame_planService(IBaseRepository2 repository, IMyDatabase mydb, Iexternal_linkageService inext) + { + _repository = repository; + db = mydb; + ext = inext; + } + + public rep_eva_limit_frame_planWithSelectionViewModel GetBlankItem() + { + var i = new rep_eva_limit_frame_planWithSelectionViewModel(); + i.item_frame_plan_guid = (from x in _repository.Context.eva_limit_frame_plan select x).ToList(); + + + return i; + } + + public DataContext GetContext() + { + return _repository.Context; + } + + + } +} \ No newline at end of file diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planViewModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planViewModel.cs new file mode 100644 index 0000000..3b7703d --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planViewModel.cs @@ -0,0 +1,22 @@ +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 rep_eva_limit_frame_planViewModel : BaseViewModel2 + { + + public Guid? frame_plan_guid { get; set; } + + public DateTime? frame_plan_guid_eva_limit_frame_plan_executed_date { get; set; } + + } +} \ No newline at end of file diff --git a/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planWithSelectionViewModel.cs b/Models/rep_eva_limit_frame_plan/rep_eva_limit_frame_planWithSelectionViewModel.cs new file mode 100644 index 0000000..16eb9ce --- /dev/null +++ b/Models/rep_eva_limit_frame_plan/rep_eva_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 rep_eva_limit_frame_planWithSelectionViewModel: rep_eva_limit_frame_planViewModel + { + public List item_frame_plan_guid { get; set; } + + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs index b82ca5a..dcc7159 100644 --- a/Startup.cs +++ b/Startup.cs @@ -321,6 +321,8 @@ namespace Test01 services.AddScoped, BaseRepository2>(); services.AddScoped(); + services.AddScoped(); + #endregion services.TryAddSingleton(); @@ -592,6 +594,10 @@ namespace Test01 cfg.CreateMap(); cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); #endregion diff --git a/ViewControllers/rep_eva_limit_frame_planViewControllers.cs b/ViewControllers/rep_eva_limit_frame_planViewControllers.cs new file mode 100644 index 0000000..b96a8a1 --- /dev/null +++ b/ViewControllers/rep_eva_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 rep_eva_limit_frame_planViewController : Controller + { + private ILogger _logger; + private Irep_eva_limit_frame_planService _repository; + private IConfiguration Configuration { get; set; } + + /// + /// Default constructure for dependency injection + /// + /// + /// + /// + public rep_eva_limit_frame_planViewController(ILogger logger, Irep_eva_limit_frame_planService repository, IConfiguration configuration) + { + _logger = logger; + _repository = repository; + Configuration = configuration; + } + + // public IActionResult rep_eva_limit_frame_plan() + // { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + // } + + // public IActionResult rep_eva_limit_frame_plan_d() + // { + //if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + // return View(); + // } + + public IActionResult rep_eva_limit_frame_plan_report() + { + if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized(); // Or UnauthorizedView + return View(); + } + + //public IActionResult rep_eva_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/rep_eva_limit_frame_planView/rep_eva_limit_frame_plan_report.cshtml b/Views/rep_eva_limit_frame_planView/rep_eva_limit_frame_plan_report.cshtml new file mode 100644 index 0000000..fa3264b --- /dev/null +++ b/Views/rep_eva_limit_frame_planView/rep_eva_limit_frame_plan_report.cshtml @@ -0,0 +1,55 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration +@{ + ViewData["Title"] = "rep_eva_limit_frame_plan"; +} + +
+
+
+ @Configuration["SiteInformation:modulename"] +
+
+
+ +
+
+ +
+
รายงาน rep_eva_limit_frame_plan
+
+
+
+
+ +
+ + +
+ +
+
+
+ + +
+
+
+
+
+ + +@section FooterPlaceHolder{ + + +} + diff --git a/appsettings.Development.json b/appsettings.Development.json index a58db54..2b7e1ee 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -1,9 +1,9 @@ { "connectionStrings": { - //"mainDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;", - //"externalDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;" - "mainDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;", - "externalDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;" + "mainDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;", + "externalDBConnectionString": "Server=192.168.1.34;Port=32432;Database=tb320_hr_site2;User ID=postgres;Password=ZdPr0jects;" + //"mainDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;", + //"externalDBConnectionString": "Server=192.168.2.233;Port=5432;Database=tb320_hr_site2;User ID=postgres;Password=project0*;" }, "IdentityServer": { "url": "", diff --git a/tb320eva.csproj b/tb320eva.csproj index 77a331d..c2eea93 100644 --- a/tb320eva.csproj +++ b/tb320eva.csproj @@ -85,6 +85,7 @@ + @@ -105,6 +106,7 @@ + diff --git a/tb320eva.xml b/tb320eva.xml index b9e68df..9288550 100644 --- a/tb320eva.xml +++ b/tb320eva.xml @@ -4321,6 +4321,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 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 + + + + 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 @@ -4997,6 +5115,14 @@ + + + Default constructure for dependency injection + + + + + Default constructure for dependency injection 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 new file mode 100644 index 0000000..6cbd74d --- /dev/null +++ b/wwwroot/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js @@ -0,0 +1,58 @@ +var rep_eva_limit_frame_plan_API = "/api/rep_eva_limit_frame_plan/"; + +//================= Search Customizaiton ========================================= + +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.fileType = fileType; + + console.log(rep_eva_limit_frame_planSearchObject); + + return rep_eva_limit_frame_planSearchObject; +} + +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); + +} + +//================= Form Data Customizaiton ========================================= + +function rep_eva_limit_frame_plan_InitialForm(s) { + var successFunc = function (result) { + rep_eva_limit_frame_plan_FeedDataToSearchForm(result); + endLoad(); + }; + startLoad(); + AjaxGetRequest(apisite + rep_eva_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger); +} + +//================= Data Table ========================================= + +var s_rep_eva_limit_frame_plan_customValidation = function (group) { + return ""; +}; + + +function rep_eva_limit_frame_plan_DoSearch(fileType) { + if (!ValidateForm('s_rep_eva_limit_frame_plan', s_rep_eva_limit_frame_plan_customValidation)) { + return; + } + + var p = $.param(rep_eva_limit_frame_plan_GetSearchParameter(fileType)); + + var report_url = apisite + "/api/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report?" + p; + + if (fileType === "pdf") { + $("#report_result").attr("src", report_url); + $("#report_result").show(); + //window.open(report_url); + } else { + $("#report_result").hide(); + window.open(report_url); + } +} +