This commit is contained in:
@@ -14,7 +14,6 @@ using Swashbuckle.AspNetCore.Annotations;
|
|||||||
namespace rmutr_report.Controllers
|
namespace rmutr_report.Controllers
|
||||||
{
|
{
|
||||||
[SwaggerTag("สำหรับรายงาน ร.2 คำขอชี้แจงงบบุคลากร")]
|
[SwaggerTag("สำหรับรายงาน ร.2 คำขอชี้แจงงบบุคลากร")]
|
||||||
|
|
||||||
public class RoTwo : Controller
|
public class RoTwo : Controller
|
||||||
{
|
{
|
||||||
readonly Setting _setting;
|
readonly Setting _setting;
|
||||||
@@ -26,69 +25,89 @@ namespace rmutr_report.Controllers
|
|||||||
|
|
||||||
[HttpPost, Route("reports/personnel_statement/{type}")]
|
[HttpPost, Route("reports/personnel_statement/{type}")]
|
||||||
[ApiExplorerSettings(GroupName = "reports")]
|
[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 = 1;
|
||||||
int no_2 = 1;
|
int no_2 = 1;
|
||||||
|
|
||||||
foreach (var personnelStatementDetail in personnel_statements.personnel_statement_details)
|
foreach (var personnelStatementDetail in personnel_statements.personnel_statement_details)
|
||||||
{
|
{
|
||||||
personnelStatementDetail.start_dates =
|
if (personnelStatementDetail.start_date != null)
|
||||||
personnelStatementDetail.start_date.Value.ToString("dd/MM/yyyy",
|
{
|
||||||
CultureInfo.CreateSpecificCulture("th-TH"));
|
personnelStatementDetail.start_dates =
|
||||||
|
personnelStatementDetail.start_date.Value.ToString("dd/MM/yyyy",
|
||||||
|
CultureInfo.CreateSpecificCulture("th-TH"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
personnelStatementDetail.start_dates = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (personnelStatementDetail.topic_type == 2)
|
if (personnelStatementDetail.topic_type == 2)
|
||||||
{
|
{
|
||||||
personnelStatementDetail.row_no = no;
|
personnelStatementDetail.row_no = no;
|
||||||
no++;
|
no++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var personnelStatementDetail2 in personnel_statements.personnel_statement_details_2)
|
foreach (var personnelStatementDetail2 in personnel_statements.personnel_statement_details_2)
|
||||||
{
|
{
|
||||||
personnelStatementDetail2.start_dates =
|
if (personnelStatementDetail2.start_date != null)
|
||||||
personnelStatementDetail2.start_date.Value.ToString("dd/MM/yyyy",
|
{
|
||||||
CultureInfo.CreateSpecificCulture("th-TH"));
|
personnelStatementDetail2.start_dates =
|
||||||
|
personnelStatementDetail2.start_date.Value.ToString("dd/MM/yyyy",
|
||||||
|
CultureInfo.CreateSpecificCulture("th-TH"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
personnelStatementDetail2.start_dates = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (personnelStatementDetail2.topic_type == 2)
|
if (personnelStatementDetail2.topic_type == 2)
|
||||||
{
|
{
|
||||||
personnelStatementDetail2.row_no = no_2;
|
personnelStatementDetail2.row_no = no_2;
|
||||||
no_2++;
|
no_2++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var personnelstatements = new List<personnel_statement>() { personnel_statements };
|
var personnelstatements = new List<personnel_statement>() { personnel_statements };
|
||||||
|
|
||||||
Report report = new Report();
|
Report report = new Report();
|
||||||
report.Load(_setting.report_path + "personnel_statement.frx");
|
report.Load(_setting.report_path + "personnel_statement.frx");
|
||||||
report.RegisterData(personnelstatements, "personnel_statement");
|
report.RegisterData(personnelstatements, "personnel_statement");
|
||||||
report.Prepare();
|
report.Prepare();
|
||||||
|
|
||||||
MemoryStream stream = new MemoryStream();
|
MemoryStream stream = new MemoryStream();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "pdf":
|
case "pdf":
|
||||||
PDFExport pdf = new PDFExport();
|
PDFExport pdf = new PDFExport();
|
||||||
report.Export(pdf, stream);
|
report.Export(pdf, stream);
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
return File(stream, "application/pdf");
|
return File(stream, "application/pdf");
|
||||||
case "xls":
|
case "xls":
|
||||||
case "xlsx":
|
case "xlsx":
|
||||||
Excel2007Export excel = new Excel2007Export();
|
Excel2007Export excel = new Excel2007Export();
|
||||||
report.Export(excel, stream);
|
report.Export(excel, stream);
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
//return File(stream, "application/vnd.ms-excel");
|
//return File(stream, "application/vnd.ms-excel");
|
||||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
return File(
|
return File(
|
||||||
stream,
|
stream,
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
"personnel_statement_"+date + ".xlsx");
|
"personnel_statement_" + date + ".xlsx");
|
||||||
break;
|
break;
|
||||||
case "doc":
|
case "doc":
|
||||||
case "docx":
|
case "docx":
|
||||||
Word2007Export word = new Word2007Export();
|
Word2007Export word = new Word2007Export();
|
||||||
report.Export(word, stream);
|
report.Export(word, stream);
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
return File(stream, "appllication/vnd.ms-word");
|
return File(stream, "appllication/vnd.ms-word");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("rmutr_report")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
f5dfedcaccda50e61bd739707e09ac1f8f1f155f84f01a86842a0ff8ce71abef
|
69ca6226ad103f96cd4f19139ecbf9e199ffad6842f9d538cf8fa6d3ad95a1f0
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
b55a3bbbbff27a49a26b910c544231a92861857b7c6721b0e4530b7ae5f4bd0c
|
dcd525096a1ce6d361a0f90f2bdaab10d35c67b5fb030c1e50ec4ffce04742c7
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -512,6 +512,22 @@
|
|||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_threeold.frx))</OriginalItemSpec>
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_threeold.frx))</OriginalItemSpec>
|
||||||
</StaticWebAsset>
|
</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))">
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\expenditure_budget_proposal.frx))">
|
||||||
<SourceType>Package</SourceType>
|
<SourceType>Package</SourceType>
|
||||||
<SourceId>rmutr_report</SourceId>
|
<SourceId>rmutr_report</SourceId>
|
||||||
@@ -1184,6 +1200,22 @@
|
|||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list.frx))</OriginalItemSpec>
|
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list.frx))</OriginalItemSpec>
|
||||||
</StaticWebAsset>
|
</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))">
|
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\new_rate_offer_request_form.frx))">
|
||||||
<SourceType>Package</SourceType>
|
<SourceType>Package</SourceType>
|
||||||
<SourceId>rmutr_report</SourceId>
|
<SourceId>rmutr_report</SourceId>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
75d85b4119ec234a6112d77fb62c7d93d30177a5fb3cf6ef31dda7f6cb8a4c26
|
3aa706f2c61e17142c6c20bf3e6e70812f5704e5e1fd08724f95f850b6ae70ed
|
||||||
|
|||||||
Reference in New Issue
Block a user