Bug Fixed
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
kamonwan taengsuk
2024-02-06 11:32:52 +07:00
parent 1cee2dea2f
commit 11d4269f2a
12 changed files with 98 additions and 47 deletions

View File

@@ -14,7 +14,6 @@ using Swashbuckle.AspNetCore.Annotations;
namespace rmutr_report.Controllers
{
[SwaggerTag("สำหรับรายงาน ร.2 คำขอชี้แจงงบบุคลากร")]
public class RoTwo : Controller
{
readonly Setting _setting;
@@ -26,69 +25,89 @@ namespace rmutr_report.Controllers
[HttpPost, Route("reports/personnel_statement/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetRoThreeReport([FromRoute] string type, [FromBody] personnel_statement personnel_statements)
public IActionResult GetRoThreeReport([FromRoute] string type,
[FromBody] personnel_statement personnel_statements)
{
int no = 1;
int no_2 = 1;
foreach (var personnelStatementDetail in personnel_statements.personnel_statement_details)
{
personnelStatementDetail.start_dates =
personnelStatementDetail.start_date.Value.ToString("dd/MM/yyyy",
CultureInfo.CreateSpecificCulture("th-TH"));
if (personnelStatementDetail.start_date != null)
{
personnelStatementDetail.start_dates =
personnelStatementDetail.start_date.Value.ToString("dd/MM/yyyy",
CultureInfo.CreateSpecificCulture("th-TH"));
}
else
{
personnelStatementDetail.start_dates = "";
}
if (personnelStatementDetail.topic_type == 2)
{
personnelStatementDetail.row_no = no;
no++;
}
}
foreach (var personnelStatementDetail2 in personnel_statements.personnel_statement_details_2)
{
personnelStatementDetail2.start_dates =
personnelStatementDetail2.start_date.Value.ToString("dd/MM/yyyy",
CultureInfo.CreateSpecificCulture("th-TH"));
if (personnelStatementDetail2.start_date != null)
{
personnelStatementDetail2.start_dates =
personnelStatementDetail2.start_date.Value.ToString("dd/MM/yyyy",
CultureInfo.CreateSpecificCulture("th-TH"));
}
else
{
personnelStatementDetail2.start_dates = "";
}
if (personnelStatementDetail2.topic_type == 2)
{
personnelStatementDetail2.row_no = no_2;
no_2++;
}
}
var personnelstatements = new List<personnel_statement>() { personnel_statements };
Report report = new Report();
report.Load(_setting.report_path + "personnel_statement.frx");
report.RegisterData(personnelstatements, "personnel_statement");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
//return File(stream, "application/vnd.ms-excel");
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"personnel_statement_"+date + ".xlsx");
break;
case "doc":
case "docx":
Word2007Export word = new Word2007Export();
report.Export(word, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "appllication/vnd.ms-word");
break;
Report report = new Report();
report.Load(_setting.report_path + "personnel_statement.frx");
report.RegisterData(personnelstatements, "personnel_statement");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
//return File(stream, "application/vnd.ms-excel");
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"personnel_statement_" + date + ".xlsx");
break;
case "doc":
case "docx":
Word2007Export word = new Word2007Export();
report.Export(word, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "appllication/vnd.ms-word");
break;
}
return Ok();
}
return Ok();
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1cee2dea2f87e97283fe3a6ff605821a2a6d3e62")]
[assembly: System.Reflection.AssemblyProductAttribute("rmutr_report")]
[assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
f5dfedcaccda50e61bd739707e09ac1f8f1f155f84f01a86842a0ff8ce71abef
69ca6226ad103f96cd4f19139ecbf9e199ffad6842f9d538cf8fa6d3ad95a1f0

View File

@@ -1 +1 @@
b55a3bbbbff27a49a26b910c544231a92861857b7c6721b0e4530b7ae5f4bd0c
dcd525096a1ce6d361a0f90f2bdaab10d35c67b5fb030c1e50ec4ffce04742c7

Binary file not shown.

Binary file not shown.

View File

@@ -512,6 +512,22 @@
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_threeold.frx))</OriginalItemSpec>
</StaticWebAsset>
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_three_old.frx))">
<SourceType>Package</SourceType>
<SourceId>rmutr_report</SourceId>
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
<BasePath>_content/rmutr_report</BasePath>
<RelativePath>reports\durable_articles_three_old.frx</RelativePath>
<AssetKind></AssetKind>
<AssetMode></AssetMode>
<AssetRole></AssetRole>
<RelatedAsset></RelatedAsset>
<AssetTraitName></AssetTraitName>
<AssetTraitValue></AssetTraitValue>
<CopyToOutputDirectory></CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_three_old.frx))</OriginalItemSpec>
</StaticWebAsset>
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))">
<SourceType>Package</SourceType>
<SourceId>rmutr_report</SourceId>
@@ -1184,6 +1200,22 @@
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list.frx))</OriginalItemSpec>
</StaticWebAsset>
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list_type2.frx))">
<SourceType>Package</SourceType>
<SourceId>rmutr_report</SourceId>
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
<BasePath>_content/rmutr_report</BasePath>
<RelativePath>reports\national_budget_list_type2.frx</RelativePath>
<AssetKind></AssetKind>
<AssetMode></AssetMode>
<AssetRole></AssetRole>
<RelatedAsset></RelatedAsset>
<AssetTraitName></AssetTraitName>
<AssetTraitValue></AssetTraitValue>
<CopyToOutputDirectory></CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list_type2.frx))</OriginalItemSpec>
</StaticWebAsset>
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\new_rate_offer_request_form.frx))">
<SourceType>Package</SourceType>
<SourceId>rmutr_report</SourceId>

View File

@@ -1 +1 @@
75d85b4119ec234a6112d77fb62c7d93d30177a5fb3cf6ef31dda7f6cb8a4c26
3aa706f2c61e17142c6c20bf3e6e70812f5704e5e1fd08724f95f850b6ae70ed