Merge branch 'develop' into working
This commit is contained in:
commit
9301935f9a
40 changed files with 16527 additions and 35 deletions
2
.github/workflows/release_Retirement.yaml
vendored
2
.github/workflows/release_Retirement.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_retirement.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_retirement.yaml --input IMAGE_VER=retirement-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
2
.github/workflows/release_command.yaml
vendored
2
.github/workflows/release_command.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_command.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_command.yaml --input IMAGE_VER=command-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
2
.github/workflows/release_insignia.yaml
vendored
2
.github/workflows/release_insignia.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_insignia.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_insignia.yaml --input IMAGE_VER=insignia-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
2
.github/workflows/release_orgEmployee.yaml
vendored
2
.github/workflows/release_orgEmployee.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_ore-employee.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_ore-employee.yaml --input IMAGE_VER=orgEmployee-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
2
.github/workflows/release_placement.yaml
vendored
2
.github/workflows/release_placement.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_placement.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_placement.yaml --input IMAGE_VER=placement-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
2
.github/workflows/release_report.yaml
vendored
2
.github/workflows/release_report.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
|||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_report.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_report.yaml --input IMAGE_VER=report-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -5732,13 +5732,26 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
data.Profile.EmployeeClass = "perm"; // ลจ ประจำ
|
||||
data.Profile.OcId = data.OrgEmployee.Organization == null ? null : data.OrgEmployee.Organization.Id;
|
||||
// data.Profile.Oc = "xxx";
|
||||
data.Profile.PosNoEmployee = data.OrgEmployee.PosNo;
|
||||
data.Profile.PositionEmployeePosition = data.OrgEmployee.PositionEmployeePosition;
|
||||
// data.Profile.PositionEmployeePositionSide = data.OrgEmployee.OrganizationPositionEmployeePositionSides;
|
||||
// data.Profile.PositionEmployeeLevel = data.OrgEmployee.OrganizationPositionEmployeeLevels;
|
||||
// data.Profile.PositionEmployeeGroup = data.OrgEmployee.employee;
|
||||
data.Profile.PositionEmployeeLine = data.OrgEmployee.PositionEmployeeLine;
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
|||
public string? OrganizationOrder { get; set; }
|
||||
public bool? IsPublic { get; set; } = true;
|
||||
|
||||
public OrganizationEntity? Organization { get; set; }
|
||||
public OrganizationFax? OrganizationFax { get; set; }
|
||||
public OrganizationLevel? OrganizationLevel { get; set; }
|
||||
public OrganizationOrganization? OrganizationOrganization { get; set; }
|
||||
|
|
|
|||
16314
BMA.EHR.Infrastructure/Migrations/20230915055132_update table orgemployee add organization.Designer.cs
generated
Normal file
16314
BMA.EHR.Infrastructure/Migrations/20230915055132_update table orgemployee add organization.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableorgemployeeaddorganization : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OrganizationId",
|
||||
table: "OrganizationEmployees",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationEmployees_OrganizationId",
|
||||
table: "OrganizationEmployees",
|
||||
column: "OrganizationId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_OrganizationEmployees_Organizations_OrganizationId",
|
||||
table: "OrganizationEmployees",
|
||||
column: "OrganizationId",
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_OrganizationEmployees_Organizations_OrganizationId",
|
||||
table: "OrganizationEmployees");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OrganizationEmployees_OrganizationId",
|
||||
table: "OrganizationEmployees");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrganizationId",
|
||||
table: "OrganizationEmployees");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9169,6 +9169,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<Guid?>("OrganizationGovernmentAgencyId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrganizationLevelId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -9228,6 +9231,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("OrganizationGovernmentAgencyId");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("OrganizationLevelId");
|
||||
|
||||
b.HasIndex("OrganizationOrganizationId");
|
||||
|
|
@ -14870,6 +14875,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("OrganizationGovernmentAgencyId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationLevelId");
|
||||
|
|
@ -14910,6 +14919,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("ProfileId");
|
||||
|
||||
b.Navigation("Organization");
|
||||
|
||||
b.Navigation("OrganizationAgency");
|
||||
|
||||
b.Navigation("OrganizationFax");
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||
OrganizationOrder = x.OrganizationOrder,
|
||||
|
||||
OrganizationId = x.Organization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Organization.Id,
|
||||
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||
|
|
@ -126,6 +127,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||
OrganizationOrder = x.OrganizationOrder,
|
||||
|
||||
OrganizationId = x.Organization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Organization.Id,
|
||||
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||
|
|
@ -220,6 +222,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
PositionCondition = req.PositionCondition,
|
||||
PositionMasterUserNote = req.PositionMasterUserNote,
|
||||
OrganizationOrder = req.OrganizationOrder,
|
||||
Organization = await _context.Organizations.FindAsync(req.OrganizationId),
|
||||
OrganizationFax = await _context.OrganizationFaxs.FindAsync(req.OrganizationFaxId),
|
||||
OrganizationLevel = await _context.OrganizationLevels.FindAsync(req.OrganizationLevelId),
|
||||
OrganizationOrganization = await _context.OrganizationOrganizations.FindAsync(req.OrganizationOrganizationId),
|
||||
|
|
@ -305,6 +308,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
organizationEmployee.PositionCondition = req.PositionCondition;
|
||||
organizationEmployee.PositionMasterUserNote = req.PositionMasterUserNote;
|
||||
organizationEmployee.OrganizationOrder = req.OrganizationOrder;
|
||||
organizationEmployee.Organization = await _context.Organizations.FindAsync(req.OrganizationId);
|
||||
organizationEmployee.OrganizationFax = await _context.OrganizationFaxs.FindAsync(req.OrganizationFaxId);
|
||||
organizationEmployee.OrganizationLevel = await _context.OrganizationLevels.FindAsync(req.OrganizationLevelId);
|
||||
organizationEmployee.OrganizationOrganization = await _context.OrganizationOrganizations.FindAsync(req.OrganizationOrganizationId);
|
||||
|
|
@ -372,6 +376,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||
OrganizationOrder = x.OrganizationOrder,
|
||||
|
||||
OrganizationId = x.Organization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Organization.Id,
|
||||
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||
|
|
@ -481,6 +486,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||
OrganizationOrder = x.OrganizationOrder,
|
||||
|
||||
OrganizationId = x.Organization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Organization.Id,
|
||||
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace BMA.EHR.OrganizationEmployee.Service.Requests
|
|||
public string? OrganizationOrder { get; set; }
|
||||
public string? OrganizationShortName { get; set; }
|
||||
|
||||
public Guid? OrganizationId { get; set; }
|
||||
public Guid? OrganizationFaxId { get; set; }
|
||||
public Guid? OrganizationLevelId { get; set; }
|
||||
public Guid? OrganizationOrganizationId { get; set; }
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="iTextSharp" Version="5.5.13.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.21" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ using Telerik.Reporting.Processing;
|
|||
using System.IO;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Report.Service.Requests;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
|
|
@ -30,6 +32,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
private readonly GenericReportGenerator _reportGenerator;
|
||||
private readonly RetireReportRepository _repository;
|
||||
private readonly MinIOService _documentService;
|
||||
// for add watermark
|
||||
private BaseFont baseFont = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, false);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -127,13 +131,13 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
/// 36-บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||
/// </summary>
|
||||
/// <param name="id">Id รายการบันทึกเวียนแจ้งการถึงแก่กรรม</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("copy/36/{exportType}/{id}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDeceasedReportCopyAsync(Guid id, string exportType = "pdf")
|
||||
[HttpGet("copy/36/{id}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetDeceasedReportCopyAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -156,13 +160,13 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
DeceasedNumber = data.GetType().GetProperty("Number").GetValue(data),
|
||||
Location = data.GetType().GetProperty("Location").GetValue(data),
|
||||
};
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
// var mimeType = "";
|
||||
// switch (exportType.Trim().ToLower())
|
||||
// {
|
||||
// case "pdf": mimeType = "application/pdf"; break;
|
||||
// case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
// case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
// }
|
||||
|
||||
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||
ReportPackager reportPacker = new ReportPackager();
|
||||
|
|
@ -178,8 +182,44 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
ReportDocument = report,
|
||||
};
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||
return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
|
||||
RenderingResult result = reportProcessor.RenderReport($"pdf", instanceReportSource, deviceInfo);
|
||||
// return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
|
||||
|
||||
var now = DateTime.Now.ToString("yyyyMMdd-HHmmss");
|
||||
var file = System.IO.Path.Combine(_hostingEnvironment.WebRootPath, "tmp", $"tmp-{now}.pdf");
|
||||
var file_copy = System.IO.Path.Combine(_hostingEnvironment.WebRootPath, "tmp", $"tmp-{now}-copy.pdf");
|
||||
|
||||
try
|
||||
{
|
||||
// Copy to File
|
||||
System.IO.File.WriteAllBytes(file, result.DocumentBytes);
|
||||
var watermark_text = "COPY COPY COPY COPY";
|
||||
var fName = $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.pdf";
|
||||
|
||||
AddWatermark(file, file_copy, watermark_text);
|
||||
|
||||
using (var fileStream = new System.IO.FileStream(file_copy, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
fileStream.CopyTo(ms);
|
||||
ms.Flush();
|
||||
return File(ms.ToArray(), "application/octet-stream", fName);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (System.IO.File.Exists(file))
|
||||
System.IO.File.Delete(file);
|
||||
|
||||
if (System.IO.File.Exists(file_copy))
|
||||
System.IO.File.Delete(file_copy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -226,5 +266,58 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Add Watermark "
|
||||
|
||||
private void AddWaterMarkText(PdfContentByte pdfData, string watermarkText, BaseFont font, float fontSize, float angle, BaseColor color, iTextSharp.text.Rectangle realPageSize)
|
||||
{
|
||||
var gstate = new PdfGState { FillOpacity = 0.5f, StrokeOpacity = 0.3f };
|
||||
pdfData.SaveState();
|
||||
pdfData.SetGState(gstate);
|
||||
pdfData.SetColorFill(color);
|
||||
pdfData.BeginText();
|
||||
pdfData.SetFontAndSize(font, fontSize);
|
||||
var x = (realPageSize.Right + realPageSize.Left) / 2;
|
||||
var y = (realPageSize.Bottom + realPageSize.Top) / 2;
|
||||
pdfData.ShowTextAligned(Element.ALIGN_CENTER, watermarkText, x, y, angle);
|
||||
pdfData.EndText();
|
||||
pdfData.RestoreState();
|
||||
}
|
||||
|
||||
private bool AddWatermark(string inputfilepath, string outputfilepath, string watermark_text)
|
||||
{
|
||||
PdfReader pdfReader = null;
|
||||
PdfStamper pdfStamper = null;
|
||||
try
|
||||
{
|
||||
|
||||
pdfReader = new PdfReader(inputfilepath);
|
||||
int numberOfPages = pdfReader.NumberOfPages;
|
||||
iTextSharp.text.Rectangle pagesize = pdfReader.GetPageSize(1);
|
||||
pdfStamper = new PdfStamper(pdfReader, new FileStream(outputfilepath, FileMode.Create));
|
||||
|
||||
for (int i = 1; i <= numberOfPages; i++)
|
||||
{
|
||||
var dc = pdfStamper.GetOverContent(i);
|
||||
AddWaterMarkText(dc, watermark_text, baseFont, 30, 45, BaseColor.DARK_GRAY, pdfReader.GetPageSizeWithRotation(i));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.Message.Trim();
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pdfStamper != null)
|
||||
pdfStamper.Close();
|
||||
|
||||
if (pdfReader != null)
|
||||
pdfReader.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
|
||||
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย.trdp");
|
||||
|
||||
ReportPackager reportPacker = new ReportPackager();
|
||||
|
|
@ -171,7 +171,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
_Khr2List.Add(new
|
||||
{
|
||||
RowNo = _Khr2List.Count+1,
|
||||
RowNo = _Khr2List.Count + 1,
|
||||
DepartmentName = _data.GetType().GetProperty("DepartmentName").GetValue(_data),
|
||||
G1Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||
G1Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||
|
|
@ -183,14 +183,14 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
G4Female = _data.GetType().GetProperty("G4Female").GetValue(_data),
|
||||
G5Male = _data.GetType().GetProperty("G5Male").GetValue(_data),
|
||||
G5Female = _data.GetType().GetProperty("G5Female").GetValue(_data),
|
||||
G6Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||
G6Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||
G7Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||
G7Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||
G8Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||
G8Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||
G9Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
|
||||
G9Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
|
||||
G6Male = _data.GetType().GetProperty("G6Male").GetValue(_data),
|
||||
G6Female = _data.GetType().GetProperty("G6Female").GetValue(_data),
|
||||
G7Male = _data.GetType().GetProperty("G7Male").GetValue(_data),
|
||||
G7Female = _data.GetType().GetProperty("G7Female").GetValue(_data),
|
||||
G8Male = _data.GetType().GetProperty("G8Male").GetValue(_data),
|
||||
G8Female = _data.GetType().GetProperty("G8Female").GetValue(_data),
|
||||
G9Male = _data.GetType().GetProperty("G9Male").GetValue(_data),
|
||||
G9Female = _data.GetType().GetProperty("G9Female").GetValue(_data),
|
||||
Remark = _data.GetType().GetProperty("Remark").GetValue(_data),
|
||||
});
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
ReportPackager reportPacker = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
|
||||
|
||||
|
||||
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -635,8 +635,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
|
||||
if (profile.RetirementPeriod.RetirementPeriodHistorys.Count() == 0)
|
||||
{
|
||||
await GenOrderByYear(profile.RetirementPeriod.Id);
|
||||
_context.RetirementProfiles.Remove(profile);
|
||||
_context.SaveChanges();
|
||||
await GenOrderByYear(profile.RetirementPeriod.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -543,15 +543,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.FirstOrDefaultAsync();
|
||||
if (retirementDeceased == null)
|
||||
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
||||
if (retirementDeceased.DocumentForward == null)
|
||||
return Error(GlobalMessages.NoFileToUpload, 404);
|
||||
// if (retirementDeceased.DocumentForward == null)
|
||||
// return Error(GlobalMessages.NoFileToUpload, 404);
|
||||
|
||||
// create command payload
|
||||
var payload_attach = new List<PayloadAttachment>();
|
||||
payload_attach.Add(new PayloadAttachment
|
||||
{
|
||||
name = "หนังสือเวียนถึงแก่กรรม",
|
||||
url = $"{_configuration["API"]}/copy/36/pdf/{retirementDeceased.Id}"
|
||||
url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}"
|
||||
});
|
||||
|
||||
var payload = new CommandPayload()
|
||||
|
|
|
|||
|
|
@ -33,5 +33,6 @@
|
|||
"BucketName": "bma-recruit"
|
||||
},
|
||||
"Protocol": "HTTPS",
|
||||
"API": "https://bma-ehr.frappet.synology.me/api/v1"
|
||||
"API": "https://bma-ehr.frappet.synology.me/api/v1",
|
||||
"APIV2": "https://bma-ehr.frappet.synology.me/api/v2"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue