fix sum absent and late day
This commit is contained in:
parent
9e513d3f1a
commit
f050013a29
1 changed files with 12 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Responses.Profiles;
|
using BMA.EHR.Application.Responses.Profiles;
|
||||||
|
using Microsoft.OpenApi.Any;
|
||||||
|
|
||||||
namespace BMA.EHR.Leave.Service.Controllers
|
namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -807,16 +808,13 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var therapyDay = leaveDays.FirstOrDefault(x => x.KeycloakUserId == keycloakUserId && x.LeaveTypeCode == "LV-011");
|
var therapyDay = leaveDays.FirstOrDefault(x => x.KeycloakUserId == keycloakUserId && x.LeaveTypeCode == "LV-011");
|
||||||
var therapyDayCount = therapyDay != null ? therapyDay.SumLeaveDay : 0;
|
var therapyDayCount = therapyDay != null ? therapyDay.SumLeaveDay : 0;
|
||||||
|
|
||||||
var timeStamps = await _processUserTimeStampRepository.GetTimeStampHistoryByRangeForUserAsync(p.Keycloak ?? Guid.Empty,
|
var timeStamps = await _processUserTimeStampRepository.GetTimeStampHistoryByRangeForUserAsync(p.Keycloak ?? Guid.Empty,req.StartDate,req.EndDate);
|
||||||
req.StartDate,
|
|
||||||
req.EndDate);
|
|
||||||
|
|
||||||
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||||
if (defaultRound == null)
|
if (defaultRound == null)
|
||||||
{
|
{
|
||||||
return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
|
return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
//var userRound = await _dutyTimeRepository.GetByIdAsync(profile.DutyTimeId ?? Guid.Empty);
|
//var userRound = await _dutyTimeRepository.GetByIdAsync(profile.DutyTimeId ?? Guid.Empty);
|
||||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
|
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
|
||||||
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||||
|
|
@ -824,7 +822,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
var duty = userRound ?? defaultRound;
|
var duty = userRound ?? defaultRound;
|
||||||
|
|
||||||
var processTimeStamps = timeStamps
|
/* var processTimeStamps = timeStamps
|
||||||
.Select(d => new
|
.Select(d => new
|
||||||
{
|
{
|
||||||
d.Id,
|
d.Id,
|
||||||
|
|
@ -840,10 +838,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||||
"ABSENT" :
|
"ABSENT" :
|
||||||
"NORMAL",
|
"NORMAL",
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
/*var absentCount = processTimeStamps.Count(x => x.CheckOutStatus == "ABSENT");
|
||||||
|
var lateCount = processTimeStamps.Count(x => x.CheckInStatus == "LATE");*/
|
||||||
|
|
||||||
|
var absentCount = timeStamps.Count(d =>
|
||||||
|
d.CheckOutStatus == "ABSENT"); // นับจำนวนที่มี CheckOutStatus == "ABSENT"
|
||||||
|
var lateCount = timeStamps.Count(d =>
|
||||||
|
d.CheckInStatus == "LATE"); // นับจำนวนที่มี CheckInStatus == "LATE"
|
||||||
|
|
||||||
var absentCount = processTimeStamps.Count(x => x.CheckOutStatus == "ABSENT");
|
|
||||||
var lateCount = processTimeStamps.Count(x => x.CheckInStatus == "LATE");
|
|
||||||
|
|
||||||
var emp = new
|
var emp = new
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue