report
This commit is contained in:
parent
734b29c77c
commit
9e9b3316e9
1 changed files with 44 additions and 20 deletions
|
|
@ -137,14 +137,26 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(data.KeycloakUserId,
|
||||
data.Type.Id);
|
||||
|
||||
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 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 orgName = "";
|
||||
if (profile.Child1 != null && profile.Child1 != "")
|
||||
orgName += $" {profile.Child1}";
|
||||
if (profile.Child2 != null && profile.Child2 != "")
|
||||
orgName += $" {profile.Child2}";
|
||||
if (profile.Child3 != null && profile.Child3 != "")
|
||||
orgName += $" {profile.Child3}";
|
||||
if (profile.Child4 != null && profile.Child4 != "")
|
||||
orgName += $" {profile.Child4}";
|
||||
if (profile.Root != null && profile.Root != "")
|
||||
orgName += $" {profile.Root}";
|
||||
|
||||
var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year);
|
||||
|
||||
|
|
@ -157,11 +169,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
leaveWrote = data.LeaveWrote ?? "",
|
||||
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
||||
leaveTypeName = data.Type.Name,
|
||||
dear = approver,
|
||||
dear = data.Dear,
|
||||
fullname = fullName,
|
||||
positionName = profile!.Position == null ? "-" : profile!.Position,
|
||||
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
|
||||
organizationName = profile!.Oc ?? "",
|
||||
positionLeaveName = profile!.PosLevel == null ? "-" : profile!.PosLevel,
|
||||
organizationName = orgName,
|
||||
leaveDetail = data.LeaveDetail,
|
||||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
|
||||
leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(),
|
||||
|
|
@ -188,14 +200,26 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||
|
||||
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 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 orgName = "";
|
||||
if (profile.Child1 != null && profile.Child1 != "")
|
||||
orgName += $" {profile.Child1}";
|
||||
if (profile.Child2 != null && profile.Child2 != "")
|
||||
orgName += $" {profile.Child2}";
|
||||
if (profile.Child3 != null && profile.Child3 != "")
|
||||
orgName += $" {profile.Child3}";
|
||||
if (profile.Child4 != null && profile.Child4 != "")
|
||||
orgName += $" {profile.Child4}";
|
||||
if (profile.Root != null && profile.Root != "")
|
||||
orgName += $" {profile.Root}";
|
||||
|
||||
return new
|
||||
{
|
||||
|
|
@ -206,7 +230,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
leaveWrote = data.LeaveWrote ?? "",
|
||||
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
||||
leaveTypeName = data.Type.Name,
|
||||
dear = approver,
|
||||
dear = data.Dear,
|
||||
fullname = fullName,
|
||||
positionName = profile!.Position == null ? "-" : profile!.Position,
|
||||
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue