ปรับปรุงเฉพาะส่วนที่เกี่ยวกับรายงาน และการประมวลผล
This commit is contained in:
@@ -138,7 +138,13 @@ namespace TodoAPI2.Controllers
|
|||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
||||||
var all_group = (from t in _repository.GetContext().eva_limit_frame_group
|
var all_group = (from t in _repository.GetContext().eva_limit_frame_group
|
||||||
|
|
||||||
|
join fk_eva_evaluation_group2 in _repository.GetContext().eva_evaluation_group on t.group_guid equals fk_eva_evaluation_group2.id
|
||||||
|
into eva_evaluation_groupResult2
|
||||||
|
from fk_eva_evaluation_groupResult2 in eva_evaluation_groupResult2.DefaultIfEmpty()
|
||||||
|
|
||||||
where t.frame_plan_guid == model.frame_plan_guid
|
where t.frame_plan_guid == model.frame_plan_guid
|
||||||
|
orderby fk_eva_evaluation_groupResult2.code
|
||||||
select t);
|
select t);
|
||||||
foreach(var u in all_group)
|
foreach(var u in all_group)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ namespace TodoAPI2.Models
|
|||||||
private IBaseRepository2<eva_limit_frame_groupEntity, Guid> _repository;
|
private IBaseRepository2<eva_limit_frame_groupEntity, Guid> _repository;
|
||||||
private IMyDatabase db;
|
private IMyDatabase db;
|
||||||
private Iexternal_linkageService ext;
|
private Iexternal_linkageService ext;
|
||||||
|
private Iexternal_employeeService emp;
|
||||||
|
|
||||||
public eva_limit_frame_groupService(IBaseRepository2<eva_limit_frame_groupEntity, Guid> repository, IMyDatabase mydb, Iexternal_linkageService inext)
|
public eva_limit_frame_groupService(IBaseRepository2<eva_limit_frame_groupEntity, Guid> repository,
|
||||||
|
IMyDatabase mydb, Iexternal_linkageService inext, Iexternal_employeeService inemp)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
db = mydb;
|
db = mydb;
|
||||||
ext = inext;
|
ext = inext;
|
||||||
|
emp = inemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Private Functions
|
#region Private Functions
|
||||||
@@ -172,6 +175,18 @@ namespace TodoAPI2.Models
|
|||||||
public eva_limit_frame_groupViewModel Update(Guid id, eva_limit_frame_groupInputModel model, bool is_force_save)
|
public eva_limit_frame_groupViewModel Update(Guid id, eva_limit_frame_groupInputModel model, bool is_force_save)
|
||||||
{
|
{
|
||||||
var existingEntity = _repository.Get(id);
|
var existingEntity = _repository.Get(id);
|
||||||
|
|
||||||
|
var plan = (from i in _repository.Context.eva_limit_frame_plan where i.plan_guid == existingEntity.frame_plan_guid select i).FirstOrDefault();
|
||||||
|
|
||||||
|
var all_all_emp = emp.GetAllEmployee();
|
||||||
|
var mapping_dept = emp.GetDeptMapping();
|
||||||
|
var working_record = from i in emp.GetWorkingRecord()
|
||||||
|
// where
|
||||||
|
//plan.executed_date.HasValue
|
||||||
|
//&& i.start_date <= plan.executed_date
|
||||||
|
//&& i.end_date >= plan.executed_date
|
||||||
|
select i;
|
||||||
|
|
||||||
if (existingEntity != null)
|
if (existingEntity != null)
|
||||||
{
|
{
|
||||||
existingEntity.frame_plan_guid = model.frame_plan_guid;
|
existingEntity.frame_plan_guid = model.frame_plan_guid;
|
||||||
@@ -182,7 +197,24 @@ namespace TodoAPI2.Models
|
|||||||
existingEntity.total_salary_limit_rounded = model.total_salary_limit_rounded;
|
existingEntity.total_salary_limit_rounded = model.total_salary_limit_rounded;
|
||||||
existingEntity.remark = model.remark;
|
existingEntity.remark = model.remark;
|
||||||
|
|
||||||
existingEntity.SetAutoField(_repository.Context);
|
foreach (var y in from z in _repository.Context.eva_limit_frame_employee where z.frame_group_guid == model.id orderby z.order_of_data select z)
|
||||||
|
{
|
||||||
|
int j = 1;
|
||||||
|
if (y.help_org_id.HasValue)
|
||||||
|
{
|
||||||
|
var theemp = (from q in all_all_emp where q.id == y.employee_id select q).FirstOrDefault();
|
||||||
|
var thedetail = (from r in working_record where r.employee_id == y.employee_id select r).FirstOrDefault();
|
||||||
|
var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault();
|
||||||
|
if (theemp != null && thedetail != null && help_at != null)
|
||||||
|
{
|
||||||
|
if (model.remark != "") existingEntity.remark += "\n";
|
||||||
|
existingEntity.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}";
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
existingEntity.SetAutoField(_repository.Context);
|
||||||
|
|
||||||
if (is_force_save)
|
if (is_force_save)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -276,6 +276,15 @@ namespace TodoAPI2.Models
|
|||||||
public vw_limit_frame_planViewModel Update(Guid id, vw_limit_frame_planInputModel model, bool is_force_save)
|
public vw_limit_frame_planViewModel Update(Guid id, vw_limit_frame_planInputModel model, bool is_force_save)
|
||||||
{
|
{
|
||||||
var existingEntity = _repository.Get(id);
|
var existingEntity = _repository.Get(id);
|
||||||
|
var all_all_emp = emp.GetAllEmployee();
|
||||||
|
var mapping_dept = emp.GetDeptMapping();
|
||||||
|
var working_record = from i in emp.GetWorkingRecord()
|
||||||
|
where
|
||||||
|
model.executed_date.HasValue
|
||||||
|
&& i.start_date <= model.executed_date
|
||||||
|
&& i.end_date >= model.executed_date
|
||||||
|
select i;
|
||||||
|
|
||||||
if (existingEntity != null)
|
if (existingEntity != null)
|
||||||
{
|
{
|
||||||
existingEntity.plan_guid = model.plan_guid;
|
existingEntity.plan_guid = model.plan_guid;
|
||||||
@@ -286,6 +295,27 @@ namespace TodoAPI2.Models
|
|||||||
existingEntity.limit_frame_005_total = model.limit_frame_005_total;
|
existingEntity.limit_frame_005_total = model.limit_frame_005_total;
|
||||||
existingEntity.limit_frame_005_total_rounded = model.limit_frame_005_total_rounded;
|
existingEntity.limit_frame_005_total_rounded = model.limit_frame_005_total_rounded;
|
||||||
|
|
||||||
|
foreach (var x in from i in _repository.Context.eva_limit_frame_group where i.frame_plan_guid == id select i)
|
||||||
|
{
|
||||||
|
x.remark = "";
|
||||||
|
foreach (var y in from z in _repository.Context.eva_limit_frame_employee where z.frame_group_guid == x.id orderby z.order_of_data select z)
|
||||||
|
{
|
||||||
|
int j = 1;
|
||||||
|
if (y.help_org_id.HasValue)
|
||||||
|
{
|
||||||
|
var theemp = (from q in all_all_emp where q.id == y.employee_id select q).FirstOrDefault();
|
||||||
|
var thedetail = (from r in working_record where r.employee_id == y.employee_id select r).FirstOrDefault();
|
||||||
|
var help_at = (from s in mapping_dept where s.id == thedetail.place select s).FirstOrDefault();
|
||||||
|
if (theemp != null && thedetail != null && help_at != null)
|
||||||
|
{
|
||||||
|
if (x.remark != "") x.remark += "\n";
|
||||||
|
x.remark += $"{j}.ในลำดับที่ {y.order_of_data} {theemp.fullname} ตำแหน่ง{theemp.position_name} {theemp.department_name} \nมาช่วยปฏิบัติงานที่{help_at.department_name} ตั้งแต่วันที่ {MyHelper.GetDateStringForReport(thedetail.start_date)} - {MyHelper.GetDateStringForReport(thedetail.end_date)} \nตาม{thedetail.subject}";
|
||||||
|
}
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
existingEntity.SetAutoField(_repository.Context);
|
existingEntity.SetAutoField(_repository.Context);
|
||||||
|
|
||||||
if (is_force_save)
|
if (is_force_save)
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ function eva_limit_frame_group_PutUpdate() {
|
|||||||
if (eva_limit_frame_group_editMode === "UPDATE") {
|
if (eva_limit_frame_group_editMode === "UPDATE") {
|
||||||
var successFunc1 = function (result) {
|
var successFunc1 = function (result) {
|
||||||
AlertSuccess(result.code + " " + result.message);
|
AlertSuccess(result.code + " " + result.message);
|
||||||
|
window.location.reload();
|
||||||
endLoad();
|
endLoad();
|
||||||
};
|
};
|
||||||
startLoad();
|
startLoad();
|
||||||
|
|||||||
Reference in New Issue
Block a user