no message

This commit is contained in:
kittapath 2024-11-15 16:44:29 +07:00
parent 4dcb2c467d
commit d08b4ca723
2 changed files with 21 additions and 16 deletions

View file

@ -1109,7 +1109,7 @@ namespace BMA.EHR.Application.Repositories.Reports
//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)

View file

@ -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;