เพิ่ม source code แสดงรายงาน กรอบวงเงิน
This commit is contained in:
173
ApiControllers/rep_eva_limit_frame_planControllers.cs
Normal file
173
ApiControllers/rep_eva_limit_frame_planControllers.cs
Normal file
@@ -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<rep_eva_limit_frame_planController> _logger;
|
||||
private Irep_eva_limit_frame_planService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
public rep_eva_limit_frame_planController(ILogger<rep_eva_limit_frame_planController> logger, Irep_eva_limit_frame_planService repository, IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Blank Item
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return a blank item</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[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}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download Report
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// </remarks>
|
||||
/// <returns>Return list of items by specifced keyword</returns>
|
||||
/// <response code="200">Returns the item</response>
|
||||
/// <response code="500">Error Occurred</response>
|
||||
[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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
BIN
EXCEL/eva_limit_frame_group@rep_eva_limit_frame_plan.xlsx
Normal file
BIN
EXCEL/eva_limit_frame_group@rep_eva_limit_frame_plan.xlsx
Normal file
Binary file not shown.
@@ -20,14 +20,17 @@ namespace TodoAPI2.Models
|
||||
public class eva_limit_frame_planService : Ieva_limit_frame_planService
|
||||
{
|
||||
private IBaseRepository2<eva_limit_frame_planEntity, Guid> _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<eva_limit_frame_planEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
||||
public eva_limit_frame_planService(IBaseRepository2<eva_limit_frame_planEntity, Guid> 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<List<eva_limit_frame_planViewModel>>(entities);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions
|
||||
@@ -94,12 +97,12 @@ namespace TodoAPI2.Models
|
||||
|
||||
public List<eva_limit_frame_planViewModel> 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<eva_limit_frame_planViewModel> GetListBySearch(eva_limit_frame_planSearchModel model)
|
||||
public List<eva_limit_frame_planViewModel> 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<eva_limit_frame_planInputModel> model, bool is_force_save)
|
||||
public string UpdateMultiple(List<eva_limit_frame_planInputModel> 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<string,string> GetLookupForLog()
|
||||
private Dictionary<string, string> GetLookupForLog()
|
||||
{
|
||||
var i = new Dictionary<string, string>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<eva_limit_frame_groupEntity, Guid> _repository;
|
||||
private IMyDatabase db;
|
||||
private Iexternal_linkageService ext;
|
||||
|
||||
public rep_eva_limit_frame_planService(IBaseRepository2<eva_limit_frame_groupEntity, Guid> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<Guid>
|
||||
{
|
||||
|
||||
public Guid? frame_plan_guid { get; set; }
|
||||
|
||||
public DateTime? frame_plan_guid_eva_limit_frame_plan_executed_date { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<eva_limit_frame_planEntity> item_frame_plan_guid { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -321,6 +321,8 @@ namespace Test01
|
||||
services.AddScoped<IBaseRepository2<eva_limit_frame_planEntity, Guid>, BaseRepository2<eva_limit_frame_planEntity, Guid>>();
|
||||
services.AddScoped<Ieva_limit_frame_planService, eva_limit_frame_planService>();
|
||||
|
||||
services.AddScoped<Irep_eva_limit_frame_planService, rep_eva_limit_frame_planService>();
|
||||
|
||||
#endregion
|
||||
|
||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
@@ -592,6 +594,10 @@ namespace Test01
|
||||
cfg.CreateMap<eva_limit_frame_planEntity, eva_limit_frame_planViewModel>();
|
||||
cfg.CreateMap<eva_limit_frame_planEntity, eva_limit_frame_planWithSelectionViewModel>();
|
||||
|
||||
cfg.CreateMap<rep_eva_limit_frame_planInputModel, eva_limit_frame_groupEntity>();
|
||||
cfg.CreateMap<eva_limit_frame_groupEntity, rep_eva_limit_frame_planViewModel>();
|
||||
cfg.CreateMap<eva_limit_frame_groupEntity, rep_eva_limit_frame_planWithSelectionViewModel>();
|
||||
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
66
ViewControllers/rep_eva_limit_frame_planViewControllers.cs
Normal file
66
ViewControllers/rep_eva_limit_frame_planViewControllers.cs
Normal file
@@ -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<rep_eva_limit_frame_planController> _logger;
|
||||
private Irep_eva_limit_frame_planService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
public rep_eva_limit_frame_planViewController(ILogger<rep_eva_limit_frame_planController> 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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
@using Microsoft.Extensions.Configuration
|
||||
@inject IConfiguration Configuration
|
||||
@{
|
||||
ViewData["Title"] = "rep_eva_limit_frame_plan";
|
||||
}
|
||||
|
||||
<div class="row page-title">
|
||||
<div class="col-md-5">
|
||||
<div class="page-title">
|
||||
@Configuration["SiteInformation:modulename"]
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<ol class="breadcrumb" style="">
|
||||
<li class="breadcrumb-item "><a href="javascript:window_open_from_root('@Configuration["SiteInformation:mainsite"]');">หน้าแรก</a></li>
|
||||
<li class="breadcrumb-item "><a href="javascript:window_open_from_root('@Configuration["SiteInformation:modulesite"]');">@Configuration["SiteInformation:modulename"]</a></li>
|
||||
<li class="breadcrumb-item active">รายงาน rep_eva_limit_frame_plan</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="wrapper">
|
||||
<div class="title"><div class="line"></div>รายงาน rep_eva_limit_frame_plan</div>
|
||||
<div class="tools">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label id='lab_s_rep_eva_limit_frame_plan_frame_plan_guid' for='s_rep_eva_limit_frame_plan_frame_plan_guid'>frame_plan_guid</label>
|
||||
<select class="form-control" id="s_rep_eva_limit_frame_plan_frame_plan_guid" iLabel="frame_plan_guid" iRequire="true" iGroup="s_rep_eva_limit_frame_plan" title='frame_plan_guid' placeholder='frame_plan_guid'></select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-info" onclick="javascript:rep_eva_limit_frame_plan_DoSearch('pdf');">แสดงรายงาน</button>
|
||||
<button class="btn btn-info" onclick="javascript:rep_eva_limit_frame_plan_DoSearch('xlsx');">ดาวน์โหลดเป็น Excel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br/>
|
||||
<iframe id="report_result" style="display:none; height:500px; width:100%;"></iframe>
|
||||
|
||||
@section FooterPlaceHolder{
|
||||
<script src="~/js/rep_eva_limit_frame_plan/rep_eva_limit_frame_plan_report.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
rep_eva_limit_frame_plan_InitialForm();
|
||||
SetupValidationRemark("s_rep_eva_limit_frame_plan");
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -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": "",
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan_inline.cshtml" />
|
||||
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan_report.cshtml" />
|
||||
<None Include="Views\eva_limit_frame_planView\eva_limit_frame_plan_wizardform.cshtml" />
|
||||
<None Include="Views\rep_eva_limit_frame_planView\rep_eva_limit_frame_plan_report.cshtml" />
|
||||
<None Include="wwwroot\js\eva_adjust_postponement_detail_migration\eva_adjust_postponement_detail_migration.js" />
|
||||
<None Include="wwwroot\js\eva_adjust_postponement_migration\eva_adjust_postponement_migration.js" />
|
||||
<None Include="wwwroot\js\eva_adjust_postponement_migration\eva_adjust_postponement_migration_d.js" />
|
||||
@@ -105,6 +106,7 @@
|
||||
<None Include="wwwroot\js\eva_limit_frame_plan\eva_limit_frame_plan_inline.js" />
|
||||
<None Include="wwwroot\js\eva_limit_frame_plan\eva_limit_frame_plan_report.js" />
|
||||
<None Include="wwwroot\js\eva_self_review\eva_self_review.js" />
|
||||
<None Include="wwwroot\js\rep_eva_limit_frame_plan\rep_eva_limit_frame_plan_report.js" />
|
||||
<None Include="wwwroot\js\rep_eva_self_review\rep_eva_self_review_report.js" />
|
||||
<None Include="wwwroot\js\rep_eva_self_review_all\rep_eva_self_review_all_report.js" />
|
||||
<Content Update="nlog.config">
|
||||
|
||||
126
tb320eva.xml
126
tb320eva.xml
@@ -4321,6 +4321,124 @@
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.rep_eva_limit_frame_planController},TodoAPI2.Models.Irep_eva_limit_frame_planService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
</summary>
|
||||
<param name="repository"></param>
|
||||
<param name="configuration"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.Get(System.Guid)">
|
||||
<summary>
|
||||
Get specific item by id
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return Get specific item by id</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.GetBlankItem">
|
||||
<summary>
|
||||
Get Blank Item
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return a blank item</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.GetList(System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
Get list items by frame_plan_guid
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return list of items by specifced keyword</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.GetListBySearch(TodoAPI2.Models.rep_eva_limit_frame_planSearchModel)">
|
||||
<summary>
|
||||
Get list items by search
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return list of items by specifced keyword</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.rep_eva_limit_frame_plan_report(TodoAPI2.Models.rep_eva_limit_frame_planReportRequestModel)">
|
||||
<summary>
|
||||
Download Report
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Return list of items by specifced keyword</returns>
|
||||
<response code="200">Returns the item</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.Insert(TodoAPI2.Models.rep_eva_limit_frame_planInputModel)">
|
||||
<summary>
|
||||
Create new item
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<param name="model"></param>
|
||||
<returns>Response Result Message</returns>
|
||||
<response code="200">Response Result Message</response>
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.Update(System.Guid,TodoAPI2.Models.rep_eva_limit_frame_planInputModel)">
|
||||
<summary>
|
||||
Update item
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<param name="id"></param>
|
||||
<param name="model"></param>
|
||||
<returns>Response Result Message</returns>
|
||||
<response code="200">Response Result Message</response>
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.Delete(System.Guid)">
|
||||
<summary>
|
||||
Delete item
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<param name="id"></param>
|
||||
<returns>Response Result Message</returns>
|
||||
<response code="200">Response Result Message</response>
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.UpdateMultiple(System.Collections.Generic.List{TodoAPI2.Models.rep_eva_limit_frame_planInputModel})">
|
||||
<summary>
|
||||
Update multiple item
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<param name="model"></param>
|
||||
<returns>Response Result Message</returns>
|
||||
<response code="200">Response Result Message</response>
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planController.RefreshAutoField">
|
||||
<summary>
|
||||
Refresh AutoField of all items
|
||||
</summary>
|
||||
<remarks>
|
||||
</remarks>
|
||||
<returns>Response Result Message</returns>
|
||||
<response code="200">Response Result Message</response>
|
||||
<response code="400">If the model is invalid</response>
|
||||
<response code="500">Error Occurred</response>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_self_reviewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.rep_eva_self_reviewController},TodoAPI2.Models.Irep_eva_self_reviewService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
@@ -4997,6 +5115,14 @@
|
||||
<param name="logger"></param>
|
||||
<param name="inemp"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_limit_frame_planViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.rep_eva_limit_frame_planController},TodoAPI2.Models.Irep_eva_limit_frame_planService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
</summary>
|
||||
<param name="repository"></param>
|
||||
<param name="configuration"></param>
|
||||
<param name="logger"></param>
|
||||
</member>
|
||||
<member name="M:TodoAPI2.Controllers.rep_eva_self_reviewViewController.#ctor(Microsoft.Extensions.Logging.ILogger{TodoAPI2.Controllers.rep_eva_self_reviewController},TodoAPI2.Models.Irep_eva_self_reviewService,TodoAPI2.Models.Iexternal_employeeService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
Default constructure for dependency injection
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user