no message
This commit is contained in:
parent
e01747cc0a
commit
9fb82fb45a
5 changed files with 479 additions and 404 deletions
43
.github/workflows/release.yaml
vendored
43
.github/workflows/release.yaml
vendored
|
|
@ -11,12 +11,13 @@ on:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
IMAGE_NAME: ehr/bma-ehr-report-service
|
IMAGE_NAME: ehr/bma-ehr-report-service
|
||||||
DEPLOY_HOST: 49.0.91.80
|
DEPLOY_HOST: frappet.com
|
||||||
|
DEPLOY_PORT: 10102
|
||||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report
|
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report
|
||||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||||
release-dev:
|
release-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -60,27 +61,27 @@ jobs:
|
||||||
host: ${{env.DEPLOY_HOST}}
|
host: ${{env.DEPLOY_HOST}}
|
||||||
username: frappet
|
username: frappet
|
||||||
password: ${{ secrets.SSH_PASSWORD }}
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
port: 10102
|
port: ${{env.DEPLOY_PORT}}
|
||||||
script: |
|
script: |
|
||||||
cd "${{env.COMPOSE_PATH}}"
|
cd "${{env.COMPOSE_PATH}}"
|
||||||
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}}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ using iText.Kernel.Pdf;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using Telerik.Reporting;
|
using Telerik.Reporting;
|
||||||
using Telerik.Reporting.Processing;
|
using Telerik.Reporting.Processing;
|
||||||
|
|
||||||
|
|
@ -33,6 +35,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
private readonly string space = "ㅤ";
|
private readonly string space = "ㅤ";
|
||||||
private readonly ProfileService _profileService;
|
private readonly ProfileService _profileService;
|
||||||
private readonly MinIOService _minioService;
|
private readonly MinIOService _minioService;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -43,14 +46,17 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
IWebHostEnvironment hostingEnvironment,
|
IWebHostEnvironment hostingEnvironment,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
ProfileService profileService,
|
ProfileService profileService,
|
||||||
MinIOService minioService)
|
MinIOService minioService,
|
||||||
|
IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
this._context = context;
|
this._context = context;
|
||||||
this._hostingEnvironment = hostingEnvironment;
|
this._hostingEnvironment = hostingEnvironment;
|
||||||
this._configuration = configuration;
|
this._configuration = configuration;
|
||||||
this._profileService = profileService;
|
this._profileService = profileService;
|
||||||
this._minioService = minioService;
|
this._minioService = minioService;
|
||||||
|
this._httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -75,180 +81,180 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var profile_salaries = (from ps in _context.ProfileSalaries
|
// var profile_salaries = (from ps in _context.ProfileSalaries
|
||||||
join pos in _context.PositionPaths
|
// join pos in _context.PositionPaths
|
||||||
on ps.PositionId equals pos.Id
|
// on ps.PositionId equals pos.Id
|
||||||
where ps.Profile.Id == id
|
// where ps.Profile.Id == id
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
ProfileId = ps.Profile.Id,
|
// ProfileId = ps.Profile.Id,
|
||||||
PositionName = pos.Name,
|
// PositionName = pos.Name,
|
||||||
ps.OcId,
|
// ps.OcId,
|
||||||
SalaryDateAnnounce = ps.Date,
|
// SalaryDateAnnounce = ps.Date,
|
||||||
ps.Amount,
|
// ps.Amount,
|
||||||
ps.PositionSalaryAmount
|
// ps.PositionSalaryAmount
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
var profiles = _context.Profiles.AsQueryable()
|
// var profiles = _context.Profiles.AsQueryable()
|
||||||
.Include(x => x.Avatar)
|
// .Include(x => x.Avatar)
|
||||||
.Include(x => x.Salaries)
|
// .Include(x => x.Salaries)
|
||||||
.Include(x => x.Educations)
|
// .Include(x => x.Educations)
|
||||||
.ToList();
|
// .ToList();
|
||||||
var prefixes = _context.Prefixes.ToList();
|
// var prefixes = _context.Prefixes.ToList();
|
||||||
var profile = (from p in profiles
|
// var profile = (from p in profiles
|
||||||
join pf in prefixes on p.PrefixId equals pf.Id
|
// join pf in prefixes on p.PrefixId equals pf.Id
|
||||||
where p.Id == id
|
// where p.Id == id
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
CitizenId = p.CitizenId,
|
// CitizenId = p.CitizenId,
|
||||||
Prefix = pf.Name,
|
// Prefix = pf.Name,
|
||||||
p.FirstName,
|
// p.FirstName,
|
||||||
p.LastName,
|
// p.LastName,
|
||||||
DateOfBirth = p.BirthDate.ToThaiShortDate(),
|
// DateOfBirth = p.BirthDate.ToThaiShortDate(),
|
||||||
DateRetire = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
|
// DateRetire = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
|
||||||
RegistrationAddress = p.RegistrationAddress,
|
// RegistrationAddress = p.RegistrationAddress,
|
||||||
RegistrationProvince = _context.Provinces.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationProvinceId)?.Name,
|
// RegistrationProvince = _context.Provinces.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationProvinceId)?.Name,
|
||||||
RegistrationDistrict = _context.Districts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationDistrictId)?.Name,
|
// RegistrationDistrict = _context.Districts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationDistrictId)?.Name,
|
||||||
RegistrationSubDistrict = _context.SubDistricts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationSubDistrictId)?.Name,
|
// RegistrationSubDistrict = _context.SubDistricts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationSubDistrictId)?.Name,
|
||||||
RegistrationZipCode = p.RegistrationZipCode,
|
// RegistrationZipCode = p.RegistrationZipCode,
|
||||||
OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
||||||
DateAppoint = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
|
// DateAppoint = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
|
||||||
Salaries = profile_salaries,
|
// Salaries = profile_salaries,
|
||||||
SalaryAmount = p.Salaries.Count == 0 ? "-"
|
// SalaryAmount = p.Salaries.Count == 0 ? "-"
|
||||||
: $"{p.Salaries.OrderByDescending(s => s.Date.Value).FirstOrDefault().Amount.Value.ToString("#,##0")}",
|
// : $"{p.Salaries.OrderByDescending(s => s.Date.Value).FirstOrDefault().Amount.Value.ToString("#,##0")}",
|
||||||
Education = p.Educations.Count == 0 ? "-"
|
// Education = p.Educations.Count == 0 ? "-"
|
||||||
: $"{p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Degree} {p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Field}",
|
// : $"{p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Degree} {p.Educations.OrderByDescending(e => e.EndDate.Value.Year).FirstOrDefault().Field}",
|
||||||
AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
|
// AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
|
||||||
}).FirstOrDefault();
|
// }).FirstOrDefault();
|
||||||
// _context.PositionPaths.AsQueryable().FirstOrDefault(x => x.Id == p.PositionId)?.Name,
|
// // _context.PositionPaths.AsQueryable().FirstOrDefault(x => x.Id == p.PositionId)?.Name,
|
||||||
|
|
||||||
var data = new List<dynamic>();
|
// var data = new List<dynamic>();
|
||||||
var c = 1;
|
// var c = 1;
|
||||||
if (profile.Salaries.Count == 0)
|
// if (profile.Salaries.Count == 0)
|
||||||
{
|
// {
|
||||||
var ret2 = new
|
// var ret2 = new
|
||||||
{
|
// {
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
FirstName = profile.FirstName,
|
// FirstName = profile.FirstName,
|
||||||
LastName = profile.LastName,
|
// LastName = profile.LastName,
|
||||||
DateOfBirth = profile.DateOfBirth,
|
// DateOfBirth = profile.DateOfBirth,
|
||||||
DateRetire = profile.DateRetire,
|
// DateRetire = profile.DateRetire,
|
||||||
RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
||||||
SalaryAmount = profile.SalaryAmount,
|
// SalaryAmount = profile.SalaryAmount,
|
||||||
Education = profile.Education,
|
// Education = profile.Education,
|
||||||
AppointText = "",
|
// AppointText = "",
|
||||||
SalaryDate = profile.DateAppoint,
|
// SalaryDate = profile.DateAppoint,
|
||||||
PositionName = "",
|
// PositionName = "",
|
||||||
OCFullPath = profile.OcFullPath
|
// OCFullPath = profile.OcFullPath
|
||||||
};
|
// };
|
||||||
data.Add(ret2);
|
// data.Add(ret2);
|
||||||
}
|
// }
|
||||||
var old_date = DateTime.Now;
|
// var old_date = DateTime.Now;
|
||||||
var old_position = "";
|
// var old_position = "";
|
||||||
var old_ocid = Guid.NewGuid();
|
// var old_ocid = Guid.NewGuid();
|
||||||
dynamic ret;
|
// dynamic ret;
|
||||||
|
|
||||||
//for (int i = 0; i <= 20; i++)
|
// //for (int i = 0; i <= 20; i++)
|
||||||
//{
|
// //{
|
||||||
// var s = profile.Salaries[0];
|
// // var s = profile.Salaries[0];
|
||||||
// old_date = s.SalaryDateAnnounce.Value;
|
// // old_date = s.SalaryDateAnnounce.Value;
|
||||||
// old_position = s.PositionName;
|
// // old_position = s.PositionName;
|
||||||
// old_ocid = s.OcId.Value;
|
// // old_ocid = s.OcId.Value;
|
||||||
// ret = new
|
// // ret = new
|
||||||
// {
|
// // {
|
||||||
// CitizenId = profile.CitizenId,
|
// // CitizenId = profile.CitizenId,
|
||||||
// Prefix = profile.Prefix,
|
// // Prefix = profile.Prefix,
|
||||||
// FirstName = profile.FirstName,
|
// // FirstName = profile.FirstName,
|
||||||
// LastName = profile.LastName,
|
// // LastName = profile.LastName,
|
||||||
// DateOfBirth = profile.DateOfBirth,
|
// // DateOfBirth = profile.DateOfBirth,
|
||||||
// DateRetire = profile.DateRetire,
|
// // DateRetire = profile.DateRetire,
|
||||||
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
// // RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
||||||
// SalaryAmount = profile.SalaryAmount,
|
// // SalaryAmount = profile.SalaryAmount,
|
||||||
// Education = profile.Education,
|
// // Education = profile.Education,
|
||||||
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
// // AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
||||||
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
// // SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
||||||
// PositionName = s.PositionName,
|
// // PositionName = s.PositionName,
|
||||||
// OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
|
// // OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
|
||||||
// };
|
// // };
|
||||||
// data.Add(ret);
|
// // data.Add(ret);
|
||||||
//}
|
// //}
|
||||||
|
|
||||||
foreach (var s in profile.Salaries)
|
// foreach (var s in profile.Salaries)
|
||||||
{
|
// {
|
||||||
//if((old_date.Date != s.SalaryDateAnnounce.Value.Date))
|
// //if((old_date.Date != s.SalaryDateAnnounce.Value.Date))
|
||||||
//{
|
// //{
|
||||||
// old_date = s.SalaryDateAnnounce.Value;
|
// // old_date = s.SalaryDateAnnounce.Value;
|
||||||
// old_position= s.PositionName;
|
// // old_position= s.PositionName;
|
||||||
// old_ocid = s.OcId;
|
// // old_ocid = s.OcId;
|
||||||
|
|
||||||
// ret = new
|
// // ret = new
|
||||||
// {
|
// // {
|
||||||
// CitizenId = profile.CitizenId,
|
// // CitizenId = profile.CitizenId,
|
||||||
// Prefix = profile.Prefix,
|
// // Prefix = profile.Prefix,
|
||||||
// FirstName = profile.FirstName,
|
// // FirstName = profile.FirstName,
|
||||||
// LastName = profile.LastName,
|
// // LastName = profile.LastName,
|
||||||
// DateOfBirth = profile.DateOfBirth,
|
// // DateOfBirth = profile.DateOfBirth,
|
||||||
// RegistrationAddress = profile.RegistrationAddress,
|
// // RegistrationAddress = profile.RegistrationAddress,
|
||||||
// SalaryAmount = profile.SalaryAmount,
|
// // SalaryAmount = profile.SalaryAmount,
|
||||||
// Education = profile.Education,
|
// // Education = profile.Education,
|
||||||
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
// // AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
||||||
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
// // SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
||||||
// PositionName = s.PositionName,
|
// // PositionName = s.PositionName,
|
||||||
// OCFullPath = CoreCommandReport.GetOrganizationNameFullPath(s.OcId, false, false)
|
// // OCFullPath = CoreCommandReport.GetOrganizationNameFullPath(s.OcId, false, false)
|
||||||
// };
|
// // };
|
||||||
// data.Add(ret);
|
// // data.Add(ret);
|
||||||
//}
|
// //}
|
||||||
if (old_position != s.PositionName)
|
// if (old_position != s.PositionName)
|
||||||
{
|
// {
|
||||||
old_date = s.SalaryDateAnnounce.Value;
|
// old_date = s.SalaryDateAnnounce.Value;
|
||||||
old_position = s.PositionName;
|
// old_position = s.PositionName;
|
||||||
old_ocid = s.OcId.Value;
|
// old_ocid = s.OcId.Value;
|
||||||
ret = new
|
// ret = new
|
||||||
{
|
// {
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
FirstName = profile.FirstName,
|
// FirstName = profile.FirstName,
|
||||||
LastName = profile.LastName,
|
// LastName = profile.LastName,
|
||||||
DateOfBirth = profile.DateOfBirth,
|
// DateOfBirth = profile.DateOfBirth,
|
||||||
DateRetire = profile.DateRetire,
|
// DateRetire = profile.DateRetire,
|
||||||
RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
||||||
SalaryAmount = profile.SalaryAmount,
|
// SalaryAmount = profile.SalaryAmount,
|
||||||
Education = profile.Education,
|
// Education = profile.Education,
|
||||||
AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
||||||
SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
||||||
PositionName = s.PositionName,
|
// PositionName = s.PositionName,
|
||||||
OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
|
// OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
|
||||||
};
|
// };
|
||||||
data.Add(ret);
|
// data.Add(ret);
|
||||||
}
|
// }
|
||||||
else if (old_ocid != s.OcId)
|
// else if (old_ocid != s.OcId)
|
||||||
{
|
// {
|
||||||
old_date = s.SalaryDateAnnounce.Value;
|
// old_date = s.SalaryDateAnnounce.Value;
|
||||||
old_position = s.PositionName;
|
// old_position = s.PositionName;
|
||||||
old_ocid = s.OcId.Value;
|
// old_ocid = s.OcId.Value;
|
||||||
ret = new
|
// ret = new
|
||||||
{
|
// {
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
FirstName = profile.FirstName,
|
// FirstName = profile.FirstName,
|
||||||
LastName = profile.LastName,
|
// LastName = profile.LastName,
|
||||||
DateOfBirth = profile.DateOfBirth,
|
// DateOfBirth = profile.DateOfBirth,
|
||||||
DateRetire = profile.DateRetire,
|
// DateRetire = profile.DateRetire,
|
||||||
RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
|
||||||
SalaryAmount = profile.SalaryAmount,
|
// SalaryAmount = profile.SalaryAmount,
|
||||||
Education = profile.Education,
|
// Education = profile.Education,
|
||||||
AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
|
||||||
SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
|
||||||
PositionName = s.PositionName,
|
// PositionName = s.PositionName,
|
||||||
OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false),
|
// OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false),
|
||||||
|
|
||||||
};
|
// };
|
||||||
data.Add(ret);
|
// data.Add(ret);
|
||||||
}
|
// }
|
||||||
|
|
||||||
c++;
|
// c++;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
|
||||||
|
|
||||||
|
|
@ -258,21 +264,39 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
}
|
}
|
||||||
|
var CitizenId = "";
|
||||||
report.DataSource = data;
|
var apiUrl = $"{_configuration["API"]}org/profile/kp7-short/{id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
if (profile.AvatarId != "")
|
|
||||||
{
|
{
|
||||||
try
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<kp7ShortRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
{
|
{
|
||||||
// Get avatar Image
|
return Error("ไม่ะบข้อมูลนี้ในระบบ", 404);
|
||||||
var picContent = (await _minioService.DownloadFileAsync(Guid.Parse(profile.AvatarId))).FileContent;
|
|
||||||
var pictureBox = (Telerik.Reporting.PictureBox)report.Items["groupHeaderSection"].Items["picAvatar"];
|
|
||||||
pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
|
||||||
}
|
}
|
||||||
catch { }
|
report.DataSource = org.result;
|
||||||
|
CitizenId = org.result.CitizenId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// report.DataSource = data;
|
||||||
|
|
||||||
|
// if (profile.AvatarId != "")
|
||||||
|
// {
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// // Get avatar Image
|
||||||
|
// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse("00000000-0000-0000-0000-000000000000"))).FileContent;
|
||||||
|
// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["groupHeaderSection"].Items["picAvatar"];
|
||||||
|
// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
||||||
|
// }
|
||||||
|
// catch { }
|
||||||
|
// }
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
|
@ -285,7 +309,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
var content = result.DocumentBytes;
|
var content = result.DocumentBytes;
|
||||||
return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_{profile.CitizenId}.pdf");
|
return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_{CitizenId}.pdf");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -314,152 +338,152 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var profile = (from p in _context.Profiles
|
// var profile = (from p in _context.Profiles
|
||||||
join pf in _context.Prefixes on p.PrefixId equals pf.Id into p_pf_join
|
// join pf in _context.Prefixes on p.PrefixId equals pf.Id into p_pf_join
|
||||||
from p_pf in p_pf_join.DefaultIfEmpty()
|
// from p_pf in p_pf_join.DefaultIfEmpty()
|
||||||
join cpf in _context.Prefixes on p.CouplePrefixId equals cpf.Id into c_pf_join
|
// join cpf in _context.Prefixes on p.CouplePrefixId equals cpf.Id into c_pf_join
|
||||||
from c_pf in c_pf_join.DefaultIfEmpty()
|
// from c_pf in c_pf_join.DefaultIfEmpty()
|
||||||
join fpf in _context.Prefixes on p.FatherPrefixId equals fpf.Id into f_pf_join
|
// join fpf in _context.Prefixes on p.FatherPrefixId equals fpf.Id into f_pf_join
|
||||||
from f_pf in f_pf_join.DefaultIfEmpty()
|
// from f_pf in f_pf_join.DefaultIfEmpty()
|
||||||
join mpf in _context.Prefixes on p.MotherPrefixId equals mpf.Id into m_pf_join
|
// join mpf in _context.Prefixes on p.MotherPrefixId equals mpf.Id into m_pf_join
|
||||||
from m_pf in m_pf_join.DefaultIfEmpty()
|
// from m_pf in m_pf_join.DefaultIfEmpty()
|
||||||
where p.Id == id
|
// where p.Id == id
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
p.CitizenId,
|
// p.CitizenId,
|
||||||
Prefix = p_pf == null ? "" : p_pf.Name,
|
// Prefix = p_pf == null ? "" : p_pf.Name,
|
||||||
p.FirstName,
|
// p.FirstName,
|
||||||
p.LastName,
|
// p.LastName,
|
||||||
FullName = $"{p.FirstName} {p.LastName}",
|
// FullName = $"{p.FirstName} {p.LastName}",
|
||||||
BirthDay = p.BirthDate.Day,
|
// BirthDay = p.BirthDate.Day,
|
||||||
BirthDayText = Convert.ToDecimal(p.BirthDate.Day).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
|
// BirthDayText = Convert.ToDecimal(p.BirthDate.Day).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
|
||||||
BirthMonth = p.BirthDate.Month.ToThaiMonth(),
|
// BirthMonth = p.BirthDate.Month.ToThaiMonth(),
|
||||||
BirthYear = p.BirthDate.Year.ToThaiYear(),
|
// BirthYear = p.BirthDate.Year.ToThaiYear(),
|
||||||
BirthYearText = Convert.ToDecimal(p.BirthDate.Year.ToThaiYear()).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
|
// BirthYearText = Convert.ToDecimal(p.BirthDate.Year.ToThaiYear()).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
|
||||||
Address = "",
|
// Address = "",
|
||||||
District = "",
|
// District = "",
|
||||||
Area = "",
|
// Area = "",
|
||||||
Province = "",
|
// Province = "",
|
||||||
Telephone = p.TelephoneNumber,
|
// Telephone = p.TelephoneNumber,
|
||||||
CoupleLastNameOld = p == null ? "" : p.CoupleLastNameOld,
|
// CoupleLastNameOld = p == null ? "" : p.CoupleLastNameOld,
|
||||||
CouplePrefix = c_pf == null ? "" : c_pf.Name,
|
// CouplePrefix = c_pf == null ? "" : c_pf.Name,
|
||||||
CoupleFullName = $"{p.CoupleFirstName} {p.CoupleLastName}".Trim(),
|
// CoupleFullName = $"{p.CoupleFirstName} {p.CoupleLastName}".Trim(),
|
||||||
FatherPrefix = f_pf == null ? "" : f_pf.Name,
|
// FatherPrefix = f_pf == null ? "" : f_pf.Name,
|
||||||
FatherFullName = $"{p.FatherFirstName} {p.FatherLastName}".Trim(),
|
// FatherFullName = $"{p.FatherFirstName} {p.FatherLastName}".Trim(),
|
||||||
MotherPrefix = m_pf == null ? "" : m_pf.Name,
|
// MotherPrefix = m_pf == null ? "" : m_pf.Name,
|
||||||
MotherFullName = $"{p.MotherFirstName} {p.MotherLastName}".Trim(),
|
// MotherFullName = $"{p.MotherFirstName} {p.MotherLastName}".Trim(),
|
||||||
OcId = p.OcId,
|
// OcId = p.OcId,
|
||||||
OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
||||||
Division = "",
|
// Division = "",
|
||||||
Institute = "",
|
// Institute = "",
|
||||||
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate(),
|
// StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate(),
|
||||||
AppointDate = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
|
// AppointDate = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
|
||||||
BirthDate = p.BirthDate.ToThaiShortDate(),
|
// BirthDate = p.BirthDate.ToThaiShortDate(),
|
||||||
RetireDate = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
|
// RetireDate = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
|
||||||
AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
|
// AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
if (!profile.Any())
|
// if (!profile.Any())
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
// certificate
|
// // certificate
|
||||||
var cert = (from c in _context.ProfileCertificates.AsQueryable()
|
// var cert = (from c in _context.ProfileCertificates.AsQueryable()
|
||||||
where c.Profile.Id == id
|
// where c.Profile.Id == id
|
||||||
orderby c.IssueDate.Value.Year
|
// orderby c.IssueDate.Value.Year
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
c.CertificateType,
|
// c.CertificateType,
|
||||||
c.Issuer,
|
// c.Issuer,
|
||||||
c.CertificateNo,
|
// c.CertificateNo,
|
||||||
IssueDate = c.IssueDate == null ? "" : c.IssueDate.Value.ToThaiShortDate()
|
// IssueDate = c.IssueDate == null ? "" : c.IssueDate.Value.ToThaiShortDate()
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
// add temp rows
|
// // add temp rows
|
||||||
while (cert.Count < 3)
|
// while (cert.Count < 3)
|
||||||
{
|
// {
|
||||||
cert.Add(new
|
// cert.Add(new
|
||||||
{
|
// {
|
||||||
CertificateType = "",
|
// CertificateType = "",
|
||||||
Issuer = "",
|
// Issuer = "",
|
||||||
CertificateNo = "",
|
// CertificateNo = "",
|
||||||
IssueDate = ""
|
// IssueDate = ""
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
// training
|
// // training
|
||||||
var training = (from t in _context.ProfileTrainings.AsQueryable()
|
// var training = (from t in _context.ProfileTrainings.AsQueryable()
|
||||||
where t.Profile.Id == id
|
// where t.Profile.Id == id
|
||||||
orderby t.StartDate.Value.Year
|
// orderby t.StartDate.Value.Year
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
Institute = t.Department,
|
// Institute = t.Department,
|
||||||
Start = t.StartDate == null ? "" : t.StartDate.Value.Year.ToThaiYear().ToString(),
|
// Start = t.StartDate == null ? "" : t.StartDate.Value.Year.ToThaiYear().ToString(),
|
||||||
End = t.EndDate == null ? "" : t.EndDate.Value.Year.ToThaiYear().ToString(),
|
// End = t.EndDate == null ? "" : t.EndDate.Value.Year.ToThaiYear().ToString(),
|
||||||
Level = "",
|
// Level = "",
|
||||||
Degree = t.Name,
|
// Degree = t.Name,
|
||||||
Field = ""
|
// Field = ""
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
while (training.Count < 3)
|
// while (training.Count < 3)
|
||||||
{
|
// {
|
||||||
training.Add(new
|
// training.Add(new
|
||||||
{
|
// {
|
||||||
Institute = "",
|
// Institute = "",
|
||||||
Start = "",
|
// Start = "",
|
||||||
End = "",
|
// End = "",
|
||||||
Level = "",
|
// Level = "",
|
||||||
Degree = "",
|
// Degree = "",
|
||||||
Field = ""
|
// Field = ""
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
// disciplines
|
// // disciplines
|
||||||
var discipline = (from d in _context.ProfileDisciplines.AsQueryable()
|
// var discipline = (from d in _context.ProfileDisciplines.AsQueryable()
|
||||||
where d.Profile.Id == id
|
// where d.Profile.Id == id
|
||||||
orderby d.Date.Value.Year
|
// orderby d.Date.Value.Year
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
DisciplineYear = d.Date == null ? "" : d.Date.Value.Year.ToThaiYear().ToString(),
|
// DisciplineYear = d.Date == null ? "" : d.Date.Value.Year.ToThaiYear().ToString(),
|
||||||
DisciplineDetail = d.Detail,
|
// DisciplineDetail = d.Detail,
|
||||||
RefNo = d.RefCommandNo
|
// RefNo = d.RefCommandNo
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
while (discipline.Count < 3)
|
// while (discipline.Count < 3)
|
||||||
{
|
// {
|
||||||
discipline.Add(new
|
// discipline.Add(new
|
||||||
{
|
// {
|
||||||
DisciplineYear = "",
|
// DisciplineYear = "",
|
||||||
DisciplineDetail = "",
|
// DisciplineDetail = "",
|
||||||
RefNo = ""
|
// RefNo = ""
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
// education
|
// // education
|
||||||
var education = (from e in _context.ProfileEducations.AsQueryable()
|
// var education = (from e in _context.ProfileEducations.AsQueryable()
|
||||||
where e.Profile.Id == id
|
// where e.Profile.Id == id
|
||||||
orderby e.StartDate.Value.Year
|
// orderby e.StartDate.Value.Year
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
Institute = e.Institute,
|
// Institute = e.Institute,
|
||||||
Start = e.StartDate == null ? "" : e.StartDate.Value.Year.ToThaiYear().ToString(),
|
// Start = e.StartDate == null ? "" : e.StartDate.Value.Year.ToThaiYear().ToString(),
|
||||||
End = e.EndDate == null ? "" : e.EndDate.Value.Year.ToThaiYear().ToString(),
|
// End = e.EndDate == null ? "" : e.EndDate.Value.Year.ToThaiYear().ToString(),
|
||||||
Level = e.EducationLevel,
|
// Level = e.EducationLevel,
|
||||||
Degree = e.Degree,
|
// Degree = e.Degree,
|
||||||
Field = e.Field.Trim() == "-" ? "" : e.Field
|
// Field = e.Field.Trim() == "-" ? "" : e.Field
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
while (education.Count < 4)
|
// while (education.Count < 4)
|
||||||
{
|
// {
|
||||||
education.Add(new
|
// education.Add(new
|
||||||
{
|
// {
|
||||||
Institute = "",
|
// Institute = "",
|
||||||
Start = "",
|
// Start = "",
|
||||||
End = "",
|
// End = "",
|
||||||
Level = "",
|
// Level = "",
|
||||||
Degree = "",
|
// Degree = "",
|
||||||
Field = ""
|
// Field = ""
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp");
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp");
|
||||||
|
|
||||||
|
|
@ -469,33 +493,56 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
}
|
}
|
||||||
report.DataSource = profile;
|
var CitizenId = "";
|
||||||
|
var FullName = "";
|
||||||
// binding to table
|
var OcFullPath = "";
|
||||||
var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
var salary = new List<dynamic>();
|
||||||
tblCertificate.DataSource = cert;
|
var apiUrl = $"{_configuration["API"]}org/profile/kk1/{id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
|
||||||
tblTraining.DataSource = training;
|
|
||||||
|
|
||||||
var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
|
||||||
tblDiscipline.DataSource = discipline;
|
|
||||||
|
|
||||||
var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
|
||||||
tblEducation.DataSource = education;
|
|
||||||
|
|
||||||
if (profile.First().AvatarId != "")
|
|
||||||
{
|
{
|
||||||
try
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
{
|
{
|
||||||
// Get avatar Image
|
return Error("ไม่ะบข้อมูลนี้ในระบบ", 404);
|
||||||
var picContent = (await _minioService.DownloadFileAsync(Guid.Parse(profile.First().AvatarId))).FileContent;
|
|
||||||
var pictureBox = (Telerik.Reporting.PictureBox)report.Items["pageFooterSection1"].Items["picAvatar"];
|
|
||||||
pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
|
||||||
}
|
}
|
||||||
catch { }
|
report.DataSource = org.result.Profile;
|
||||||
|
// binding to table
|
||||||
|
var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
||||||
|
tblCertificate.DataSource = org.result.Cert;
|
||||||
|
|
||||||
|
var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
||||||
|
tblTraining.DataSource = org.result.Training;
|
||||||
|
|
||||||
|
var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
||||||
|
tblDiscipline.DataSource = org.result.Discipline;
|
||||||
|
|
||||||
|
var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
||||||
|
tblEducation.DataSource = org.result.Education;
|
||||||
|
salary = org.result.Salary;
|
||||||
|
CitizenId = org.result.profile.CitizenId;
|
||||||
|
FullName = org.result.profile.FullName;
|
||||||
|
OcFullPath = org.result.profile.OcFullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (profile.First().AvatarId != "")
|
||||||
|
// {
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// // Get avatar Image
|
||||||
|
// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse(profile.First().AvatarId))).FileContent;
|
||||||
|
// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["pageFooterSection1"].Items["picAvatar"];
|
||||||
|
// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
||||||
|
// }
|
||||||
|
// catch { }
|
||||||
|
// }
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
|
@ -510,39 +557,39 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
// byte array waiting for merge pdf
|
// byte array waiting for merge pdf
|
||||||
var content = result.DocumentBytes;
|
var content = result.DocumentBytes;
|
||||||
|
|
||||||
// page2
|
// // page2
|
||||||
var profile2 = (from p in _context.Profiles
|
// var profile2 = (from p in _context.Profiles
|
||||||
join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
// join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
||||||
where p.Id == id
|
// where p.Id == id
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
FullName = $"{pf.Name}{p.FirstName} {p.LastName}",
|
// FullName = $"{pf.Name}{p.FirstName} {p.LastName}",
|
||||||
OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
||||||
}).FirstOrDefault();
|
// }).FirstOrDefault();
|
||||||
|
|
||||||
var salary = (from s in _context.ProfileSalaries
|
// var salary = (from s in _context.ProfileSalaries
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
join pos in _context.PositionPaths.AsQueryable()
|
// join pos in _context.PositionPaths.AsQueryable()
|
||||||
on s.PositionId equals pos.Id
|
// on s.PositionId equals pos.Id
|
||||||
join pos_no in _context.PositionNumbers on s.PosNoId equals pos_no.Id
|
// join pos_no in _context.PositionNumbers on s.PosNoId equals pos_no.Id
|
||||||
// join pos_lv in _context.PositionLevels on s.PositionLevelId equals pos_lv.Id
|
// // join pos_lv in _context.PositionLevels on s.PositionLevelId equals pos_lv.Id
|
||||||
join pos_type in _context.PositionTypes on s.PositionTypeId equals pos_type.Id
|
// join pos_type in _context.PositionTypes on s.PositionTypeId equals pos_type.Id
|
||||||
where s.Profile.Id == id
|
// where s.Profile.Id == id
|
||||||
orderby s.Date.Value
|
// orderby s.Date.Value
|
||||||
select new
|
// select new
|
||||||
{
|
// {
|
||||||
SalaryDate = s.Date == null ? "" : s.Date == new DateTime(1, 1, 1) ? "" : s.Date.Value.ToThaiShortDate(),
|
// SalaryDate = s.Date == null ? "" : s.Date == new DateTime(1, 1, 1) ? "" : s.Date.Value.ToThaiShortDate(),
|
||||||
Position = $"{pos.Name} ประเภท{pos_type.Name} ระดับ{s.PositionLevel.Name}",
|
// Position = $"{pos.Name} ประเภท{pos_type.Name} ระดับ{s.PositionLevel.Name}",
|
||||||
PosNo = pos_no.Name,
|
// PosNo = pos_no.Name,
|
||||||
Rank = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
// Rank = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
||||||
Salary = s.Amount == null ? "" : s.Amount == 0 ? "-" : s.Amount.ToString().ToInteger().ToNumericText(),
|
// Salary = s.Amount == null ? "" : s.Amount == 0 ? "-" : s.Amount.ToString().ToInteger().ToNumericText(),
|
||||||
RefAll = s.SalaryRef,
|
// RefAll = s.SalaryRef,
|
||||||
PositionType = pos_type.Name,
|
// PositionType = pos_type.Name,
|
||||||
PositionLevel = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
// PositionLevel = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
||||||
PositionAmount = s.PositionSalaryAmount == null ? "" : s.PositionSalaryAmount.Value == 0 ? "-" : s.PositionSalaryAmount.Value.ToString().ToInteger().ToNumericText(),
|
// PositionAmount = s.PositionSalaryAmount == null ? "" : s.PositionSalaryAmount.Value == 0 ? "-" : s.PositionSalaryAmount.Value.ToString().ToInteger().ToNumericText(),
|
||||||
FullName = profile2.FullName,
|
// FullName = profile2.FullName,
|
||||||
OcFullPath = profile2.OcFullPath
|
// OcFullPath = profile2.OcFullPath
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
//while (salary.Count < 60)
|
//while (salary.Count < 60)
|
||||||
//{
|
//{
|
||||||
|
|
@ -571,8 +618,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
report2.ReportParameters["FullName"].Value = profile2.FullName;
|
report2.ReportParameters["FullName"].Value = FullName;
|
||||||
report2.ReportParameters["OcFullPath"].Value = profile2.OcFullPath;
|
report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
||||||
|
|
||||||
// binding to table
|
// binding to table
|
||||||
var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
||||||
|
|
@ -626,7 +673,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileContent = ms.ToArray();
|
var fileContent = ms.ToArray();
|
||||||
return File(fileContent, "application/pdf", $"กก_1_{profile[0].CitizenId}.pdf");
|
return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
25
Responses/kp7ShortRequest.cs
Normal file
25
Responses/kp7ShortRequest.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Report.Service.Responses
|
||||||
|
{
|
||||||
|
public class kp7ShortRequest
|
||||||
|
{
|
||||||
|
public OrgRequestData result { get; set; } = new();
|
||||||
|
}
|
||||||
|
public class OrgRequestData
|
||||||
|
{
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
public string? Prefix { get; set; }
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
public string? DateOfBirth { get; set; }
|
||||||
|
public string? DateRetire { get; set; }
|
||||||
|
public string? RegistrationAddress { get; set; }
|
||||||
|
public string? SalaryAmount { get; set; }
|
||||||
|
public string? Education { get; set; }
|
||||||
|
public string? AppointText { get; set; }
|
||||||
|
public string? SalaryDate { get; set; }
|
||||||
|
public string? PositionName { get; set; }
|
||||||
|
public string? OcFullPath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,13 +14,13 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
||||||
"RecruitConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"EHRConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"EHRConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"ExamConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
|
||||||
},
|
},
|
||||||
"EPPlus": {
|
"EPPlus": {
|
||||||
"ExcelPackage": {
|
"ExcelPackage": {
|
||||||
|
|
@ -32,5 +32,6 @@
|
||||||
"AccessKey": "XCiP1ubSyuGS5yDT",
|
"AccessKey": "XCiP1ubSyuGS5yDT",
|
||||||
"SecretKey": "LFnSRyk144oJERvump8UDxPcjjEyzgum",
|
"SecretKey": "LFnSRyk144oJERvump8UDxPcjjEyzgum",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
},
|
||||||
|
"API": "https://bma-ehr.frappet.synology.me/api/v1/"
|
||||||
}
|
}
|
||||||
|
|
@ -14,14 +14,14 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
||||||
"RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"RecruitConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_recruit_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"EHRConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
"EHRConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
"ExamConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
|
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
|
||||||
},
|
},
|
||||||
"EPPlus": {
|
"EPPlus": {
|
||||||
"ExcelPackage": {
|
"ExcelPackage": {
|
||||||
|
|
@ -33,5 +33,6 @@
|
||||||
"AccessKey": "XCiP1ubSyuGS5yDT",
|
"AccessKey": "XCiP1ubSyuGS5yDT",
|
||||||
"SecretKey": "LFnSRyk144oJERvump8UDxPcjjEyzgum",
|
"SecretKey": "LFnSRyk144oJERvump8UDxPcjjEyzgum",
|
||||||
"BucketName": "bma-recruit"
|
"BucketName": "bma-recruit"
|
||||||
}
|
},
|
||||||
|
"API": "https://bma-ehr.frappet.synology.me/api/v1/"
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue