Correct Sort and Group Report

This commit is contained in:
Suphonchai Phoonsawat 2023-06-22 09:24:09 +07:00
parent 1325eb82a6
commit 80ce27f324
3 changed files with 5 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View file

@ -337,7 +337,7 @@ namespace BMA.EHR.Report.Service.Services
join ptNew in positionTypes on rp == null ? pm?.PositionTypeId : rp?.PositionTypeId equals ptNew?.Id into ptNewGroup join ptNew in positionTypes on rp == null ? pm?.PositionTypeId : rp?.PositionTypeId equals ptNew?.Id into ptNewGroup
from ptNew in ptNewGroup.DefaultIfEmpty() from ptNew in ptNewGroup.DefaultIfEmpty()
join orgOrder in orgWithOrder on op.OrganizationId equals orgOrder.Id //join orgOrder in orgWithOrder on op.OrganizationId equals orgOrder.Id
select new select new
@ -369,14 +369,14 @@ namespace BMA.EHR.Report.Service.Services
PositionExecutiveSideOld = rp == null ? (pes == null ? null : pes.Name) : rp.PositionExecutiveSideOld, PositionExecutiveSideOld = rp == null ? (pes == null ? null : pes.Name) : rp.PositionExecutiveSideOld,
PositionExecutiveSideNew = pesNew == null ? null : pesNew.Name, PositionExecutiveSideNew = pesNew == null ? null : pesNew.Name,
Remark = op.PositionUserNote ?? "", Remark = op.PositionUserNote ?? "",
OcOrder = orgOrder.Order, //OcOrder = orgOrder.Order,
PositonTypeOld = rp == null ? (pt == null ? null : pt.Name) : rp.PositionTypeOld, PositonTypeOld = rp == null ? (pt == null ? null : pt.Name) : rp.PositionTypeOld,
PositionTypeNew = ptNew == null ? null : ptNew.Name, PositionTypeNew = ptNew == null ? null : ptNew.Name,
}) })
.ToList(); .ToList();
//.OrderBy(x => x.OcOrder).ThenBy(x => GetPosnoIntFromPosNo(x.PositionNumberOld)) //.OrderBy(x => x.OcOrder).ThenBy(x => GetPosnoIntFromPosNo(x.PositionNumberOld))
//.ToList(); //.ToList();
var results = new List<Account2ResultItem>(); var results = new List<Account2ResultItem>();
@ -438,7 +438,7 @@ namespace BMA.EHR.Report.Service.Services
Salary = salaryRecord == null || salaryRecord.Amount == null ? 0 : (int)salaryRecord.Amount!.Value, Salary = salaryRecord == null || salaryRecord.Amount == null ? 0 : (int)salaryRecord.Amount!.Value,
SalaryPosition = salaryRecord == null || salaryRecord.PositionSalaryAmount == null ? 0 : (int)salaryRecord.PositionSalaryAmount!.Value, SalaryPosition = salaryRecord == null || salaryRecord.PositionSalaryAmount == null ? 0 : (int)salaryRecord.PositionSalaryAmount!.Value,
OcOrder = r.OcOrder OcOrder = orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault() == null ? 0 : orgWithOrder.Where(x => x.Id == r.ocIdNew).FirstOrDefault().Order
}; };
results.Add(data); results.Add(data);
} }