#2551
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m51s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m51s
This commit is contained in:
parent
030098c0b9
commit
5d090fa7bd
2 changed files with 51 additions and 9 deletions
|
|
@ -172,11 +172,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var prev = _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||
var isCurrentYear = DateTime.Now.Year == year;
|
||||
|
||||
|
||||
var prevRemain = 0.0;
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
|
|
@ -239,6 +243,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
var prevRemain = 0.0;
|
||||
|
||||
|
||||
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue