diff --git a/Controllers/RoTwo.Controller.cs b/Controllers/RoTwo.Controller.cs index 5f4fa44..6c8d464 100644 --- a/Controllers/RoTwo.Controller.cs +++ b/Controllers/RoTwo.Controller.cs @@ -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_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(); - } } } \ No newline at end of file diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index 1b7cb5a..4cdaff6 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index 76a2484..46d86bd 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index b928750..c100e48 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index b928750..c100e48 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs b/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs index 39daae7..7463dc3 100644 --- a/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs +++ b/obj/Debug/net5.0/rmutr_report.AssemblyInfo.cs @@ -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")] diff --git a/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache b/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache index 7d63e16..4a170ff 100644 --- a/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache +++ b/obj/Debug/net5.0/rmutr_report.AssemblyInfoInputs.cache @@ -1 +1 @@ -f5dfedcaccda50e61bd739707e09ac1f8f1f155f84f01a86842a0ff8ce71abef +69ca6226ad103f96cd4f19139ecbf9e199ffad6842f9d538cf8fa6d3ad95a1f0 diff --git a/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache b/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache index ea66bd2..7c14314 100644 --- a/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache +++ b/obj/Debug/net5.0/rmutr_report.RazorTargetAssemblyInfo.cache @@ -1 +1 @@ -b55a3bbbbff27a49a26b910c544231a92861857b7c6721b0e4530b7ae5f4bd0c +dcd525096a1ce6d361a0f90f2bdaab10d35c67b5fb030c1e50ec4ffce04742c7 diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 1b7cb5a..4cdaff6 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index 76a2484..46d86bd 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/net5.0/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props b/obj/Debug/net5.0/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props index 2bd1056..280274a 100644 --- a/obj/Debug/net5.0/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props +++ b/obj/Debug/net5.0/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props @@ -512,6 +512,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_threeold.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\durable_articles_three_old.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\durable_articles_three_old.frx)) + Package rmutr_report @@ -1184,6 +1200,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\national_budget_list_type2.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\national_budget_list_type2.frx)) + Package rmutr_report diff --git a/obj/Debug/net5.0/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache b/obj/Debug/net5.0/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache index a59d63a..352ee4c 100644 --- a/obj/Debug/net5.0/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache +++ b/obj/Debug/net5.0/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache @@ -1 +1 @@ -75d85b4119ec234a6112d77fb62c7d93d30177a5fb3cf6ef31dda7f6cb8a4c26 +3aa706f2c61e17142c6c20bf3e6e70812f5704e5e1fd08724f95f850b6ae70ed