fix report
This commit is contained in:
parent
26b3f43c16
commit
5725cdbb95
3 changed files with 47 additions and 22 deletions
|
|
@ -336,11 +336,11 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
.OrderBy(x => x.SeatNumber)
|
.OrderBy(x => x.SeatNumber)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
ExamId = p.SeatNumber == null ? null : (p.SeatNumber),
|
ExamId = p.SeatNumber == null ? null : (p.SeatNumber.ToThaiNumber()),
|
||||||
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
|
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
|
||||||
PositionName = "",
|
PositionName = "",
|
||||||
ExamName =
|
ExamName =
|
||||||
($"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}"),
|
($"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}").ToThaiNumber(),
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
if (data.Count == 0)
|
if (data.Count == 0)
|
||||||
|
|
@ -355,6 +355,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
report.DataSource = data;
|
report.DataSource = data;
|
||||||
|
var table = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
||||||
|
table.DataSource = data;
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
|
@ -469,32 +471,53 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var periodExam = await _context.PeriodExams.AsQueryable().Where(x => x.Id == id).FirstOrDefaultAsync();
|
var periodExam = await _context.PeriodExams.AsQueryable().Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
var data = await _context.Candidates.AsQueryable()
|
var candidates = await _context.Candidates.AsQueryable()
|
||||||
.Include(x => x.PeriodExam)
|
.Include(x => x.PeriodExam)
|
||||||
.ThenInclude(x => x.ScoreImport)
|
.ThenInclude(x => x.ScoreImport)
|
||||||
.Where(x => x.PeriodExam == periodExam)
|
.Where(x => x.PeriodExam == periodExam)
|
||||||
.Where(x => x.Status != "register")
|
.Where(x => x.Status != "register")
|
||||||
.Select(p => new
|
//.Select((p, idx) => new
|
||||||
{
|
//{
|
||||||
ExamId = p.SeatNumber == null ? "-" : (p.SeatNumber),
|
// ExamId = p.SeatNumber == null ? "-" : (p.SeatNumber.ToThaiNumber()),
|
||||||
CitizenId = p.CitizenId == null ? "-" : (p.CitizenId),
|
// CitizenId = p.CitizenId == null ? "-" : (p.CitizenId.ToThaiNumber()),
|
||||||
FullName = $"{p.FirstName} {p.LastName}",
|
// FullName = $"{p.FirstName} {p.LastName}",
|
||||||
DateOfBirth = p.DateOfBirth == null ? "-" : (p.DateOfBirth.Value.ToThaiShortDate()),
|
// DateOfBirth = p.DateOfBirth == null ? "-" : (p.DateOfBirth.Value.ToThaiShortDate()),
|
||||||
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}",
|
// ExamName = ($"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}").ToThaiNumber(),
|
||||||
Number = p.Number == null ? 99999 : Convert.ToInt32(p.Number),
|
// Number = p.Number == null ? 99999 : Convert.ToInt32(p.Number),
|
||||||
FullA = ("๐"),
|
// FullA = ("๐"),
|
||||||
SumA = ("๐"),
|
// SumA = ("๐"),
|
||||||
FullB = p.PointTotalB == null ? "-" : (p.PointTotalB.ToString()),
|
// FullB = p.PointTotalB == null ? "-" : (p.PointTotalB.ToString()),
|
||||||
SumB = p.PointB == null ? "-" : (p.PointB.ToString()),
|
// SumB = p.PointB == null ? "-" : (p.PointB.ToString()),
|
||||||
FullC = p.PointTotalC == null ? "-" : (p.PointTotalC.ToString()),
|
// FullC = p.PointTotalC == null ? "-" : (p.PointTotalC.ToString()),
|
||||||
SumC = p.PointC == null ? "-" : (p.PointC.ToString()),
|
// SumC = p.PointC == null ? "-" : (p.PointC.ToString()),
|
||||||
SumScore = ((Convert.ToInt32(p.PointB ?? "0") + Convert.ToInt32(p.PointC ?? "0")).ToString()),
|
// SumScore = ((Convert.ToInt32(p.PointB ?? "0") + Convert.ToInt32(p.PointC ?? "0")).ToString()).ToThaiNumber(),
|
||||||
ExamResult = p.Pass
|
// ExamResult = p.Pass
|
||||||
})
|
//})
|
||||||
.OrderBy(x => x.Number)
|
//.OrderBy(x => x.Number)
|
||||||
.Where(x => x.ExamResult == "ได้")
|
//.Where(x => x.ExamResult == "ได้")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
var data = candidates.Select((p, idx) => new
|
||||||
|
{
|
||||||
|
ExamId = p.SeatNumber == null ? "-" : (p.SeatNumber.ToThaiNumber()),
|
||||||
|
CitizenId = p.CitizenId == null ? "-" : (p.CitizenId.ToThaiNumber()),
|
||||||
|
FullName = $"{p.FirstName} {p.LastName}",
|
||||||
|
DateOfBirth = p.DateOfBirth == null ? "-" : (p.DateOfBirth.Value.ToThaiShortDate()),
|
||||||
|
ExamName = ($"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}").ToThaiNumber(),
|
||||||
|
Number = p.Number == null ? (idx + 1).ToString().ToThaiNumber() : p.Number.ToThaiNumber(),
|
||||||
|
FullA = "๐",
|
||||||
|
SumA = "๐",
|
||||||
|
FullB = p.PointTotalB == null ? "-" : p.PointTotalB.ToString(),
|
||||||
|
SumB = p.PointB == null ? "-" : p.PointB.ToString(),
|
||||||
|
FullC = p.PointTotalC == null ? "-" : p.PointTotalC.ToString(),
|
||||||
|
SumC = p.PointC == null ? "-" : p.PointC.ToString(),
|
||||||
|
SumScore = ((Convert.ToInt32(p.PointB ?? "0") + Convert.ToInt32(p.PointC ?? "0")).ToString()).ToThaiNumber(),
|
||||||
|
ExamResult = p.Pass
|
||||||
|
})
|
||||||
|
.OrderBy(x => x.Number)
|
||||||
|
.Where(x => x.ExamResult == "ได้")
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (data.Count == 0)
|
if (data.Count == 0)
|
||||||
return Error("ไม่พบข้อมูลในระบบ");
|
return Error("ไม่พบข้อมูลในระบบ");
|
||||||
|
|
||||||
|
|
@ -507,6 +530,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
report.DataSource = data;
|
report.DataSource = data;
|
||||||
|
var table = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
||||||
|
table.DataSource = data;
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue