no message
This commit is contained in:
parent
4dcb2c467d
commit
d08b4ca723
2 changed files with 21 additions and 16 deletions
|
|
@ -1107,10 +1107,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
continue;
|
continue;
|
||||||
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||||
//if (organizationType == null)
|
//if (organizationType == null)
|
||||||
// continue;
|
// continue;
|
||||||
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(null);
|
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||||
if(organizations == null)
|
if (organizations == null)
|
||||||
continue;
|
continue;
|
||||||
foreach (var organization in organizations)
|
foreach (var organization in organizations)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -709,8 +709,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var lastSalary = profile.ProfileSalary;
|
var lastSalary = profile.ProfileSalary;
|
||||||
|
|
||||||
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
||||||
var approver = profile.Commander ?? "";
|
//var approver = profile.Commander ?? "";
|
||||||
var userOc = profile.Root ?? "";
|
//var userOc = profile.Root ?? "";
|
||||||
//if (rootOc != null)
|
//if (rootOc != null)
|
||||||
//{
|
//{
|
||||||
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||||
|
|
@ -727,10 +727,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
FullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
|
FullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
|
||||||
|
|
||||||
Dear = approver,
|
Dear = profile.Commander ?? "",
|
||||||
PositionName = profile.Position == null ? "" : profile.Position,
|
PositionName = profile.Position == null ? "" : profile.Position,
|
||||||
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName,
|
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName,
|
||||||
OrganizationName = userOc, //profile.Oc ?? "",
|
OrganizationName = profile.Root ?? "", //profile.Oc ?? "",
|
||||||
|
|
||||||
LeaveLimit = leaveType.Limit,
|
LeaveLimit = leaveType.Limit,
|
||||||
LeaveTotal = sumLeave,
|
LeaveTotal = sumLeave,
|
||||||
|
|
@ -790,12 +790,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
|
|
||||||
var minLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
|
var minLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
|
||||||
x.LeaveStatus != "DELETE" && x.LeaveStatus != "REJECT")
|
(x.LeaveStatus == "PENDING" || x.LeaveStatus == "APPROVE") &&
|
||||||
|
x.KeycloakUserId == userId)
|
||||||
.OrderBy(x => x.LeaveStartDate)
|
.OrderBy(x => x.LeaveStartDate)
|
||||||
.FirstOrDefaultAsync());
|
.FirstOrDefaultAsync());
|
||||||
|
|
||||||
var maxLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
|
var maxLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
|
||||||
x.LeaveStatus != "DELETE" && x.LeaveStatus != "REJECT")
|
(x.LeaveStatus == "PENDING" || x.LeaveStatus == "APPROVE") &&
|
||||||
|
x.KeycloakUserId == userId)
|
||||||
.OrderByDescending(x => x.LeaveEndDate)
|
.OrderByDescending(x => x.LeaveEndDate)
|
||||||
.FirstOrDefaultAsync());
|
.FirstOrDefaultAsync());
|
||||||
|
|
||||||
|
|
@ -806,13 +808,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
(req.EndLeaveDate.Date >= minLeave.LeaveStartDate.Date && req.EndLeaveDate.Date <= maxLeave.LeaveEndDate.Date);
|
(req.EndLeaveDate.Date >= minLeave.LeaveStartDate.Date && req.EndLeaveDate.Date <= maxLeave.LeaveEndDate.Date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var isLeave = false;
|
var isLeave = false;
|
||||||
|
|
||||||
switch (leaveType.Code.ToUpper().Trim())
|
switch (leaveType.Code.ToUpper().Trim())
|
||||||
{
|
{
|
||||||
case "LV-001":
|
case "LV-001":
|
||||||
|
isLeave = true;
|
||||||
|
break;
|
||||||
case "LV-002":
|
case "LV-002":
|
||||||
|
isLeave = true;
|
||||||
|
break;
|
||||||
case "LV-007":
|
case "LV-007":
|
||||||
isLeave = true;
|
isLeave = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1636,8 +1641,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
|
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
|
||||||
if (rawData == null)
|
if (rawData == null)
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
if (rawData.ProfileType =="OFFICER")
|
if (rawData.ProfileType == "OFFICER")
|
||||||
{
|
{
|
||||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_LEAVE_LIST");
|
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_LEAVE_LIST");
|
||||||
if (getWorkflow == false)
|
if (getWorkflow == false)
|
||||||
|
|
@ -1669,7 +1674,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
//if (profile == null)
|
//if (profile == null)
|
||||||
//{
|
//{
|
||||||
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//var userCalendar = await _userCalendarRepository.GetExist(Guid.Parse(rawData.ProfileId));
|
//var userCalendar = await _userCalendarRepository.GetExist(Guid.Parse(rawData.ProfileId));
|
||||||
|
|
@ -1686,9 +1691,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
//var approver = string.Empty;
|
//var approver = string.Empty;
|
||||||
//if (rootOc != null)
|
//if (rootOc != null)
|
||||||
//{
|
//{
|
||||||
//var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
//var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||||
//if (list.Count > 0)
|
//if (list.Count > 0)
|
||||||
//approver = list.First().Name;
|
//approver = list.First().Name;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var leaveSummary = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id, thisYear);
|
var leaveSummary = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id, thisYear);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue