Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop

This commit is contained in:
kittapath 2024-11-15 15:11:28 +07:00
commit fa7e81d89f
3 changed files with 45 additions and 28 deletions

View file

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

View file

@ -1739,7 +1739,12 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
Prefix = item.Prefix, Prefix = item.Prefix,
FirstName = item.FirstName, FirstName = item.FirstName,
LastName = item.LastName, LastName = item.LastName,
Organization = item.Organization, //Organization = item.Organization,
Organization = (item.child4 == null ? "" : item.child4 + "/") +
(item.child3 == null ? "" : item.child3 + "/") +
(item.child2 == null ? "" : item.child2 + "/") +
(item.child1 == null ? "" : item.child1 + "/") +
(item.root == null ? "" : item.root),
root = item.root, root = item.root,
rootId = item.rootId, rootId = item.rootId,

View file

@ -283,10 +283,14 @@ namespace BMA.EHR.Leave.Service.Controllers
case "LV-008": case "LV-008":
{ {
var lastSalary = profile.ProfileSalary; var lastSalary = profile.ProfileSalary;
var lastSalaryAmount = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : lastSalary.Amount;
var lastSalaryAmountText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount).ToThaiBahtText(false);
leaveRequest.LeaveSalary = (int)lastSalaryAmount;
leaveRequest.LeaveSalaryText = lastSalaryAmountText;
//leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value;
//leaveRequest.LeaveSalaryText =
// lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value;
leaveRequest.LeaveSalaryText =
lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
leaveRequest.LeaveBirthDate = profile.BirthDate; leaveRequest.LeaveBirthDate = profile.BirthDate;
leaveRequest.LeaveGovernmentDate = profile.DateStart; leaveRequest.LeaveGovernmentDate = profile.DateStart;
@ -303,10 +307,13 @@ namespace BMA.EHR.Leave.Service.Controllers
case "LV-010": case "LV-010":
{ {
var lastSalary = profile.ProfileSalary; var lastSalary = profile.ProfileSalary;
var lastSalaryAmount = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : lastSalary.Amount;
leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value; var lastSalaryAmountText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount).ToThaiBahtText(false);
leaveRequest.LeaveSalaryText = leaveRequest.LeaveSalary = (int)lastSalaryAmount;
lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false); leaveRequest.LeaveSalaryText = lastSalaryAmountText;
//leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value;
//leaveRequest.LeaveSalaryText =
// lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
leaveRequest.CoupleDayName = req.CoupleDayName ?? ""; leaveRequest.CoupleDayName = req.CoupleDayName ?? "";
leaveRequest.CoupleDayPosition = req.CoupleDayPosition ?? ""; leaveRequest.CoupleDayPosition = req.CoupleDayPosition ?? "";
@ -327,20 +334,22 @@ namespace BMA.EHR.Leave.Service.Controllers
} }
// add dear and oc_data // add dear and oc_data
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = string.Empty; var approver = profile.Commander ?? "";
if (rootOc != null) var userOc = profile.Root ?? "";
{ //if (rootOc != null)
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); //{
if (list.Count > 0) // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
approver = list.First().Name; // if (list.Count > 0)
} // approver = list.First().Name;
//}
leaveRequest.LeaveTypeCode = leaveType.Code; leaveRequest.LeaveTypeCode = leaveType.Code;
leaveRequest.Dear = approver; leaveRequest.Dear = approver;
leaveRequest.PositionName = profile.Position == null ? "" : profile.Position; leaveRequest.PositionName = profile.Position == null ? "" : profile.Position;
leaveRequest.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName; leaveRequest.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName;
leaveRequest.OrganizationName = profile.Root ?? ""; leaveRequest.OrganizationName = userOc;
@ -699,14 +708,15 @@ 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 = string.Empty; var approver = profile.Commander ?? "";
if (rootOc != null) var userOc = profile.Root ?? "";
{ //if (rootOc != null)
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); //{
if (list.Count > 0) // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
approver = list.First().Name; // if (list.Count > 0)
} // approver = list.First().Name;
//}
var leaveLast = await _leaveRequestRepository.GetLeaveLastByTypeForUserAsync(userId, req.Type); var leaveLast = await _leaveRequestRepository.GetLeaveLastByTypeForUserAsync(userId, req.Type);
@ -720,7 +730,7 @@ namespace BMA.EHR.Leave.Service.Controllers
Dear = approver, Dear = approver,
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 = profile.Oc ?? "", OrganizationName = userOc, //profile.Oc ?? "",
LeaveLimit = leaveType.Limit, LeaveLimit = leaveType.Limit,
LeaveTotal = sumLeave, LeaveTotal = sumLeave,
@ -728,8 +738,8 @@ namespace BMA.EHR.Leave.Service.Controllers
RestDayTotalOld = restOldDay, RestDayTotalOld = restOldDay,
BirthDate = profile.BirthDate.Date, BirthDate = profile.BirthDate.Date,
DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date, DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date,
Salary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value, Salary = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : (int)lastSalary.Amount.Value,
SalaryText = lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false), SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false),
LeaveLast = leaveLast == null ? null : leaveLast LeaveLast = leaveLast == null ? null : leaveLast
}; };