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,
|
await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(data.KeycloakUserId,
|
||||||
data.Type.Id);
|
data.Type.Id);
|
||||||
|
|
||||||
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
||||||
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 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);
|
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 ?? "",
|
leaveWrote = data.LeaveWrote ?? "",
|
||||||
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
||||||
leaveTypeName = data.Type.Name,
|
leaveTypeName = data.Type.Name,
|
||||||
dear = approver,
|
dear = data.Dear,
|
||||||
fullname = fullName,
|
fullname = fullName,
|
||||||
positionName = profile!.Position == null ? "-" : profile!.Position,
|
positionName = profile!.Position == null ? "-" : profile!.Position,
|
||||||
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
|
positionLeaveName = profile!.PosLevel == null ? "-" : profile!.PosLevel,
|
||||||
organizationName = profile!.Oc ?? "",
|
organizationName = orgName,
|
||||||
leaveDetail = data.LeaveDetail,
|
leaveDetail = data.LeaveDetail,
|
||||||
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
|
leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(),
|
||||||
leaveDateEnd = data.LeaveEndDate.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 fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}";
|
||||||
|
|
||||||
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
|
||||||
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 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
|
return new
|
||||||
{
|
{
|
||||||
|
|
@ -206,7 +230,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
leaveWrote = data.LeaveWrote ?? "",
|
leaveWrote = data.LeaveWrote ?? "",
|
||||||
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(),
|
||||||
leaveTypeName = data.Type.Name,
|
leaveTypeName = data.Type.Name,
|
||||||
dear = approver,
|
dear = data.Dear,
|
||||||
fullname = fullName,
|
fullname = fullName,
|
||||||
positionName = profile!.Position == null ? "-" : profile!.Position,
|
positionName = profile!.Position == null ? "-" : profile!.Position,
|
||||||
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
|
positionLeaveName = profile!.Position == null ? "-" : profile!.Position,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue