This commit is contained in:
parent
11db0315e7
commit
12fab7cc1f
3 changed files with 24 additions and 10 deletions
|
|
@ -436,7 +436,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
//var leaveType = await _appDbContext.Set<TypeLeave>()
|
||||
// .FirstOrDefaultAsync(x => x.Name == rawData.Type.Name);
|
||||
|
||||
|
||||
// insert to profile leave
|
||||
//var profileLeave = await _appDbContext.Set<ProfileLeave>()
|
||||
// .Where(x => x.TypeLeave.Id == leaveType.Id)
|
||||
|
|
@ -834,9 +834,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type, string role, string nodeId, int node)
|
||||
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type, string role, string? nodeId, int? node)
|
||||
{
|
||||
var _nodeId = Guid.Parse(nodeId);
|
||||
// var _nodeId = Guid.Parse(nodeId);
|
||||
var data = new List<LeaveRequest>();
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
|
|
@ -844,7 +844,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Include(x => x.Type)
|
||||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
|
||||
.Where(x => node == 4 ? x.Child4Id == Guid.Parse(nodeId) : (node == 3 ? x.Child3Id == Guid.Parse(nodeId) : (node == 2 ? x.Child2Id == Guid.Parse(nodeId) : (node == 1 ? x.Child1Id == Guid.Parse(nodeId) : (node == 0 ? x.RootId == Guid.Parse(nodeId) : (node == null ? true : true))))))
|
||||
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
}
|
||||
else
|
||||
|
|
@ -853,7 +853,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.Include(x => x.Type)
|
||||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
|
||||
.Where(x => node == 4 ? x.Child4Id == Guid.Parse(nodeId) : (node == 3 ? x.Child3Id == Guid.Parse(nodeId) : (node == 2 ? x.Child2Id == Guid.Parse(nodeId) : (node == 1 ? x.Child1Id == Guid.Parse(nodeId) : (node == 0 ? x.RootId == Guid.Parse(nodeId) : (node == null ? true : true))))))
|
||||
.Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true))))
|
||||
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -937,7 +937,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
organizationName = profile?.FirstOrDefault()?.Oc ?? "",
|
||||
headerText = type.Trim().ToUpper() == "OFFICER" ? "ข้าราชการสามัญ" : "ลูกจ้างประจำ",
|
||||
leaveTitleType = leaveTitleType,
|
||||
employees = employees,
|
||||
employees = employees,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -973,8 +973,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var profile = new List<GetProfileByKeycloakIdRootDto>();
|
||||
profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevision(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD", req.isRetirement??true, req.revisionId);
|
||||
|
||||
profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevision(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD", req.isRetirement ?? true, req.revisionId);
|
||||
|
||||
// get leave day
|
||||
var leaveDays = await _leaveRequestRepository.GetSumApproveLeaveByTypeAndRange(req.StartDate, req.EndDate);
|
||||
var leaveTypes = await _leaveTypeRepository.GetAllAsync();
|
||||
|
|
@ -1282,7 +1282,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
else
|
||||
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||
//remarkStr = "";
|
||||
//remarkStr = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1491,7 +1491,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetLeave2Report([FromBody] GetLeaveDetailByNodeReportDto req, string type)
|
||||
public async Task<ActionResult<ResponseObject>> GetLeave2Report([FromBody] GetLeave2DetailByNodeReportDto req, string type)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
14
BMA.EHR.Leave/DTOs/Reports/GetLeave2DetailByNodeReportDto.cs
Normal file
14
BMA.EHR.Leave/DTOs/Reports/GetLeave2DetailByNodeReportDto.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace BMA.EHR.Leave.Service.DTOs.Reports
|
||||
{
|
||||
public class GetLeave2DetailByNodeReportDto
|
||||
{
|
||||
public DateTime StartDate { get; set; } = DateTime.MinValue;
|
||||
public DateTime EndDate { get; set; } = DateTime.MinValue;
|
||||
public string? Type { get; set; } = string.Empty;
|
||||
public int? node { get; set; }
|
||||
public string? nodeId { get; set; }
|
||||
public bool? isRetirement { get; set; } = false;
|
||||
|
||||
public string? revisionId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue