This commit is contained in:
parent
6f9116ead5
commit
ca1a2c05c3
2 changed files with 25 additions and 9 deletions
|
|
@ -437,7 +437,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
|
||||
data.LeaveCancelStatus = "APPROVE";
|
||||
data.LeaveCancelComment = Reason;
|
||||
data.LeaveDirectorComment = Reason;
|
||||
|
||||
// TODO : Update ไปตาราง beginning
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(data.LeaveStartDate.Year, data.Type.Id, data.KeycloakUserId, -1 * data.LeaveTotal);
|
||||
|
|
@ -478,7 +478,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
}
|
||||
|
||||
rawData.LeaveCancelStatus = "APPROVE";
|
||||
rawData.LeaveCancelComment = Reason;
|
||||
rawData.LeaveDirectorComment = Reason;
|
||||
|
||||
await UpdateWithTrackingAsync(rawData);
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
}
|
||||
|
||||
rawData.LeaveCancelStatus = "REJECT";
|
||||
rawData.LeaveCancelComment = Reason;
|
||||
rawData.LeaveDirectorComment = Reason;
|
||||
|
||||
// fix issue : ระบบลา (User) >> กรณีขอยกเลิกการลา แต่ผู้บังคับบัญชาไม่อนุมัติ (สถานะการลาไม่อัปเดต) #846
|
||||
if (rawData.ApproveStep == "st4")
|
||||
|
|
|
|||
|
|
@ -915,11 +915,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel,
|
||||
OrganizationName = orgName, //profile.Oc ?? "",
|
||||
|
||||
LeaveLimit = leaveLimit,
|
||||
LeaveTotal = sumLeave,
|
||||
LeaveLimit = leaveLimit, // จำนวนวันลาทั้งหมดในปีนั้นๆที่ลาได้ โดยรวมยอดที่เหลือจากปีก่อนมา (เอาค่ามาจากตาราง Beginning เลย)
|
||||
LeaveTotal = sumLeave, // จำนวนวันลาที่ลาไปแล้วในปีนั้นๆ โดยเมื่อมีการอนุมัติลา จะมาบวกค่านี้ไปเรื่อยๆ (เอาค่ามาจากตาราง Beginning เลย)
|
||||
LeaveRemain = leaveLimit - sumLeave,
|
||||
RestDayTotalOld = restOldDay,
|
||||
RestDayTotalCurrent = restCurrentDay,
|
||||
RestDayTotalOld = restOldDay, // เอา leaveLimit มาลบ 10 (LV-005)
|
||||
RestDayTotalCurrent = restCurrentDay,// 10 วันเสมอ (LV-005)
|
||||
BirthDate = profile.BirthDate.Date,
|
||||
DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date,
|
||||
Salary = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : (int)lastSalary.Amount.Value,
|
||||
|
|
@ -1367,6 +1367,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestByIdAsync(Guid id)
|
||||
{
|
||||
//var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
|
||||
|
||||
var thisYear = DateTime.Now.Year;
|
||||
|
|
@ -1383,6 +1385,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var userCalendar = await _userCalendarRepository.GetExist(profile.Id);
|
||||
var category = userCalendar == null ? "NORMAL" : userCalendar.Calendar;
|
||||
|
||||
|
|
@ -1411,6 +1415,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
orgName += $" {rawData.Root}";
|
||||
|
||||
|
||||
|
||||
var leaveData = await _leaveBeginningRepository.GetByYearAndTypeIdForUserAsync(thisYear, rawData.Type.Id, rawData.KeycloakUserId);
|
||||
var restDayOld = govAge < 180 ? 0 : leaveData == null ? 0 : leaveData.LeaveDays - 10;
|
||||
var restDayCurrent = govAge < 180 ? 0 : 10;
|
||||
|
||||
|
||||
var result = new GetLeaveRequestByIdDto
|
||||
{
|
||||
Id = rawData.Id,
|
||||
|
|
@ -1451,8 +1461,14 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
WifeDayName = rawData.WifeDayName,
|
||||
WifeDayDateBorn = rawData.WifeDayDateBorn,
|
||||
RestDayOldTotal = rawData.RestDayOldTotal,
|
||||
RestDayCurrentTotal = rawData.RestDayCurrentTotal,
|
||||
|
||||
RestDayOldTotal = restDayOld,
|
||||
RestDayCurrentTotal = restDayCurrent,
|
||||
|
||||
//RestDayOldTotal = rawData.RestDayOldTotal,
|
||||
//RestDayCurrentTotal = rawData.RestDayCurrentTotal,
|
||||
|
||||
|
||||
OrdainDayStatus = rawData.OrdainDayStatus,
|
||||
OrdainDayLocationName = rawData.OrdainDayLocationName,
|
||||
OrdainDayLocationAddress = rawData.OrdainDayLocationAddress,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue