test parent
This commit is contained in:
parent
84ab5e79d6
commit
f97e643ac1
20 changed files with 155 additions and 264 deletions
|
|
@ -285,7 +285,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var endFiscalDate = new DateTime(year, 9, 30);
|
||||
rawData = rawData.Where(x => x.LeaveStartDate.Date >= startFiscalDate && x.LeaveStartDate.Date <= endFiscalDate);
|
||||
}
|
||||
//rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
//rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
|
||||
if (type != Guid.Empty)
|
||||
rawData = rawData.Where(x => x.Type.Id == type);
|
||||
|
|
@ -366,7 +366,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
else if (role == "PARENT")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.Child1DnaId == Guid.Parse(nodeId!));
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null);
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
|
|
@ -538,7 +538,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
else if (role == "PARENT")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.Child1DnaId == Guid.Parse(nodeId!));
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null);
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
|
|
@ -573,7 +573,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
var toDay = data.LeaveStartDate.Date;
|
||||
var thisYear = data.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
if (toDay >= new DateTime(thisYear, 10, 1) && toDay <= new DateTime(thisYear, 12, 31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
var toDay = rawData.LeaveStartDate.Date;
|
||||
var thisYear = rawData.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
if (toDay >= new DateTime(thisYear, 10, 1) && toDay <= new DateTime(thisYear, 12, 31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
|
|
@ -1111,7 +1111,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
var toDay = rawData.LeaveStartDate.Date;
|
||||
var thisYear = rawData.LeaveStartDate.Year;
|
||||
if(toDay >= new DateTime(thisYear,10,1) && toDay <= new DateTime(thisYear,12,31))
|
||||
if (toDay >= new DateTime(thisYear, 10, 1) && toDay <= new DateTime(thisYear, 12, 31))
|
||||
{
|
||||
thisYear = thisYear + 1;
|
||||
}
|
||||
|
|
@ -1529,7 +1529,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
}
|
||||
else if (role == "PARENT")
|
||||
{
|
||||
data = data.Where(x => x.Child1DnaId == Guid.Parse(nodeId)).ToList();
|
||||
data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId) && x.Child1DnaId != null).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
|
|
@ -1568,46 +1568,46 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
from grp in grouped
|
||||
orderby grp.Key
|
||||
select new GetSumApproveLeaveByRootDto
|
||||
{
|
||||
//Root = $"{grp.Key.Root}{(!string.IsNullOrEmpty(grp.Key.Child1) ? "/" + grp.Key.Child1 : "")}{(!string.IsNullOrEmpty(grp.Key.Child2) ? "/" + grp.Key.Child2 : "")}{(!string.IsNullOrEmpty(grp.Key.Child3) ? "/" + grp.Key.Child3 : "")}{(!string.IsNullOrEmpty(grp.Key.Child4) ? "/" + grp.Key.Child4 : "")}",
|
||||
Root = organizationName,
|
||||
SumLeaveDay = grp.Sum(x => x.LeaveTotal),
|
||||
sickDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
{
|
||||
//Root = $"{grp.Key.Root}{(!string.IsNullOrEmpty(grp.Key.Child1) ? "/" + grp.Key.Child1 : "")}{(!string.IsNullOrEmpty(grp.Key.Child2) ? "/" + grp.Key.Child2 : "")}{(!string.IsNullOrEmpty(grp.Key.Child3) ? "/" + grp.Key.Child3 : "")}{(!string.IsNullOrEmpty(grp.Key.Child4) ? "/" + grp.Key.Child4 : "")}",
|
||||
Root = organizationName,
|
||||
SumLeaveDay = grp.Sum(x => x.LeaveTotal),
|
||||
sickDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
|
||||
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
|
||||
sickDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
})
|
||||
sickDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
|
||||
maternityDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
|
||||
wifeDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
|
||||
personalDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
|
||||
restDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
|
||||
ordainDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
|
||||
absentDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
|
||||
studyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
|
||||
agencyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
|
||||
coupleDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
|
||||
therapyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
else if (role == "PARENT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.Child1DnaId == Guid.Parse(nodeId!)).ToList();
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
}
|
||||
else if (role == "PARENT")
|
||||
{
|
||||
data = data.Where(x => x.Child1DnaId == Guid.Parse(nodeId)).ToList();
|
||||
data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId) && x.Child1DnaId != null).ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
|
|
@ -274,7 +274,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
else if (role == "PARENT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.Child1DnaId == Guid.Parse(nodeId!))
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
else if (role == "PARENT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.Child1DnaId == Guid.Parse(nodeId!))
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue