diff --git a/BMA.EHR.Application/Repositories/RetirementRepository.cs b/BMA.EHR.Application/Repositories/RetirementRepository.cs index eb25ebd2..4de888e2 100644 --- a/BMA.EHR.Application/Repositories/RetirementRepository.cs +++ b/BMA.EHR.Application/Repositories/RetirementRepository.cs @@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories await _dbContext.SaveChangesAsync(); } - public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime date) + public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime? date) { // Get UserId from token var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); @@ -220,7 +220,7 @@ namespace BMA.EHR.Application.Repositories } } - public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime date) + public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime? date) { // Get UserId from token var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); @@ -307,7 +307,7 @@ namespace BMA.EHR.Application.Repositories } - public async Task ApproveRetirementResign(Guid id, string reason, DateTime date) + public async Task ApproveRetirementResign(Guid id, string reason, DateTime? date) { // Get UserId from token var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); @@ -387,7 +387,7 @@ namespace BMA.EHR.Application.Repositories } - public async Task RejectRetirementResign(Guid id, string reason, DateTime date) + public async Task RejectRetirementResign(Guid id, string reason, DateTime? date) { // Get UserId from token var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 75442ae2..b5192b46 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -289,8 +289,8 @@ namespace BMA.EHR.Insignia.Service.Controllers /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}")] - public async Task> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status) + [HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}/{isDeputy}")] + public async Task> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status, bool isDeputy) { var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId); if (result != null) @@ -315,7 +315,7 @@ namespace BMA.EHR.Insignia.Service.Controllers Items = new List() }; GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE"); - if (RoleInsignia.isOfficer == true && result.RequestStatus != "st6") + if (RoleInsignia.isOfficer == true && isDeputy == false && result.RequestStatus != "st6") return Success(resend); if (RoleInsignia.isDirector == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2")) return Success(resend); diff --git a/BMA.EHR.Leave/Controllers/LeaveReportController.cs b/BMA.EHR.Leave/Controllers/LeaveReportController.cs index b58c5821..b33c2a1e 100644 --- a/BMA.EHR.Leave/Controllers/LeaveReportController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveReportController.cs @@ -355,8 +355,12 @@ namespace BMA.EHR.Leave.Service.Controllers // if (list.Count > 0) // approver = list.First().Name; //} + if (data != null && data.LeaveSubTypeName == "ลาประกอบพิธีฮัจญ์" && isHajj == false) + { + isHajj = true; + } - if (data.HajjDayStatus == true) + if (isHajj == true) { return new { diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index 3591e8f5..09e04816 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -411,7 +411,7 @@ namespace BMA.EHR.Leave.Service.Controllers // add dear and oc_data //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = profile.Commander ?? ""; + // var approver = profile.Commander ?? ""; var userOc = profile.Root ?? ""; //if (rootOc != null) //{ @@ -422,8 +422,8 @@ namespace BMA.EHR.Leave.Service.Controllers leaveRequest.LeaveTypeCode = leaveType.Code; - leaveRequest.Dear = approver; - leaveRequest.CommanderPosition = profile.CommanderPositionName ?? ""; + leaveRequest.Dear = req.Commander ?? ""; + leaveRequest.CommanderPosition = req.CommanderPositionName ?? ""; // เพิ่มตำแหน่ง //leaveRequest.CommanderPosition = req.CommanderPosition ?? ""; @@ -934,12 +934,12 @@ namespace BMA.EHR.Leave.Service.Controllers SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false), LeaveLast = leaveLast == null ? null : leaveLast, - TelephoneNumber = profile.TelephoneNumber ?? "-", - CurrentAddress = profile.CurrentAddress ?? "-", - CurrentSubDistrict = profile.CurrentSubDistrict ?? "-", - CurrentDistrict = profile.CurrentDistrict ?? "-", - CurrentProvince = profile.CurrentProvince ?? "-", - CurrentZipCode = profile.CurrentZipCode ?? "-", + TelephoneNumber = profile.TelephoneNumber ?? "", + CurrentAddress = profile.CurrentAddress ?? "", + CurrentSubDistrict = profile.CurrentSubDistrict ?? "", + CurrentDistrict = profile.CurrentDistrict ?? "", + CurrentProvince = profile.CurrentProvince ?? "", + CurrentZipCode = profile.CurrentZipCode ?? "", }; return Success(result); @@ -1772,7 +1772,7 @@ namespace BMA.EHR.Leave.Service.Controllers else if (role == "ROOT") { nodeId = profileAdmin?.RootDnaId; - } + } var rawData = await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status, role, nodeId, profileAdmin?.Node); diff --git a/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveRequestDto.cs b/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveRequestDto.cs index b8cc2c03..21ceea77 100644 --- a/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveRequestDto.cs +++ b/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveRequestDto.cs @@ -102,7 +102,11 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest public DateTime? CoupleDayEndDateHistory { get; set; } public string? CoupleDaySumTotalHistory { get; set; } + + public string? Commander { get; set; } + + public string? CommanderPositionName { get; set; } } - + } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 4ca0cd89..759a68a3 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -2663,7 +2663,7 @@ namespace BMA.EHR.Retirement.Service.Controllers // { // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // } - await _repository.CommanderApproveRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); + await _repository.CommanderApproveRetirementResign(id, req.Reason ?? "", null); return Success(); } @@ -2697,7 +2697,7 @@ namespace BMA.EHR.Retirement.Service.Controllers // { // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // } - await _repository.CommanderRejectRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); + await _repository.CommanderRejectRetirementResign(id, req.Reason ?? "", req.Date); return Success(); } @@ -2731,7 +2731,7 @@ namespace BMA.EHR.Retirement.Service.Controllers // { // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // } - await _repository.ApproveRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); + await _repository.ApproveRetirementResign(id, req.Reason ?? "", null); return Success(); } @@ -2765,7 +2765,7 @@ namespace BMA.EHR.Retirement.Service.Controllers // { // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // } - await _repository.RejectRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); + await _repository.RejectRetirementResign(id, req.Reason ?? "", req.Date); return Success(); }