แก้env

This commit is contained in:
Kittapath 2024-07-09 00:04:29 +07:00
parent 5c30206e80
commit 926f02c16f
3 changed files with 3 additions and 326 deletions

View file

@ -13,7 +13,8 @@ env:
IMAGE_NAME: ehr/bma-ehr-report-service
DEPLOY_HOST: frappet.com
DEPLOY_PORT: 10102
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report
COMPOSE_PATH: /home/frappet/docker/bma-ehr
# COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs:

View file

@ -81,181 +81,6 @@ namespace BMA.EHR.Report.Service.Controllers
{
try
{
// var profile_salaries = (from ps in _context.ProfileSalaries
// join pos in _context.PositionPaths
// on ps.PositionId equals pos.Id
// where ps.Profile.Id == id
// select new
// {
// ProfileId = ps.Profile.Id,
// PositionName = pos.Name,
// ps.OcId,
// SalaryDateAnnounce = ps.Date,
// ps.Amount,
// ps.PositionSalaryAmount
// }).ToList();
// var profiles = _context.Profiles.AsQueryable()
// .Include(x => x.Avatar)
// .Include(x => x.Salaries)
// .Include(x => x.Educations)
// .ToList();
// var prefixes = _context.Prefixes.ToList();
// var profile = (from p in profiles
// join pf in prefixes on p.PrefixId equals pf.Id
// where p.Id == id
// select new
// {
// CitizenId = p.CitizenId,
// Prefix = pf.Name,
// p.FirstName,
// p.LastName,
// DateOfBirth = p.BirthDate.ToThaiShortDate(),
// DateRetire = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
// RegistrationAddress = p.RegistrationAddress,
// RegistrationProvince = _context.Provinces.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationProvinceId)?.Name,
// RegistrationDistrict = _context.Districts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationDistrictId)?.Name,
// RegistrationSubDistrict = _context.SubDistricts.AsQueryable().FirstOrDefault(x => x.Id == p.RegistrationSubDistrictId)?.Name,
// RegistrationZipCode = p.RegistrationZipCode,
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
// DateAppoint = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
// Salaries = profile_salaries,
// SalaryAmount = p.Salaries.Count == 0 ? "-"
// : $"{p.Salaries.OrderByDescending(s => s.Date.Value).FirstOrDefault().Amount.Value.ToString("#,##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}",
// AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
// }).FirstOrDefault();
// // _context.PositionPaths.AsQueryable().FirstOrDefault(x => x.Id == p.PositionId)?.Name,
// var data = new List<dynamic>();
// var c = 1;
// if (profile.Salaries.Count == 0)
// {
// var ret2 = new
// {
// CitizenId = profile.CitizenId,
// Prefix = profile.Prefix,
// FirstName = profile.FirstName,
// LastName = profile.LastName,
// DateOfBirth = profile.DateOfBirth,
// DateRetire = profile.DateRetire,
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
// SalaryAmount = profile.SalaryAmount,
// Education = profile.Education,
// AppointText = "",
// SalaryDate = profile.DateAppoint,
// PositionName = "",
// OCFullPath = profile.OcFullPath
// };
// data.Add(ret2);
// }
// var old_date = DateTime.Now;
// var old_position = "";
// var old_ocid = Guid.NewGuid();
// dynamic ret;
// //for (int i = 0; i <= 20; i++)
// //{
// // var s = profile.Salaries[0];
// // old_date = s.SalaryDateAnnounce.Value;
// // old_position = s.PositionName;
// // old_ocid = s.OcId.Value;
// // ret = new
// // {
// // CitizenId = profile.CitizenId,
// // Prefix = profile.Prefix,
// // FirstName = profile.FirstName,
// // LastName = profile.LastName,
// // DateOfBirth = profile.DateOfBirth,
// // DateRetire = profile.DateRetire,
// // RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
// // SalaryAmount = profile.SalaryAmount,
// // Education = profile.Education,
// // AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
// // SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
// // PositionName = s.PositionName,
// // OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
// // };
// // data.Add(ret);
// //}
// foreach (var s in profile.Salaries)
// {
// //if((old_date.Date != s.SalaryDateAnnounce.Value.Date))
// //{
// // old_date = s.SalaryDateAnnounce.Value;
// // old_position= s.PositionName;
// // old_ocid = s.OcId;
// // ret = new
// // {
// // CitizenId = profile.CitizenId,
// // Prefix = profile.Prefix,
// // FirstName = profile.FirstName,
// // LastName = profile.LastName,
// // DateOfBirth = profile.DateOfBirth,
// // RegistrationAddress = profile.RegistrationAddress,
// // SalaryAmount = profile.SalaryAmount,
// // Education = profile.Education,
// // AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
// // SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
// // PositionName = s.PositionName,
// // OCFullPath = CoreCommandReport.GetOrganizationNameFullPath(s.OcId, false, false)
// // };
// // data.Add(ret);
// //}
// if (old_position != s.PositionName)
// {
// old_date = s.SalaryDateAnnounce.Value;
// old_position = s.PositionName;
// old_ocid = s.OcId.Value;
// ret = new
// {
// CitizenId = profile.CitizenId,
// Prefix = profile.Prefix,
// FirstName = profile.FirstName,
// LastName = profile.LastName,
// DateOfBirth = profile.DateOfBirth,
// DateRetire = profile.DateRetire,
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
// SalaryAmount = profile.SalaryAmount,
// Education = profile.Education,
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
// PositionName = s.PositionName,
// OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false)
// };
// data.Add(ret);
// }
// else if (old_ocid != s.OcId)
// {
// old_date = s.SalaryDateAnnounce.Value;
// old_position = s.PositionName;
// old_ocid = s.OcId.Value;
// ret = new
// {
// CitizenId = profile.CitizenId,
// Prefix = profile.Prefix,
// FirstName = profile.FirstName,
// LastName = profile.LastName,
// DateOfBirth = profile.DateOfBirth,
// DateRetire = profile.DateRetire,
// RegistrationAddress = $"{profile.RegistrationAddress}\r\nตำบล/แขวง {profile.RegistrationSubDistrict}\r\nเขต/อำเภอ {profile.RegistrationDistrict}\r\nจังหวัด {profile.RegistrationProvince} รหัสไปรษณีย์ {profile.RegistrationZipCode}",
// SalaryAmount = profile.SalaryAmount,
// Education = profile.Education,
// AppointText = c == 1 ? "(เริ่มรับราชการ)" : "",
// SalaryDate = s.SalaryDateAnnounce.Value.ToThaiShortDate(),
// PositionName = s.PositionName,
// OCFullPath = _profileService.GetOrganizationNameFullPath(s.OcId.Value, false, false),
// };
// data.Add(ret);
// }
// c++;
// }
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
ReportPackager reportPackager = new ReportPackager();
@ -282,10 +107,7 @@ namespace BMA.EHR.Report.Service.Controllers
report.DataSource = org.result;
CitizenId = org.result.CitizenId;
var tblEducation = (Telerik.Reporting.Table)report.Items["groupHeaderSection"].Items["tblEducation"];
Console.WriteLine("ssssssssssssssssssssss");
Console.WriteLine(org.result.Education);
tblEducation.DataSource = org.result.Education;
Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaa");
// report.DataSource = data;
// if (profile.AvatarId != "")
@ -339,152 +161,6 @@ namespace BMA.EHR.Report.Service.Controllers
{
try
{
// var profile = (from p in _context.Profiles
// join pf in _context.Prefixes on p.PrefixId equals pf.Id into p_pf_join
// from p_pf in p_pf_join.DefaultIfEmpty()
// join cpf in _context.Prefixes on p.CouplePrefixId equals cpf.Id into c_pf_join
// from c_pf in c_pf_join.DefaultIfEmpty()
// join fpf in _context.Prefixes on p.FatherPrefixId equals fpf.Id into f_pf_join
// from f_pf in f_pf_join.DefaultIfEmpty()
// join mpf in _context.Prefixes on p.MotherPrefixId equals mpf.Id into m_pf_join
// from m_pf in m_pf_join.DefaultIfEmpty()
// where p.Id == id
// select new
// {
// p.CitizenId,
// Prefix = p_pf == null ? "" : p_pf.Name,
// p.FirstName,
// p.LastName,
// FullName = $"{p.FirstName} {p.LastName}",
// BirthDay = p.BirthDate.Day,
// BirthDayText = Convert.ToDecimal(p.BirthDate.Day).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
// BirthMonth = p.BirthDate.Month.ToThaiMonth(),
// BirthYear = p.BirthDate.Year.ToThaiYear(),
// BirthYearText = Convert.ToDecimal(p.BirthDate.Year.ToThaiYear()).ThaiBahtText(UsesEt.Always, GreatFriends.ThaiBahtText.Unit.Baht, 2, false).Replace("บาท", ""),
// Address = "",
// District = "",
// Area = "",
// Province = "",
// Telephone = p.TelephoneNumber,
// CoupleLastNameOld = p == null ? "" : p.CoupleLastNameOld,
// CouplePrefix = c_pf == null ? "" : c_pf.Name,
// CoupleFullName = $"{p.CoupleFirstName} {p.CoupleLastName}".Trim(),
// FatherPrefix = f_pf == null ? "" : f_pf.Name,
// FatherFullName = $"{p.FatherFirstName} {p.FatherLastName}".Trim(),
// MotherPrefix = m_pf == null ? "" : m_pf.Name,
// MotherFullName = $"{p.MotherFirstName} {p.MotherLastName}".Trim(),
// OcId = p.OcId,
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
// Division = "",
// Institute = "",
// StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate(),
// AppointDate = p.DateAppoint == null ? "" : p.DateAppoint.Value.ToThaiShortDate(),
// BirthDate = p.BirthDate.ToThaiShortDate(),
// RetireDate = p.BirthDate.CalculateRetireDate().ToThaiShortDate(),
// AvatarId = p.Avatar == null ? "" : p.Avatar.Id.ToString("D")
// }).ToList();
// if (!profile.Any())
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
// // certificate
// var cert = (from c in _context.ProfileCertificates.AsQueryable()
// where c.Profile.Id == id
// orderby c.IssueDate.Value.Year
// select new
// {
// c.CertificateType,
// c.Issuer,
// c.CertificateNo,
// IssueDate = c.IssueDate == null ? "" : c.IssueDate.Value.ToThaiShortDate()
// }).ToList();
// // add temp rows
// while (cert.Count < 3)
// {
// cert.Add(new
// {
// CertificateType = "",
// Issuer = "",
// CertificateNo = "",
// IssueDate = ""
// });
// }
// // training
// var training = (from t in _context.ProfileTrainings.AsQueryable()
// where t.Profile.Id == id
// orderby t.StartDate.Value.Year
// select new
// {
// Institute = t.Department,
// Start = t.StartDate == null ? "" : t.StartDate.Value.Year.ToThaiYear().ToString(),
// End = t.EndDate == null ? "" : t.EndDate.Value.Year.ToThaiYear().ToString(),
// Level = "",
// Degree = t.Name,
// Field = ""
// }).ToList();
// while (training.Count < 3)
// {
// training.Add(new
// {
// Institute = "",
// Start = "",
// End = "",
// Level = "",
// Degree = "",
// Field = ""
// });
// }
// // disciplines
// var discipline = (from d in _context.ProfileDisciplines.AsQueryable()
// where d.Profile.Id == id
// orderby d.Date.Value.Year
// select new
// {
// DisciplineYear = d.Date == null ? "" : d.Date.Value.Year.ToThaiYear().ToString(),
// DisciplineDetail = d.Detail,
// RefNo = d.RefCommandNo
// }).ToList();
// while (discipline.Count < 3)
// {
// discipline.Add(new
// {
// DisciplineYear = "",
// DisciplineDetail = "",
// RefNo = ""
// });
// }
// // education
// var education = (from e in _context.ProfileEducations.AsQueryable()
// where e.Profile.Id == id
// orderby e.StartDate.Value.Year
// select new
// {
// Institute = e.Institute,
// Start = e.StartDate == null ? "" : e.StartDate.Value.Year.ToThaiYear().ToString(),
// End = e.EndDate == null ? "" : e.EndDate.Value.Year.ToThaiYear().ToString(),
// Level = e.EducationLevel,
// Degree = e.Degree,
// Field = e.Field.Trim() == "-" ? "" : e.Field
// }).ToList();
// while (education.Count < 4)
// {
// education.Add(new
// {
// Institute = "",
// Start = "",
// End = "",
// Level = "",
// Degree = "",
// Field = ""
// });
// }
var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp");
ReportPackager reportPackager0 = new ReportPackager();
Telerik.Reporting.Report? report0 = null;
@ -522,7 +198,7 @@ namespace BMA.EHR.Report.Service.Controllers
tblInsignia.DataSource = org.result.Insignia;
var tblLeave= (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"];
tblLeave.DataSource = org.result.Leave; ;
tblLeave.DataSource = org.result.Leave;
report.DataSource = org.result.Profile;
// binding to table

Binary file not shown.