report leave
This commit is contained in:
parent
12448ba0a4
commit
771b9b940a
17 changed files with 2109 additions and 305 deletions
|
|
@ -663,7 +663,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
//.Where(x => x.LeaveStartDate.Year == year)
|
||||
.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate )
|
||||
.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate)
|
||||
.Where(x => x.LeaveStatus == "NEW") // fix issue : #729
|
||||
.ToListAsync();
|
||||
|
||||
|
|
@ -826,6 +826,64 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.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 => x.LeaveStatus == "APPROVE").ToListAsync();
|
||||
|
||||
var res = (from d in data
|
||||
group d by new { d.Root, d.Child1, d.Child2, d.Child3, d.Child4, LeaveTypeId = d.Type.Id, LeaveTypeCode = d.Type.Code } into grp
|
||||
select new GetSumApproveLeaveByRootDto
|
||||
{
|
||||
Root = grp.Key.Root,
|
||||
LeaveTypeId = grp.Key.LeaveTypeId,
|
||||
LeaveTypeCode = grp.Key.LeaveTypeCode,
|
||||
SumLeaveDay = grp.Sum(x => x.LeaveTotal),
|
||||
|
||||
sickDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
personalDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
restDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
absentDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
studyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
|
||||
|
||||
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
restDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
studyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
|
||||
sickDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
personalDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
restDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
absentDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
studyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<GetCountApproveLeaveByTypeDto>> GetCountApproveLeaveByTypeAndRange(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
|
|
|
|||
|
|
@ -139,6 +139,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(x => x.CheckInStatus == "LATE")
|
||||
.Where(x => x.ProfileType == type.Trim().ToUpper())
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetLastRecord(Guid keycloakId)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetProfileByKeycloakIdDto>> GetProfileWithKeycloakAllOfficer(string? accessToken, string? node, string? nodeId)
|
||||
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllOfficer(string? accessToken, string? node, string? nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -260,7 +260,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdResultDto>(apiResult);
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetProfileByKeycloakIdDto>> GetProfileWithKeycloakAllEmployee(string? accessToken, string? node, string? nodeId)
|
||||
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileWithKeycloakAllEmployee(string? accessToken, string? node, string? nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -290,7 +290,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdResultDto>(apiResult);
|
||||
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue