แก้ report สรรหา

This commit is contained in:
Kittapath 2023-09-24 04:10:31 +07:00
parent 654ea28942
commit 723c95dfbc
15 changed files with 175 additions and 57 deletions

View file

@ -66,21 +66,21 @@ jobs:
docker-compose pull docker-compose pull
docker-compose up -d docker-compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- uses: snow-actions/line-notify@v1.1.0 # - uses: snow-actions/line-notify@v1.1.0
if: success() # if: success()
with: # with:
access_token: ${{ env.TOKEN_LINE }} # access_token: ${{ env.TOKEN_LINE }}
message: | # message: |
-Success✅✅✅ # -Success✅✅✅
Image: ${{env.IMAGE_NAME}} # Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }} # Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}} # By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0 # - uses: snow-actions/line-notify@v1.1.0
if: failure() # if: failure()
with: # with:
access_token: ${{ env.TOKEN_LINE }} # access_token: ${{ env.TOKEN_LINE }}
message: | # message: |
-Failure❌❌❌ # -Failure❌❌❌
Image: ${{env.IMAGE_NAME}} # Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }} # Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}} # By: ${{secrets.DOCKER_USER}}

View file

@ -59,10 +59,35 @@
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="ThaiBahtText" Version="1.0.103" /> <PackageReference Include="ThaiBahtText" Version="1.0.103" />
<PackageReference Include="WatchDog.NET" Version="1.4.6" /> <PackageReference Include="WatchDog.NET" Version="1.4.6" />
<PackageReference Include="Telerik.Reporting" Version="17.0.23.315" /> <PackageReference Include="Telerik.Reporting" Version="17.1.23.718" />
<!-- <PackageReference Include="Telerik.Reporting.OpenXmlRendering" Version="17.1.23.718" /> -->
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="Fonts\THSarabunIT.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunITBold.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunITBoldItalic.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunITItalic.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunNew.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunNewBold.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunNewBoldItalic.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fonts\THSarabunNewItalic.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Report\Organization\rptAccount1.trdp"> <None Update="Report\Organization\rptAccount1.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>

View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34018.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service.csproj", "{9A1007A3-3834-4E1F-B242-15CCFEB16BD6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A1007A3-3834-4E1F-B242-15CCFEB16BD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A1007A3-3834-4E1F-B242-15CCFEB16BD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A1007A3-3834-4E1F-B242-15CCFEB16BD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A1007A3-3834-4E1F-B242-15CCFEB16BD6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7C1B80B2-3A5E-42A3-9949-5749FB145086}
EndGlobalSection
EndGlobal

View file

@ -9,6 +9,7 @@ using Telerik.Reporting;
using BMA.EHR.Report.Service.Responses; using BMA.EHR.Report.Service.Responses;
using BMA.EHR.Extensions; using BMA.EHR.Extensions;
using BMA.EHR.Core; using BMA.EHR.Core;
using System.Text;
namespace BMA.EHR.Report.Service.Controllers namespace BMA.EHR.Report.Service.Controllers
{ {
@ -61,6 +62,27 @@ namespace BMA.EHR.Report.Service.Controllers
throw; throw;
} }
} }
private string ToThaiNumber(string? value)
{
if (value == null)
return "";
string arabicNumbers = "0123456789";
string thaiNumbers = "๐๑๒๓๔๕๖๗๘๙";
StringBuilder result = new StringBuilder();
foreach (char digit in value)
{
int index = arabicNumbers.IndexOf(digit);
if (index >= 0)
{
result.Append(thaiNumbers[index]);
}
else
{
result.Append(digit);
}
}
return result.ToString();
}
#endregion #endregion
@ -96,12 +118,12 @@ namespace BMA.EHR.Report.Service.Controllers
(p, sr) => new (p, sr) => new
{ {
ExamID = p.ExamId, ExamID = p.ExamId,
p.CitizenId, CitizenId = p.CitizenId == null ? "-" : (p.CitizenId),
Order = p.PeriodExam.Round, Order = (p.PeriodExam.Round.ToString()),
Year = p.PeriodExam.Year.Value.ToThaiYear(), Year = (p.PeriodExam.Year.Value.ToThaiYear().ToString()),
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
ExamResult = sr == null ? "" : sr.ExamStatus, ExamResult = sr == null ? "" : sr.ExamStatus,
EndDate = p.PeriodExam.RegisterEndDate.ToThaiFullDate3(), EndDate = (p.PeriodExam.RegisterEndDate.ToThaiFullDate3()),
AuthName = "นายณัฐพงศ์ ดิษยบุตร", AuthName = "นายณัฐพงศ์ ดิษยบุตร",
AuthPosition = "หัวหน้าสำนักงาน ก.ก." AuthPosition = "หัวหน้าสำนักงาน ก.ก."
}) })
@ -170,27 +192,27 @@ namespace BMA.EHR.Report.Service.Controllers
(p, sr) => new (p, sr) => new
{ {
ExamId = p.ExamId, ExamId = p.ExamId,
CitizenId = p.CitizenId, CitizenId = p.CitizenId == null ? "-" : (p.CitizenId),
p.Prefix, p.Prefix,
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
DateOfBirth = p.DateOfBirth.ToThaiShortDate(), DateOfBirth = (p.DateOfBirth.ToThaiShortDate()),
Gender = p.Gendor, Gender = p.Gendor,
Degree = p.Educations.First().Degree, Degree = p.Educations.First().Degree,
Major = p.Educations.First().Major, Major = p.Educations.First().Major,
ExamResult = sr == null ? "" : sr.ExamStatus, ExamResult = sr == null ? "" : sr.ExamStatus,
University = p.Educations.First().University, University = p.Educations.First().University,
PositionName = p.PositionName, PositionName = p.PositionName,
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}", ExamName = ($"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}"),
Number = sr == null ? "" : sr.Number, Number = sr == null ? "" : (sr.Number),
// ExamCount = 10, // ExamCount = 10,
// ExamCount = GetExamCountTes(p.CitizenId), // ExamCount = GetExamCountTes(p.CitizenId),
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate(), ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : (p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate()),
FullA = sr == null ? 0 : sr.FullA, FullA = sr == null ? "" : (sr.FullA.ToString()),
SumA = sr == null ? 0 : sr.SumA, SumA = sr == null ? "" : (sr.SumA.ToString()),
FullB = sr == null ? 0 : sr.FullB, FullB = sr == null ? "" : (sr.FullB.ToString()),
SumB = sr == null ? 0 : sr.SumB, SumB = sr == null ? "" : (sr.SumB.ToString()),
FullC = sr == null ? 0 : sr.FullC, FullC = sr == null ? "" : (sr.FullC.ToString()),
SumC = sr == null ? 0 : sr.SumC, SumC = sr == null ? "" : (sr.SumC.ToString()),
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptExamResult.trdp"); var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptExamResult.trdp");
@ -262,11 +284,11 @@ namespace BMA.EHR.Report.Service.Controllers
.OrderBy(x => x.ExamId) .OrderBy(x => x.ExamId)
.Select(p => new .Select(p => new
{ {
ExamId = p.ExamId, ExamId = p.ExamId == null ? null : (p.ExamId),
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
PositionName = p.PositionName, PositionName = p.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()}"),
}).ToListAsync(); }).ToListAsync();
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCandidateList.trdp"); var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCandidateList.trdp");
@ -314,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, ExamId = p.SeatNumber == null ? null : (p.SeatNumber),
FullName = $"{p.FirstName} {p.LastName}", FullName = $"{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()}"),
}).ToListAsync(); }).ToListAsync();
if (data.Count == 0) if (data.Count == 0)
@ -379,10 +401,10 @@ namespace BMA.EHR.Report.Service.Controllers
{ {
Id = p.PeriodExam.Id, Id = p.PeriodExam.Id,
ExamId = p.ExamId, ExamId = p.ExamId,
CitizenId = p.CitizenId, CitizenId = p.CitizenId == null ? "-" : (p.CitizenId),
p.Prefix, p.Prefix,
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
DateOfBirth = p.DateOfBirth.ToThaiShortDate(), DateOfBirth = (p.DateOfBirth.ToThaiShortDate()),
Gender = p.Gendor, Gender = p.Gendor,
Degree = p.Educations.First().Degree, Degree = p.Educations.First().Degree,
Major = p.Educations.First().Major, Major = p.Educations.First().Major,
@ -391,13 +413,13 @@ namespace BMA.EHR.Report.Service.Controllers
PositionName = p.PositionName, PositionName = p.PositionName,
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}", ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}",
Number = sr == null ? 99999 : Convert.ToInt32(sr.Number), Number = sr == null ? 99999 : Convert.ToInt32(sr.Number),
FullA = sr == null ? 0 : sr.FullA, FullA = sr == null ? "" : (sr.FullA.ToString()),
SumA = sr == null ? 0 : sr.SumA, SumA = sr == null ? "" : (sr.SumA.ToString()),
FullB = sr == null ? 0 : sr.FullB, FullB = sr == null ? "" : (sr.FullB.ToString()),
SumB = sr == null ? 0 : sr.SumB, SumB = sr == null ? "" : (sr.SumB.ToString()),
FullC = sr == null ? 0 : sr.FullC, FullC = sr == null ? "" : (sr.FullC.ToString()),
SumC = sr == null ? 0 : sr.SumC, SumC = sr == null ? "" : (sr.SumC.ToString()),
SumScore = sr == null ? 0 : sr.SumA + sr.SumB + sr.SumC, SumScore = sr == null ? "" : ((sr.SumA + sr.SumB + sr.SumC).ToString()),
}) })
.OrderBy(x => x.Number) .OrderBy(x => x.Number)
.Where(x => x.Id == id) .Where(x => x.Id == id)
@ -454,19 +476,19 @@ namespace BMA.EHR.Report.Service.Controllers
.Where(x => x.Status != "register") .Where(x => x.Status != "register")
.Select(p => new .Select(p => new
{ {
ExamId = p.SeatNumber, ExamId = p.SeatNumber == null ? "-" : (p.SeatNumber),
CitizenId = p.CitizenId, CitizenId = p.CitizenId == null ? "-" : (p.CitizenId),
FullName = $"{p.FirstName} {p.LastName}", FullName = $"{p.FirstName} {p.LastName}",
DateOfBirth = 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()}",
Number = p.Number == null ? 99999 : Convert.ToInt32(p.Number), Number = p.Number == null ? 99999 : Convert.ToInt32(p.Number),
FullA = 0, FullA = (""),
SumA = 0, SumA = (""),
FullB = p.PointTotalB, FullB = p.PointTotalB == null ? "-" : (p.PointTotalB.ToString()),
SumB = p.PointB, SumB = p.PointB == null ? "-" : (p.PointB.ToString()),
FullC = p.PointTotalC, FullC = p.PointTotalC == null ? "-" : (p.PointTotalC.ToString()),
SumC = p.PointC, SumC = p.PointC == null ? "-" : (p.PointC.ToString()),
SumScore = Convert.ToInt32(p.PointB ?? "0") + Convert.ToInt32(p.PointC ?? "0"), SumScore = ((Convert.ToInt32(p.PointB ?? "0") + Convert.ToInt32(p.PointC ?? "0")).ToString()),
ExamResult = p.Pass ExamResult = p.Pass
}) })
.OrderBy(x => x.Number) .OrderBy(x => x.Number)

BIN
Fonts/THSarabun.ttf Normal file

Binary file not shown.

BIN
Fonts/THSarabunBold.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
Fonts/THSarabunItalic.ttf Normal file

Binary file not shown.

View file

@ -30,6 +30,16 @@
"dotnetRunMessages": true, "dotnetRunMessages": true,
"applicationUrl": "https://localhost:7187;http://localhost:5215" "applicationUrl": "https://localhost:7187;http://localhost:5215"
}, },
"report-designer": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "designer.html",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7187;http://localhost:5215"
},
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
"launchBrowser": true, "launchBrowser": true,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

36
wwwroot/designer.html Normal file
View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Telerik Web Report Designer</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" rel="stylesheet">
</head>
<body>
<div id="webReportDesigner">
loading...
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/kendo.all.min.js"></script>
<script src="/api/reportdesigner/resources/js/telerikReportViewer/"></script>
<script src="/api/reportdesigner/designerresources/js/webReportDesigner/"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#webReportDesigner").telerik_WebReportDesigner({
toolboxArea: {
layout: "list" //Change to "grid" to display the contents of the Components area in a flow grid layout.
},
serviceUrl: "/api/reportdesigner",
report: "01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp"
}).data("telerik_WebDesigner");
});
</script>
</body>
</html>