fix : Leave user commander and organization name
Some checks failed
release-dev / release-dev (push) Failing after 13s

fix: handle  lastSalary amount while null value
This commit is contained in:
Suphonchai Phoonsawat 2024-11-14 19:53:41 +07:00
parent c18d9a392a
commit 5d8a0b842a
2 changed files with 13 additions and 10 deletions

View file

@ -54,6 +54,8 @@ namespace BMA.EHR.Application.Responses.Profiles
public string? Child4 { get; set; }
public string? Commander { get; set; }
}
public class PosLevel

View file

@ -694,13 +694,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var lastSalary = profile.ProfileSalary;
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
var approver = profile.Commander ?? "";
var userOc = profile.Root ?? "";
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
// if (list.Count > 0)
// approver = list.First().Name;
//}
var leaveLast = await _leaveRequestRepository.GetLeaveLastByTypeForUserAsync(userId, req.Type);
@ -714,7 +715,7 @@ namespace BMA.EHR.Leave.Service.Controllers
Dear = approver,
PositionName = profile.Position == null ? "" : profile.Position,
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName,
OrganizationName = profile.Oc ?? "",
OrganizationName = userOc, //profile.Oc ?? "",
LeaveLimit = leaveType.Limit,
LeaveTotal = sumLeave,
@ -722,8 +723,8 @@ namespace BMA.EHR.Leave.Service.Controllers
RestDayTotalOld = restOldDay,
BirthDate = profile.BirthDate.Date,
DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date,
Salary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value,
SalaryText = lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false),
Salary = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : (int)lastSalary.Amount.Value,
SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false),
LeaveLast = leaveLast == null ? null : leaveLast
};