Merge branch 'develop' into task/173
# Conflicts: # BMA.EHR.Leave/Controllers/LeaveController.cs
This commit is contained in:
commit
559765dd86
25 changed files with 987 additions and 114 deletions
|
|
@ -280,7 +280,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Where(x => x.KeycloakUserId == keycloakUserId);
|
||||
|
||||
if (year != 0)
|
||||
rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
{
|
||||
var startFiscalDate = new DateTime(year - 1, 10, 1);
|
||||
var endFiscalDate = new DateTime(year, 9, 30);
|
||||
rawData = rawData.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate);
|
||||
}
|
||||
//rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
|
||||
if (type != Guid.Empty)
|
||||
rawData = rawData.Where(x => x.Type.Id == type);
|
||||
|
|
@ -565,7 +570,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
// TODO : Update ไปตาราง beginning
|
||||
if (data.ApproveStep == "st4") // ถ้ามีการอนุมัติจากผู้มีอำนาจแล้ว
|
||||
{
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(data.LeaveStartDate.Year, data.Type.Id, data.KeycloakUserId, -1 * data.LeaveTotal);
|
||||
|
||||
var toDay = data.LeaveStartDate.Date;
|
||||
var thisYear = data.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(thisYear, data.Type.Id, data.KeycloakUserId, -1 * data.LeaveTotal);
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{data.Id}";
|
||||
|
|
@ -630,7 +642,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
// TODO : Update ไปตาราง beginning
|
||||
if (rawData.ApproveStep == "st4") // ถ้ามีการอนุมัติจากผู้มีอำนาจแล้ว
|
||||
{
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(rawData.LeaveStartDate.Year, rawData.Type.Id, rawData.KeycloakUserId, -1 * rawData.LeaveTotal);
|
||||
|
||||
var toDay = rawData.LeaveStartDate.Date;
|
||||
var thisYear = rawData.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(thisYear, rawData.Type.Id, rawData.KeycloakUserId, -1 * rawData.LeaveTotal);
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
||||
|
|
@ -1089,8 +1109,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
await UpdateWithTrackingAsync(rawData);
|
||||
|
||||
var toDay = rawData.LeaveStartDate.Date;
|
||||
var thisYear = rawData.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
|
||||
// TODO : Update ไปตาราง beginning
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(rawData.LeaveStartDate.Year, rawData.Type.Id, rawData.KeycloakUserId, rawData.LeaveTotal);
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(thisYear, rawData.Type.Id, rawData.KeycloakUserId, rawData.LeaveTotal);
|
||||
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
|
|
@ -1526,10 +1553,21 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var organizationName = $"{org.Root ?? ""}{(!string.IsNullOrEmpty(org.Child1) ? "/" + org.Child1 : "")}{(!string.IsNullOrEmpty(org.Child2) ? "/" + org.Child2 : "")}{(!string.IsNullOrEmpty(org.Child3) ? "/" + org.Child3 : "")}{(!string.IsNullOrEmpty(org.Child4) ? "/" + org.Child4 : "")}";
|
||||
if (data.Count > 0)
|
||||
{
|
||||
var res = (from d in data
|
||||
var grouped = data.GroupBy(d => nodeByReq switch
|
||||
{
|
||||
0 => d.Root,
|
||||
1 => d.Child1,
|
||||
2 => d.Child2,
|
||||
3 => d.Child3,
|
||||
4 => d.Child4,
|
||||
_ => d.Root
|
||||
});
|
||||
var res = (/*from d in data
|
||||
group d by new { d.Root, d.Child1, d.Child2, d.Child3, d.Child4 } into grp
|
||||
orderby grp.Key.Root, grp.Key.Child1, grp.Key.Child2, grp.Key.Child3, grp.Key.Child4
|
||||
select new GetSumApproveLeaveByRootDto
|
||||
orderby grp.Key.Root, grp.Key.Child1, grp.Key.Child2, grp.Key.Child3, grp.Key.Child4*/
|
||||
from grp in grouped
|
||||
orderby grp.Key
|
||||
select new GetSumApproveLeaveByRootDto
|
||||
{
|
||||
//Root = $"{grp.Key.Root}{(!string.IsNullOrEmpty(grp.Key.Child1) ? "/" + grp.Key.Child1 : "")}{(!string.IsNullOrEmpty(grp.Key.Child2) ? "/" + grp.Key.Child2 : "")}{(!string.IsNullOrEmpty(grp.Key.Child3) ? "/" + grp.Key.Child3 : "")}{(!string.IsNullOrEmpty(grp.Key.Child4) ? "/" + grp.Key.Child4 : "")}",
|
||||
Root = organizationName,
|
||||
|
|
|
|||
|
|
@ -202,9 +202,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync(Guid keycloakId, int year, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var fiscalDateStart = new DateTime(year - 1, 10, 1);
|
||||
var fiscalDateEnd = new DateTime(year, 9, 30);
|
||||
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Year == year)
|
||||
.Where(u => u.CheckIn.Date >= fiscalDateStart && u.CheckIn.Date <= fiscalDateEnd)
|
||||
.OrderByDescending(u => u.CheckIn.Date)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@ using BMA.EHR.Infrastructure.Persistence;
|
|||
// using BMA.EHR.Placement.Service.Requests;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Claims;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||
{
|
||||
|
|
@ -133,6 +134,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
where x.Title.Contains(keyword) ||
|
||||
(x.Appellant == null ? false : x.Appellant.Contains(keyword))
|
||||
select x).ToList();
|
||||
|
||||
if (status.Trim().ToUpper() != "ALL")
|
||||
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
|
|
@ -165,7 +167,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
|
|
@ -179,11 +181,75 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
Status = x.Status,//สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)
|
||||
Result = x.Result,
|
||||
})
|
||||
.OrderByDescending(x => x.DateConsideration)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
});
|
||||
|
||||
bool desc = req.descending ?? false;
|
||||
if (!string.IsNullOrEmpty(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy)
|
||||
{
|
||||
case "title":
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
break;
|
||||
|
||||
case "respondentType":
|
||||
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||
: query.OrderBy(x => x.RespondentType);
|
||||
break;
|
||||
|
||||
case "appellant":
|
||||
query = desc ? query.OrderByDescending(x => x.Appellant)
|
||||
: query.OrderBy(x => x.Appellant);
|
||||
break;
|
||||
|
||||
case "offenseDetails":
|
||||
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||
: query.OrderBy(x => x.OffenseDetails);
|
||||
break;
|
||||
|
||||
case "createdAt":
|
||||
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||
: query.OrderBy(x => x.CreatedAt);
|
||||
break;
|
||||
|
||||
case "levelConsideration":
|
||||
query = desc ? query.OrderByDescending(x => x.LevelConsideration)
|
||||
: query.OrderBy(x => x.LevelConsideration);
|
||||
break;
|
||||
|
||||
case "dateConsideration":
|
||||
query = desc ? query.OrderByDescending(x => x.DateConsideration)
|
||||
: query.OrderBy(x => x.DateConsideration);
|
||||
break;
|
||||
|
||||
case "dateReceived":
|
||||
query = desc ? query.OrderByDescending(x => x.DateReceived)
|
||||
: query.OrderBy(x => x.DateReceived);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
query = desc ? query.OrderByDescending(x => x.Status)
|
||||
: query.OrderBy(x => x.Status);
|
||||
break;
|
||||
|
||||
case "result":
|
||||
query = desc ? query.OrderByDescending(x => x.Result)
|
||||
: query.OrderBy(x => x.Result);
|
||||
break;
|
||||
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.DateConsideration);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("admin")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDisciplineAdmin(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetDisciplineAdmin(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_APPEAL");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -821,7 +821,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
data_search = data_search
|
||||
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
|
||||
}
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
|
|
@ -837,12 +837,76 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
ProfileId = x.ProfileId,
|
||||
LastUpdatedAt = x.LastUpdatedAt,
|
||||
profileType = x.profileType
|
||||
})
|
||||
.OrderByDescending(x => x.profileType)
|
||||
.ThenByDescending(x => x.LastUpdatedAt)
|
||||
});
|
||||
bool desc = descending ?? false;
|
||||
if (!string.IsNullOrEmpty(sortBy))
|
||||
{
|
||||
switch (sortBy)
|
||||
{
|
||||
case "title":
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
break;
|
||||
|
||||
case "description":
|
||||
query = desc ? query.OrderByDescending(x => x.Description)
|
||||
: query.OrderBy(x => x.Description);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
query = desc ? query.OrderByDescending(x => x.Status)
|
||||
: query.OrderBy(x => x.Status);
|
||||
break;
|
||||
|
||||
case "type":
|
||||
query = desc ? query.OrderByDescending(x => x.Type)
|
||||
: query.OrderBy(x => x.Type);
|
||||
break;
|
||||
|
||||
case "year":
|
||||
query = desc ? query.OrderByDescending(x => x.Year)
|
||||
: query.OrderBy(x => x.Year);
|
||||
break;
|
||||
|
||||
case "caseType":
|
||||
query = desc ? query.OrderByDescending(x => x.CaseType)
|
||||
: query.OrderBy(x => x.CaseType);
|
||||
break;
|
||||
|
||||
case "caseNumber":
|
||||
query = desc ? query.OrderByDescending(x => x.CaseNumber)
|
||||
: query.OrderBy(x => x.CaseNumber);
|
||||
break;
|
||||
|
||||
case "fullname":
|
||||
query = desc ? query.OrderByDescending(x => x.Fullname)
|
||||
: query.OrderBy(x => x.Fullname);
|
||||
break;
|
||||
|
||||
case "lastUpdatedAt":
|
||||
query = desc ? query.OrderByDescending(x => x.LastUpdatedAt)
|
||||
: query.OrderBy(x => x.LastUpdatedAt);
|
||||
break;
|
||||
|
||||
case "profileType":
|
||||
query = desc ? query.OrderByDescending(x => x.profileType)
|
||||
: query.OrderBy(x => x.profileType);
|
||||
break;
|
||||
|
||||
default:
|
||||
query = query
|
||||
.OrderByDescending(x => x.profileType)
|
||||
.ThenByDescending(x => x.LastUpdatedAt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{path}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(string path, int page = 1, int pageSize = 25, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetDiscipline(string path, int page = 1, int pageSize = 25, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
// สิทธิ์การเข้าถึง
|
||||
path = path.Trim().ToUpper();
|
||||
|
|
@ -105,7 +105,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
x.Qualification.Contains(keyword)) &&
|
||||
(_permiss != "OWNER" && x.RootDnaId == profile.RootDnaId || _permiss == "OWNER" && true)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
|
|
@ -118,7 +118,66 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
|
|||
Qualification = x.Qualification,
|
||||
TotalInvestigate = x.DisciplineInvestigate_Directors.Count(),
|
||||
TotalDisciplinary = x.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
})
|
||||
});
|
||||
|
||||
bool desc = descending ?? false;
|
||||
if (!string.IsNullOrEmpty(sortBy))
|
||||
{
|
||||
if (sortBy == "position")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Position)
|
||||
: query.OrderBy(x => x.Position);
|
||||
}
|
||||
else if (sortBy == "prefix" || sortBy == "firstName" || sortBy == "lastName")
|
||||
{
|
||||
query = desc ?
|
||||
query
|
||||
//.OrderByDescending(x => x.Prefix)
|
||||
.OrderByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName) :
|
||||
query
|
||||
//.OrderBy(x => x.Prefix)
|
||||
.OrderBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName);
|
||||
}
|
||||
else if (sortBy == "email")
|
||||
{
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Email)
|
||||
: query.OrderBy(x => x.Email);
|
||||
}
|
||||
}
|
||||
else if (sortBy == "phone")
|
||||
{
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Phone)
|
||||
: query.OrderBy(x => x.Phone);
|
||||
}
|
||||
}
|
||||
else if (sortBy == "qualification")
|
||||
{
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Qualification)
|
||||
: query.OrderBy(x => x.Qualification);
|
||||
}
|
||||
}
|
||||
else if (sortBy == "totalInvestigate")
|
||||
{
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.TotalInvestigate)
|
||||
: query.OrderBy(x => x.TotalInvestigate);
|
||||
}
|
||||
}
|
||||
else if (sortBy == "totalDisciplinary")
|
||||
{
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.TotalDisciplinary)
|
||||
: query.OrderBy(x => x.TotalDisciplinary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
|
|
@ -179,11 +179,75 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องสอบสวน
|
||||
DisciplinaryDateStart = x.DisciplinaryDateStart, //วันที่เริ่มการสอบสวน
|
||||
DisciplinaryDateEnd = x.DisciplinaryDateEnd, //วันที่สิ้นสุดการสอบสวน
|
||||
})
|
||||
.OrderByDescending(x => x.DisciplinaryDateStart)
|
||||
});
|
||||
|
||||
bool desc = req.descending ?? false;
|
||||
if (!string.IsNullOrEmpty(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy)
|
||||
{
|
||||
case "title":
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
break;
|
||||
|
||||
case "respondentType":
|
||||
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||
: query.OrderBy(x => x.RespondentType);
|
||||
break;
|
||||
|
||||
case "offenseDetails":
|
||||
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||
: query.OrderBy(x => x.OffenseDetails);
|
||||
break;
|
||||
|
||||
case "disciplinaryFaultLevel":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryFaultLevel)
|
||||
: query.OrderBy(x => x.DisciplinaryFaultLevel);
|
||||
break;
|
||||
|
||||
case "disciplinaryCaseFault":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryCaseFault)
|
||||
: query.OrderBy(x => x.DisciplinaryCaseFault);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
query = desc ? query.OrderByDescending(x => x.Status)
|
||||
: query.OrderBy(x => x.Status);
|
||||
break;
|
||||
|
||||
case "dateReceived":
|
||||
query = desc ? query.OrderByDescending(x => x.DateReceived)
|
||||
: query.OrderBy(x => x.DateReceived);
|
||||
break;
|
||||
|
||||
case "createdAt":
|
||||
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||
: query.OrderBy(x => x.CreatedAt);
|
||||
break;
|
||||
|
||||
case "disciplinaryDateStart":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateStart)
|
||||
: query.OrderBy(x => x.DisciplinaryDateStart);
|
||||
break;
|
||||
|
||||
case "disciplinaryDateEnd":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateEnd)
|
||||
: query.OrderBy(x => x.DisciplinaryDateEnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.DisciplinaryDateStart);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
|
|
@ -174,11 +174,76 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องสืบสวน
|
||||
InvestigationDetail = x.InvestigationDetail,
|
||||
InvestigationStatusResult = x.InvestigationStatusResult,
|
||||
})
|
||||
.OrderByDescending(x => x.InvestigationDateStart)
|
||||
});
|
||||
|
||||
bool desc = req.descending ?? false;
|
||||
if (!string.IsNullOrEmpty(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy)
|
||||
{
|
||||
case "title":
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
break;
|
||||
|
||||
case "respondentType":
|
||||
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||
: query.OrderBy(x => x.RespondentType);
|
||||
break;
|
||||
|
||||
case "offenseDetails":
|
||||
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||
: query.OrderBy(x => x.OffenseDetails);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
query = desc ? query.OrderByDescending(x => x.Status)
|
||||
: query.OrderBy(x => x.Status);
|
||||
break;
|
||||
|
||||
case "investigationDateStart":
|
||||
query = desc ? query.OrderByDescending(x => x.InvestigationDateStart)
|
||||
: query.OrderBy(x => x.InvestigationDateStart);
|
||||
break;
|
||||
|
||||
case "investigationDateEnd":
|
||||
query = desc ? query.OrderByDescending(x => x.InvestigationDateEnd)
|
||||
: query.OrderBy(x => x.InvestigationDateEnd);
|
||||
break;
|
||||
|
||||
case "dateReceived":
|
||||
query = desc ? query.OrderByDescending(x => x.DateReceived)
|
||||
: query.OrderBy(x => x.DateReceived);
|
||||
break;
|
||||
|
||||
case "createdAt":
|
||||
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||
: query.OrderBy(x => x.CreatedAt);
|
||||
break;
|
||||
|
||||
case "investigationDetail":
|
||||
query = desc ? query.OrderByDescending(x => x.InvestigationDetail)
|
||||
: query.OrderBy(x => x.InvestigationDetail);
|
||||
break;
|
||||
|
||||
case "investigationStatusResult":
|
||||
query = desc ? query.OrderByDescending(x => x.InvestigationStatusResult)
|
||||
: query.OrderBy(x => x.InvestigationStatusResult);
|
||||
break;
|
||||
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.InvestigationDateStart);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.ToList();
|
||||
}
|
||||
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
|
|
@ -209,11 +209,90 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
ResultDisciplineType = x.ResultDisciplineType,//หน่วยงาย/ส่วนราชการ
|
||||
ResultTitleType = x.ResultTitleType,//ประเภทของเรื่อง
|
||||
ResultYear = x.ResultYear,//ปีงบประมาณ
|
||||
})
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
});
|
||||
|
||||
bool desc = req.descending ?? false;
|
||||
if (!string.IsNullOrEmpty(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy)
|
||||
{
|
||||
case "title":
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
break;
|
||||
|
||||
case "respondentType":
|
||||
query = desc ? query.OrderByDescending(x => x.RespondentType)
|
||||
: query.OrderBy(x => x.RespondentType);
|
||||
break;
|
||||
|
||||
case "offenseDetails":
|
||||
query = desc ? query.OrderByDescending(x => x.OffenseDetails)
|
||||
: query.OrderBy(x => x.OffenseDetails);
|
||||
break;
|
||||
|
||||
case "disciplinaryFaultLevel":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryFaultLevel)
|
||||
: query.OrderBy(x => x.DisciplinaryFaultLevel);
|
||||
break;
|
||||
|
||||
case "disciplinaryCaseFault":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryCaseFault)
|
||||
: query.OrderBy(x => x.DisciplinaryCaseFault);
|
||||
break;
|
||||
|
||||
case "status":
|
||||
query = desc ? query.OrderByDescending(x => x.Status)
|
||||
: query.OrderBy(x => x.Status);
|
||||
break;
|
||||
|
||||
case "createdAt":
|
||||
query = desc ? query.OrderByDescending(x => x.CreatedAt)
|
||||
: query.OrderBy(x => x.CreatedAt);
|
||||
break;
|
||||
|
||||
case "disciplinaryDateStart":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateStart)
|
||||
: query.OrderBy(x => x.DisciplinaryDateStart);
|
||||
break;
|
||||
|
||||
case "disciplinaryDateEnd":
|
||||
query = desc ? query.OrderByDescending(x => x.DisciplinaryDateEnd)
|
||||
: query.OrderBy(x => x.DisciplinaryDateEnd);
|
||||
break;
|
||||
|
||||
case "resultOc":
|
||||
query = desc ? query.OrderByDescending(x => x.ResultOc)
|
||||
: query.OrderBy(x => x.ResultOc);
|
||||
break;
|
||||
|
||||
case "resultDisciplineType":
|
||||
query = desc ? query.OrderByDescending(x => x.ResultDisciplineType)
|
||||
: query.OrderBy(x => x.ResultDisciplineType);
|
||||
break;
|
||||
|
||||
case "resultTitleType":
|
||||
query = desc ? query.OrderByDescending(x => x.ResultTitleType)
|
||||
: query.OrderBy(x => x.ResultTitleType);
|
||||
break;
|
||||
|
||||
case "resultYear":
|
||||
query = desc ? query.OrderByDescending(x => x.ResultYear)
|
||||
: query.OrderBy(x => x.ResultYear);
|
||||
break;
|
||||
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.CreatedAt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ using BMA.EHR.Infrastructure.Persistence;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
||||
|
|
@ -58,7 +59,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(DateTime? startDate, DateTime? endDate, int page = 1, int pageSize = 25, string keyword = "", string profileType = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(DateTime? startDate, DateTime? endDate, int page = 1, int pageSize = 25, string keyword = "", string profileType = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_SUSPENDED");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -94,7 +95,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
(profileType.ToUpper() == "EMPLOYEE" && x.profileType == "EMPLOYEE")
|
||||
)
|
||||
select x).ToList();
|
||||
var data = data_search
|
||||
var query = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
|
|
@ -145,13 +146,76 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด
|
||||
profileType = x.profileType,
|
||||
CreatedAt = x.CreatedAt,
|
||||
})
|
||||
.OrderByDescending(x => x.profileType)
|
||||
.ThenByDescending(x => x.CreatedAt)
|
||||
.ThenByDescending(x => x.CitizenId)
|
||||
});
|
||||
|
||||
bool desc = descending ?? false;
|
||||
if (!string.IsNullOrEmpty(sortBy))
|
||||
{
|
||||
if (sortBy == "title")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Title)
|
||||
: query.OrderBy(x => x.Title);
|
||||
}
|
||||
else if (sortBy == "prefix" || sortBy == "firstName" || sortBy == "lastName")
|
||||
{
|
||||
query = desc ?
|
||||
query
|
||||
//.OrderByDescending(x => x.Prefix)
|
||||
.OrderByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName) :
|
||||
query
|
||||
//.OrderBy(x => x.Prefix)
|
||||
.OrderBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName);
|
||||
}
|
||||
else if (sortBy == "position")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Position)
|
||||
: query.OrderBy(x => x.Position);
|
||||
}
|
||||
else if (sortBy == "positionType" || sortBy == "positionLevel")
|
||||
{
|
||||
query = desc ?
|
||||
query
|
||||
.OrderByDescending(x => x.PositionType)
|
||||
.ThenByDescending(x => x.PositionLevel) :
|
||||
query
|
||||
.OrderBy(x => x.PositionType)
|
||||
.ThenBy(x => x.PositionLevel);
|
||||
}
|
||||
else if (sortBy == "organization")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.Organization)
|
||||
: query.OrderBy(x => x.Organization);
|
||||
}
|
||||
else if (sortBy == "startDateSuspend")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.StartDateSuspend)
|
||||
: query.OrderBy(x => x.StartDateSuspend);
|
||||
}
|
||||
else if (sortBy == "endDateSuspend")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.EndDateSuspend)
|
||||
: query.OrderBy(x => x.EndDateSuspend);
|
||||
}
|
||||
else if (sortBy == "descriptionSuspend")
|
||||
{
|
||||
query = desc ? query.OrderByDescending(x => x.DescriptionSuspend)
|
||||
: query.OrderBy(x => x.DescriptionSuspend);
|
||||
}
|
||||
else
|
||||
{
|
||||
query = query.OrderByDescending(x => x.profileType)
|
||||
.ThenByDescending(x => x.CreatedAt)
|
||||
.ThenByDescending(x => x.CitizenId);
|
||||
}
|
||||
}
|
||||
|
||||
var data = query
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public string? levelConsideration { get; set; } // ระดับการพิจารณา
|
||||
public DateTime? dateConsiderationStart { get; set; } // วันที่เริ่มต้นการพิจารณา
|
||||
public DateTime? dateConsiderationEnd { get; set; } // วันที่สิ้นสุดการพิจารณา
|
||||
public string? sortBy { get; set; }
|
||||
public bool? descending { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public DateTime? disciplinaryDateEnd { get; set; } // วันที่สิ้นสุดสอบสวน
|
||||
public DateTime? dateReceivedStart { get; set; } // วันที่เริ่มต้นรับเรื่อง
|
||||
public DateTime? dateReceivedEnd { get; set; } // วันที่สิ้นสุดรับเรื่อง
|
||||
public string? sortBy { get; set; }
|
||||
public bool? descending { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public DateTime? dateReceivedStart { get; set; } // วันที่เริ่มต้นรับเรื่อง
|
||||
public DateTime? dateReceivedEnd { get; set; } // วันที่สิ้นสุดรับเรื่อง
|
||||
public string? investigationStatusResult { get; set; } // ผลการสืบสวน
|
||||
public string? sortBy { get; set; }
|
||||
public bool? descending { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public string? resultTitleType { get; set; } // ประเภทของเรื่อง
|
||||
public string? resultOc { get; set; } // หน่วยงาน/ส่วนราชการ
|
||||
public int? resultYear { get; set; } // ปีงบประมาณ
|
||||
public string? sortBy { get; set; }
|
||||
public bool? descending { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,25 +33,25 @@ public class InsigniaRequestProcessService : BackgroundService
|
|||
|
||||
#endregion
|
||||
|
||||
public override async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var client = new SocketIO("https://bma-ehr.frappet.synology.me/api/v1/org-socket",
|
||||
new SocketIOOptions
|
||||
{
|
||||
// เพิ่ม token ใน handshake.auth
|
||||
Auth = new { token = AccessToken ?? "" }
|
||||
});
|
||||
//public override async Task StartAsync(CancellationToken cancellationToken)
|
||||
//{
|
||||
//var client = new SocketIO("https://bma-ehr.frappet.synology.me/api/v1/org-socket",
|
||||
// new SocketIOOptions
|
||||
// {
|
||||
// // เพิ่ม token ใน handshake.auth
|
||||
// Auth = new { token = AccessToken ?? "" }
|
||||
// });
|
||||
|
||||
client.OnConnected += async (sender, e) =>
|
||||
{
|
||||
Console.WriteLine("Connected to Socket.IO server");
|
||||
await client.EmitAsync("eventName", "Hello from .NET client");
|
||||
};
|
||||
//client.OnConnected += async (sender, e) =>
|
||||
//{
|
||||
// Console.WriteLine("Connected to Socket.IO server");
|
||||
// await client.EmitAsync("eventName", "Hello from .NET client");
|
||||
//};
|
||||
|
||||
await client.ConnectAsync();
|
||||
//await client.ConnectAsync();
|
||||
|
||||
await base.StartAsync(cancellationToken);
|
||||
}
|
||||
//await base.StartAsync(cancellationToken);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,49 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
if (req.Keyword != "")
|
||||
result = result.Where(x => x.FullName!.Contains(req.Keyword)).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy.ToUpper())
|
||||
{
|
||||
case "FULLNAME":
|
||||
if (req.descending == true)
|
||||
result = result.OrderByDescending(x => x.Prefix)
|
||||
.ThenByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName)
|
||||
.ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.Prefix)
|
||||
.ThenBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName)
|
||||
.ToList();
|
||||
break;
|
||||
case "LEAVETYPE":
|
||||
if (req.descending == true)
|
||||
result = result.OrderByDescending(x => x.LeaveType).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.LeaveType).ToList();
|
||||
break;
|
||||
case "LEAVEYEAR":
|
||||
if (req.descending == true)
|
||||
result = result.OrderByDescending(x => x.LeaveYear).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.LeaveYear).ToList();
|
||||
break;
|
||||
case "LEAVEDAYS":
|
||||
if (req.descending == true)
|
||||
result = result.OrderByDescending(x => x.LeaveDays).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.LeaveDays).ToList();
|
||||
break;
|
||||
case "LEAVEDAYSUSED":
|
||||
if (req.descending == true)
|
||||
result = result.OrderByDescending(x => x.LeaveDaysUsed).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.LeaveDaysUsed).ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
return Success(new { data = pageResult, total = result.Count });
|
||||
|
|
|
|||
|
|
@ -14,16 +14,19 @@ using BMA.EHR.Leave.Service.DTOs.ChangeRound;
|
|||
using BMA.EHR.Leave.Service.DTOs.CheckIn;
|
||||
using BMA.EHR.Leave.Service.DTOs.DutyTime;
|
||||
using BMA.EHR.Leave.Service.DTOs.LeaveRequest;
|
||||
using iTextSharp.text;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Nest;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RabbitMQ.Client;
|
||||
using RabbitMQ.Client.Events;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -1257,7 +1260,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> LogRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10, string keyword = "", string profileType = "ALL")
|
||||
public async Task<ActionResult<ResponseObject>> LogRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10, string keyword = "", string profileType = "ALL", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_CHECKIN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -1309,6 +1312,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
Id = d.Id,
|
||||
//FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId, AccessToken),
|
||||
FullName = $"{d.Prefix ?? ""}{d.FirstName ?? ""} {d.LastName ?? ""}",
|
||||
Prefix = d.Prefix ?? "",
|
||||
FirstName = d.FirstName ?? "",
|
||||
LastName = d.LastName ?? "",
|
||||
ProfileType = d.ProfileType ?? "",
|
||||
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
|
|
@ -1343,6 +1349,61 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
if (profileType.Trim().ToUpper() != "ALL")
|
||||
data = data.Where(x => x.ProfileType == profileType.Trim().ToUpper()).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
switch (sortBy.ToUpper())
|
||||
{
|
||||
case "FULLNAME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.Prefix)
|
||||
.ThenByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.Prefix)
|
||||
.ThenBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName)
|
||||
.ToList();
|
||||
break;
|
||||
case "CHECKINTIME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckInTime).ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckInTime).ToList();
|
||||
break;
|
||||
case "CHECKINLOCATION":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckInLocation)
|
||||
.ThenByDescending(x => x.CheckInLat)
|
||||
.ThenByDescending(x => x.CheckInLon)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckInLocation)
|
||||
.ThenBy(x => x.CheckInLat)
|
||||
.ThenBy(x => x.CheckInLon)
|
||||
.ToList();
|
||||
break;
|
||||
case "CHECKOUTTIME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckOutTime).ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckOutTime).ToList();
|
||||
break;
|
||||
case "CHECKOUTLOCATION":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckOutLocation)
|
||||
.ThenByDescending(x => x.CheckOutLat)
|
||||
.ThenByDescending(x => x.CheckOutLon)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckOutLocation)
|
||||
.ThenBy(x => x.CheckOutLat)
|
||||
.ThenBy(x => x.CheckOutLon)
|
||||
.ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
var pageData = data
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
|
|
@ -1474,7 +1535,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetTimeRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10, string status = "NORMAL", string keyword = "", string profileType = "ALL")
|
||||
public async Task<ActionResult<ResponseObject>> GetTimeRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10, string status = "NORMAL", string keyword = "", string profileType = "ALL", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_CHECKIN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -1565,6 +1626,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
Id = d.Id,
|
||||
FullName = $"{d.Prefix ?? ""}{d.FirstName ?? ""} {d.LastName ?? ""}",
|
||||
Prefix = d.Prefix ?? "",
|
||||
FirstName = d.FirstName ?? "",
|
||||
LastName = d.LastName ?? "",
|
||||
ProfileType = d.ProfileType ?? "",
|
||||
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
|
|
@ -1664,6 +1728,61 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
if (profileType.Trim().ToUpper() != "ALL")
|
||||
data = data.Where(x => x.ProfileType == profileType.Trim().ToUpper()).ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
switch (sortBy.ToUpper())
|
||||
{
|
||||
case "FULLNAME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.Prefix)
|
||||
.ThenByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.Prefix)
|
||||
.ThenBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName)
|
||||
.ToList();
|
||||
break;
|
||||
case "CHECKINTIME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckInTime).ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckInTime).ToList();
|
||||
break;
|
||||
case "CHECKINLOCATION":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckInLocation)
|
||||
.ThenByDescending(x => x.CheckInLat)
|
||||
.ThenByDescending(x => x.CheckInLon)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckInLocation)
|
||||
.ThenBy(x => x.CheckInLat)
|
||||
.ThenBy(x => x.CheckInLon)
|
||||
.ToList();
|
||||
break;
|
||||
case "CHECKOUTTIME":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckOutTime).ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckOutTime).ToList();
|
||||
break;
|
||||
case "CHECKOUTLOCATION":
|
||||
if (descending == true)
|
||||
data = data.OrderByDescending(x => x.CheckOutLocation)
|
||||
.ThenByDescending(x => x.CheckOutLat)
|
||||
.ThenByDescending(x => x.CheckOutLon)
|
||||
.ToList();
|
||||
else
|
||||
data = data.OrderBy(x => x.CheckOutLocation)
|
||||
.ThenBy(x => x.CheckOutLat)
|
||||
.ThenBy(x => x.CheckOutLon)
|
||||
.ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
var pageData = data
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
|
|
@ -1743,6 +1862,38 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
};
|
||||
resultSet.Add(res);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(req.sortBy))
|
||||
{
|
||||
switch (req.sortBy.ToUpper())
|
||||
{
|
||||
case "CITIZENID":
|
||||
if (req.descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.CitizenId).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.CitizenId).ToList();
|
||||
break;
|
||||
case "FULLNAME":
|
||||
if (req.descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.FullName).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.FullName).ToList();
|
||||
break;
|
||||
case "STARTTIMEMORNING":
|
||||
if (req.descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.StartTimeMorning).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.StartTimeMorning).ToList();
|
||||
break;
|
||||
case "EFFECTIVEDATE":
|
||||
if (req.descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.EffectiveDate).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.EffectiveDate).ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
var pageResult = resultSet.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
return Success(new { data = resultSet, total = profile.total });
|
||||
}
|
||||
|
|
@ -1818,7 +1969,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetChangeRoundHistoryByProfileIdAsync(Guid id, int page = 1, int pageSize = 10, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetChangeRoundHistoryByProfileIdAsync(Guid id, int page = 1, int pageSize = 10, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_WORK_ROUND_EDIT");
|
||||
if (getWorkflow == false)
|
||||
|
|
@ -1839,7 +1990,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
resultSet = data
|
||||
.GroupBy(item => item.ProfileId)
|
||||
.SelectMany(group => group
|
||||
.OrderBy(item => item.EffectiveDate) // เรียงลำดับตาม property ที่คุณต้องการ
|
||||
//.OrderBy(item => item.EffectiveDate) // เรียงลำดับตาม property ที่คุณต้องการ
|
||||
.Select((item, index) => new ChangeRoundHistoryDto
|
||||
{
|
||||
Round = index + 1,
|
||||
|
|
@ -1848,10 +1999,44 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
EffectiveDate = item.EffectiveDate.Value,
|
||||
Remark = item.Remark
|
||||
}))
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
//.Skip((page - 1) * pageSize)
|
||||
//.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
switch (sortBy.ToUpper())
|
||||
{
|
||||
case "ROUNT":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.Round).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.Round).ToList();
|
||||
break;
|
||||
case "STARTTIMEMORNIONG":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.StartTimeMorning).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.StartTimeMorning).ToList();
|
||||
break;
|
||||
case "EFFECTIVEDATE":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.EffectiveDate).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.EffectiveDate).ToList();
|
||||
break;
|
||||
case "REMARK":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.Remark).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.Remark).ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
resultSet = resultSet
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return Success(new { data = resultSet, total = data.Count });
|
||||
|
|
@ -2003,7 +2188,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetChangeEmpRoundHistoryByProfileIdAsync(Guid id, int page = 1, int pageSize = 10, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetChangeEmpRoundHistoryByProfileIdAsync(Guid id, int page = 1, int pageSize = 10, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_WORK_ROUND_EDIT");
|
||||
if (getWorkflow == false)
|
||||
|
|
@ -2024,7 +2209,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
resultSet = data
|
||||
.GroupBy(item => item.ProfileId)
|
||||
.SelectMany(group => group
|
||||
.OrderBy(item => item.EffectiveDate) // เรียงลำดับตาม property ที่คุณต้องการ
|
||||
//.OrderBy(item => item.EffectiveDate) // เรียงลำดับตาม property ที่คุณต้องการ
|
||||
.Select((item, index) => new ChangeRoundHistoryDto
|
||||
{
|
||||
Round = index + 1,
|
||||
|
|
@ -2033,10 +2218,44 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
EffectiveDate = item.EffectiveDate.Value,
|
||||
Remark = item.Remark
|
||||
}))
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
//.Skip((page - 1) * pageSize)
|
||||
//.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
switch (sortBy.ToUpper())
|
||||
{
|
||||
case "ROUNT":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.Round).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.Round).ToList();
|
||||
break;
|
||||
case "STARTTIMEMORNIONG":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.StartTimeMorning).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.StartTimeMorning).ToList();
|
||||
break;
|
||||
case "EFFECTIVEDATE":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.EffectiveDate).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.EffectiveDate).ToList();
|
||||
break;
|
||||
case "REMARK":
|
||||
if (descending == true)
|
||||
resultSet = resultSet.OrderByDescending(x => x.Remark).ToList();
|
||||
else
|
||||
resultSet = resultSet.OrderBy(x => x.Remark).ToList();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
resultSet = resultSet
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return Success(new { data = resultSet, total = data.Count });
|
||||
|
|
@ -2177,7 +2396,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetAdditionalCheckRequestAsync([Required] int year, [Required] int month, [Required] int page = 1, [Required] int pageSize = 10, string keyword = "")
|
||||
public async Task<ActionResult<ResponseObject>> GetAdditionalCheckRequestAsync([Required] int year, [Required] int month, [Required] int page = 1, [Required] int pageSize = 10, string keyword = "", string? sortBy = "", bool? descending = false)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_CHECKIN_SPECIAL");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -2246,6 +2465,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
Id = data.Id,
|
||||
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
|
||||
Prefix = data.Prefix ?? "",
|
||||
FirstName = data.FirstName ?? "",
|
||||
LastName = data.LastName ?? "",
|
||||
//FullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
|
||||
CreatedAt = data.CreatedAt,
|
||||
CheckDate = data.CheckDate,
|
||||
|
|
@ -2302,9 +2524,62 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
result = result.Where(x => x.FullName.Contains(keyword)).ToList();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
sortBy = "default";
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(sortBy))
|
||||
{
|
||||
switch (sortBy.ToUpper())
|
||||
{
|
||||
case "FULLNAME":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.Prefix)
|
||||
.ThenByDescending(x => x.FirstName)
|
||||
.ThenByDescending(x => x.LastName)
|
||||
.ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.Prefix)
|
||||
.ThenBy(x => x.FirstName)
|
||||
.ThenBy(x => x.LastName)
|
||||
.ToList();
|
||||
break;
|
||||
case "CREATEDAT":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.CreatedAt).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.CreatedAt).ToList();
|
||||
break;
|
||||
case "CHECKDATE":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.CheckDate).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.CheckDate).ToList();
|
||||
break;
|
||||
case "STARTTIMEMORNING":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.StartTimeMorning).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.StartTimeMorning).ToList();
|
||||
break;
|
||||
case "STARTTIMEAFTERNOON":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.StartTimeAfternoon).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.StartTimeAfternoon).ToList();
|
||||
break;
|
||||
case "DESCRIPTION":
|
||||
if (descending == true)
|
||||
result = result.OrderByDescending(x => x.Description).ToList();
|
||||
else
|
||||
result = result.OrderBy(x => x.Description).ToList();
|
||||
break;
|
||||
default:
|
||||
result = result.OrderBy(x => x.StatusSort).ToList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
var pageResult = result.Skip((page - 1) * pageSize).Take(pageSize)
|
||||
.OrderBy(x => x.StatusSort)
|
||||
.ToList();
|
||||
|
||||
return Success(new { data = pageResult, total = result.Count });
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Routing.Template;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Globalization;
|
||||
using System.Security.Claims;
|
||||
|
|
@ -283,7 +284,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var startFiscalYear = new DateTime(data.LeaveStartDate.Year - 1, 10, 1);
|
||||
var endFiscalYear = data.LeaveStartDate.Date.AddDays(-1); // นับจากวันที่ยื่นลา
|
||||
|
||||
var leaveData = await _leaveBeginningRepository.GetByYearAndTypeIdForUserAsync(data.LeaveStartDate.Year, data.Type.Id, data.KeycloakUserId);
|
||||
var thisYear = data.LeaveStartDate.Year;
|
||||
var toDay = data.LeaveStartDate.Date;
|
||||
if(toDay >= new DateTime(toDay.Year, 10, 1) && toDay <= new DateTime(toDay.Year, 12, 31))
|
||||
thisYear = thisYear + 1;
|
||||
|
||||
var leaveData = await _leaveBeginningRepository.GetByYearAndTypeIdForUserAsync(thisYear, data.Type.Id, data.KeycloakUserId);
|
||||
//var sumLeave = leaveData == null ? 0 : leaveData.LeaveDaysUsed;
|
||||
|
||||
var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveTotalByTypeAndRangeForUser(data.KeycloakUserId, data.Type.Id, startFiscalYear, endFiscalYear);
|
||||
|
|
@ -2167,12 +2173,15 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
var templatePath = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", "TimeStampRecords.xlsx");
|
||||
byte[] templateBytes = System.IO.File.ReadAllBytes(templatePath);
|
||||
//using (var package = new ExcelPackage(fileInfo))
|
||||
|
||||
using (var stream = new MemoryStream(templateBytes))
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
//var worksheet = package.Workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
var worksheet = package.Workbook.Worksheets["Sheet1"] ?? package.Workbook.Worksheets[0];
|
||||
// กำหนดให้ใช้ฟอนต์ TH SarabunPSK ซึ่งเป็นฟอนต์มาตรฐานราชการไทย
|
||||
// **ข้อควรระวัง:** หากเครื่องผู้ใช้ไม่มีฟอนต์นี้ติดตั้งอยู่ การจัดหน้าเอกสารจะเพี้ยน
|
||||
worksheet.Cells.Style.Font.Name = "TH SarabunPSK";
|
||||
|
||||
worksheet.Cells["A1:J1"].Merge = true;
|
||||
worksheet.Cells["A2:J2"].Merge = true;
|
||||
|
|
@ -2184,56 +2193,65 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
|
||||
range.Style.Font.Bold = true;
|
||||
}
|
||||
//worksheet.Cells[1, 1].Value = "แบบการลงเวลาปฏิบัติราชการ";
|
||||
|
||||
worksheet.Cells[2, 1].Value = organizationName;
|
||||
worksheet.Cells[3, 1].Value = dateTimeStamp;
|
||||
|
||||
using (var range = worksheet.Cells[4, 1, 4, 10])
|
||||
{
|
||||
range.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
|
||||
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
|
||||
range.Style.Font.Bold = true;
|
||||
}
|
||||
//worksheet.Cells[4, 1].Value = "ลำดับที่";
|
||||
//worksheet.Cells[4, 2].Value = "ชื่อ - สกุล";
|
||||
//worksheet.Cells[4, 3].Value = "รอบ";
|
||||
//worksheet.Cells[4, 4].Value = "วันที่เข้างาน";
|
||||
//worksheet.Cells[4, 5].Value = "พิกัด";
|
||||
//worksheet.Cells[4, 6].Value = "เวลามา";
|
||||
//worksheet.Cells[4, 7].Value = "วันที่ออกงาน";
|
||||
//worksheet.Cells[4, 8].Value = "พิกัด";
|
||||
//worksheet.Cells[4, 9].Value = "เวลากลับ";
|
||||
//worksheet.Cells[4, 10].Value = "หมายเหตุ";
|
||||
int startRow = 5;
|
||||
foreach (var emp in employees)
|
||||
int colCount = 10;
|
||||
int totalRows = employees.Count;
|
||||
|
||||
// เตรียม List<object[]> สำหรับใช้กับ LoadFromArrays
|
||||
var data = new List<object[]>(totalRows);
|
||||
for (int i = 0; i < totalRows; i++)
|
||||
{
|
||||
worksheet.Cells[startRow, 1].Value = emp.no;
|
||||
worksheet.Cells[startRow, 2].Value = emp.fullName;
|
||||
worksheet.Cells[startRow, 3].Value = emp.dutyTimeName;
|
||||
worksheet.Cells[startRow, 4].Value = emp.checkInDate;
|
||||
worksheet.Cells[startRow, 5].Value = emp.checkInLocation;
|
||||
worksheet.Cells[startRow, 6].Value = emp.checkInTime;
|
||||
worksheet.Cells[startRow, 7].Value = emp.checkedOutDate;
|
||||
worksheet.Cells[startRow, 8].Value = emp.checkOutLocation;
|
||||
worksheet.Cells[startRow, 9].Value = emp.checkOutTime;
|
||||
worksheet.Cells[startRow, 10].Value = emp.remark;
|
||||
startRow++;
|
||||
var emp = employees[i];
|
||||
data.Add(new object[]
|
||||
{
|
||||
emp.no,
|
||||
emp.fullName,
|
||||
emp.dutyTimeName,
|
||||
emp.checkInDate,
|
||||
emp.checkInLocation,
|
||||
emp.checkInTime,
|
||||
emp.checkedOutDate,
|
||||
emp.checkOutLocation,
|
||||
emp.checkOutTime,
|
||||
emp.remark
|
||||
});
|
||||
}
|
||||
|
||||
// ใส่กรอบให้ตาราง
|
||||
using (var range = worksheet.Cells[5, 1, startRow - 1, 10])
|
||||
// เขียนข้อมูลลง Excel ครั้งเดียว
|
||||
worksheet.Cells[startRow, 1].LoadFromArrays(data);
|
||||
|
||||
// กำหนดสไตล์ตัวบาง + ขอบ
|
||||
using (var range = worksheet.Cells[startRow, 1, startRow + totalRows - 1, colCount])
|
||||
{
|
||||
range.Style.Font.Bold = false;
|
||||
range.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
|
||||
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
|
||||
|
||||
// Center Align: คอลัมน์ 1 (A), 3 (C), 4 (D), 6 (F), 7 (G), 9 (I)
|
||||
var centerColumns = new[] { 1, 3, 4, 6, 7, 9 };
|
||||
foreach (var col in centerColumns)
|
||||
{
|
||||
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
}
|
||||
|
||||
// Left Align: คอลัมน์ 2 (B), 5 (E), 8 (H), 10 (J)
|
||||
var leftColumns = new[] { 2, 5, 8, 10 };
|
||||
foreach (var col in leftColumns)
|
||||
{
|
||||
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
int lastRow = startRow + 2;
|
||||
// ส่วนสรุปท้ายตาราง
|
||||
int lastRow = startRow + totalRows + 2;
|
||||
|
||||
worksheet.Cells[lastRow, 2].Value = type.Trim().ToUpper() == "OFFICER" ? "ข้าราชการทั้งหมด" : "ลูกจ้างประจำทั้งหมด";
|
||||
worksheet.Cells[lastRow, 5].Value = profile?.Count;
|
||||
worksheet.Cells[lastRow, 6].Value = "คน";
|
||||
|
|
@ -2259,6 +2277,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
worksheet.Cells[lastRow + 6, 2].Value = "เรียน";
|
||||
worksheet.Cells[lastRow + 7, 2].Value = "เพื่อโปรดทราบ";
|
||||
worksheet.Cells[lastRow + 7, 9].Value = "ทราบ";
|
||||
worksheet.Cells[lastRow + 7, 9].Style.Font.Bold = true;
|
||||
worksheet.Cells[lastRow + 7, 9].Style.Font.Size = 22;
|
||||
worksheet.Cells[lastRow + 8, 2].Value = "................................";
|
||||
worksheet.Cells[lastRow + 8, 9].Value = "................................";
|
||||
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
|
||||
|
|
|
|||
|
|
@ -1349,6 +1349,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
var rawData =
|
||||
await _leaveRequestRepository.GetLeaveRequestByUserIdAsync(userId, req.Year, req.Type, req.Status);
|
||||
|
||||
|
|
@ -2294,6 +2296,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
}
|
||||
var thisYear = DateTime.Now.Year;
|
||||
var toDay = DateTime.Now.Date;
|
||||
if(toDay >= new DateTime(toDay.Year, 10, 1) && toDay <= new DateTime(toDay.Year, 12, 31))
|
||||
thisYear = thisYear + 1;
|
||||
|
||||
//var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId, AccessToken);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
public Guid Id { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
public string? Prefix { get; set; } = string.Empty;
|
||||
public string? FirstName { get; set; } = string.Empty;
|
||||
public string? LastName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,9 @@
|
|||
public int PageSize { get; set; } = 10;
|
||||
|
||||
public string? Keyword { get; set; }
|
||||
|
||||
public string? sortBy { get; set; }
|
||||
|
||||
public bool? descending { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@
|
|||
|
||||
public string CitizenId { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
public string FullName { get; set; }
|
||||
|
||||
public string? Prefix { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
|
||||
public string StartTimeMorning { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
public string? Prefix { get; set; } = string.Empty;
|
||||
public string? FirstName { get; set; } = string.Empty;
|
||||
public string? LastName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckInDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
public string? Prefix { get; set; } = string.Empty;
|
||||
public string? FirstName { get; set; } = string.Empty;
|
||||
public string? LastName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckInDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,9 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveBeginnings
|
|||
public int PageSize { get; set; } = 10;
|
||||
|
||||
public string Keyword { get; set; } = string.Empty;
|
||||
|
||||
public string? sortBy { get; set; }
|
||||
|
||||
public bool? descending { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue