diff --git a/Controllers/RoThree.Controller.cs b/Controllers/RoThree.Controller.cs index 7165d54..c528b3f 100644 --- a/Controllers/RoThree.Controller.cs +++ b/Controllers/RoThree.Controller.cs @@ -14,8 +14,7 @@ using Swashbuckle.AspNetCore.Annotations; namespace rmutr_report.Controllers { [SwaggerTag("สำหรับรายงาน ร.3 คำชี้แจงงบดำเนินงาน")] - - public class RoThree : Controller + public class RoThree : Controller { readonly Setting _setting; @@ -28,7 +27,6 @@ namespace rmutr_report.Controllers [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetRoThreeReport([FromRoute] string type, [FromBody] operating_budget_ro_three three) { - var threes = new List() { three }; Report report = new Report(); @@ -72,13 +70,13 @@ namespace rmutr_report.Controllers [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetComReport([FromRoute] string type, [FromBody] compensation_head three) { - if (three.data!=null) + if (three.data != null) { var s = three.data.Sum(f => f.budget_amount); - + three.total_amount = s; } - + var threes = new List() { three }; Report report = new Report(); @@ -117,17 +115,18 @@ namespace rmutr_report.Controllers return Ok(); } - [HttpPost, Route("reports/compensation_head_major/{type}")] + + [HttpPost, Route("reports/compensation_head_major/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetCom2Report([FromRoute] string type, [FromBody] compensation_head three) { - if (three.data!=null) + if (three.data != null) { var s = three.data.Sum(f => f.budget_amount); - + three.total_amount = s; } - + var threes = new List() { three }; Report report = new Report(); @@ -166,7 +165,235 @@ namespace rmutr_report.Controllers return Ok(); } + [HttpPost, Route("reports/teaching_fee_extra_ro_three/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetTeachExReport([FromRoute] string type, [FromBody] teaching_fee_ro_three three) + { + - + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "teaching_fee_extra.frx"); + report.RegisterData(threes, "teaching_fee_ro_three"); + 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", + 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(); + } + [HttpPost, Route("reports/teaching_fee_ro_three/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetTeachReport([FromRoute] string type, [FromBody] teaching_fee_ro_three three) + { + + + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "teaching_fee.frx"); + report.RegisterData(threes, "teaching_fee_ro_three"); + 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", + 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(); + } + [HttpPost, Route("reports/teaching_fee_workload/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetTeachWorkloadReport([FromRoute] string type, [FromBody] teaching_fee_ro_three three) + { + + + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "teaching_fee_workload.frx"); + report.RegisterData(threes, "teaching_fee_ro_three"); + 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", + 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(); + } + [HttpPost, Route("reports/material_office/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetMaterial1Report([FromRoute] string type, [FromBody] material_ro_three three) + { + if (three.data != null) + { + var s = three.data.Sum(f => f.material_amount); + + three.total_amount = s; + } + + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "material_office.frx"); + report.RegisterData(threes, "material_ro_three"); + 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", + 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(); + } + [HttpPost, Route("reports/material_computer/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetMaterial2Report([FromRoute] string type, [FromBody] material_ro_three three) + { + if (three.data != null) + { + var s = three.data.Sum(f => f.material_amount); + + three.total_amount = s; + } + + var threes = new List() { three }; + + Report report = new Report(); + report.Load(_setting.report_path + "material_computer.frx"); + report.RegisterData(threes, "material_ro_three"); + 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", + 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(); + } } } \ No newline at end of file diff --git a/Models/RoThree/material_ro_three.cs b/Models/RoThree/material_ro_three.cs new file mode 100644 index 0000000..4d99256 --- /dev/null +++ b/Models/RoThree/material_ro_three.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.RoThree +{ + public class material_ro_three + { + public string product { get; set; } + public string agency_name_th { get; set; } + public string sector { get; set; } + public decimal? total_amount { get; set; } + public List data { get; set; } + } + + public class material_ro_three_detail + { + public string list { get; set; } + public decimal? amount { get; set; } + public decimal? unit_price { get; set; } + public decimal? material_amount { get; set; } + public string remark { get; set; } + } +} \ No newline at end of file diff --git a/Models/RoThree/teaching_fee_ro_three.cs b/Models/RoThree/teaching_fee_ro_three.cs new file mode 100644 index 0000000..2d03b8d --- /dev/null +++ b/Models/RoThree/teaching_fee_ro_three.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.RoThree +{ + public class teaching_fee_ro_three + { + public string budget_year_1 { get; set; } + public string date_range_1 { get; set; } + public string product_1 { get; set; } + public string semester_1 { get; set; } + public string academic_year_1 { get; set; } + public string agency_name_th_1 { get; set; } + public string sector_1 { get; set; } + public string disbursement_result_year_1 { get; set; } + public string disbursement_result_semester_1 { get; set; } + + public List data_1 { get; set; } + // + public decimal? table_1_ba_1 { get; set; } + public decimal? table_1_ma_1 { get; set; } + public decimal? table_1_ba_2 { get; set; } + public decimal? table_1_ma_2 { get; set; } + public decimal? table_1_ba_3 { get; set; } + public decimal? table_1_ma_3 { get; set; } + public decimal? table_1_teaching_fee_1 { get; set; } + public decimal? table_1_teaching_fee_2 { get; set; } + public decimal? table_1_total { get; set; } + + public string budget_year_2 { get; set; } + public string date_range_2 { get; set; } + public string product_2 { get; set; } + public string semester_2 { get; set; } + public string academic_year_2 { get; set; } + public string agency_name_th_2 { get; set; } + public string sector_2 { get; set; } + public string disbursement_result_year_2 { get; set; } + public string disbursement_result_semester_2 { get; set; } + public List data_2 { get; set; } + // + public decimal? table_2_ba_1 { get; set; } + public decimal? table_2_ma_1 { get; set; } + public decimal? table_2_ba_2 { get; set; } + public decimal? table_2_ma_2 { get; set; } + public decimal? table_2_ba_3 { get; set; } + public decimal? table_2_ma_3 { get; set; } + public decimal? table_2_teaching_fee_1 { get; set; } + public decimal? table_2_teaching_fee_2 { get; set; } + public decimal? table_2_total { get; set; } + + public string budget_year_3 { get; set; } + public string date_range_3 { get; set; } + public string product_3 { get; set; } + public string semester_3 { get; set; } + public string academic_year_3 { get; set; } + public string agency_name_th_3 { get; set; } + public string sector_3 { get; set; } + public string disbursement_result_year_3 { get; set; } + public string disbursement_result_semester_3 { get; set; } + public List data_3 { get; set; } +// + public decimal? table_3_ba_1 { get; set; } + public decimal? table_3_ma_1 { get; set; } + public decimal? table_3_ba_2 { get; set; } + public decimal? table_3_ma_2 { get; set; } + public decimal? table_3_ba_3 { get; set; } + public decimal? table_3_ma_3 { get; set; } + public decimal? table_3_teaching_fee_1 { get; set; } + public decimal? table_3_teaching_fee_2 { get; set; } + public decimal? table_3_total { get; set; } + + } + + public class teaching_fee_ro_three_data_1 + { + public string display_name { get; set; } + public string position { get; set; } + public decimal? disbursement_result { get; set; } + public decimal? number_of_hours_ba_1 { get; set; } + public decimal? number_of_hours_ma_1 { get; set; } + public decimal? number_of_hours_ba_2 { get; set; } + public decimal? number_of_hours_ma_2 { get; set; } + public decimal? number_of_hours_ba_3 { get; set; } + public decimal? number_of_hours_ma_3 { get; set; } + public decimal? excess_teaching_fee_1 { get; set; } + public decimal? excess_teaching_fee_2 { get; set; } + public decimal? total { get; set; } + } +} \ No newline at end of file diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index a6ba908..184c6e6 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.dll and b/bin/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.pdb b/bin/Debug/netcoreapp3.1/rmutr_report.pdb index 4806351..574359f 100644 Binary files a/bin/Debug/netcoreapp3.1/rmutr_report.pdb and b/bin/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache index d36903f..58a4e52 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a715b8fa13ce9533250fc942904a6547d616a090 +1972b883cd96fa5d720cca8f1e8e3339f9a5af72 diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index a6ba908..184c6e6 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.dll and b/obj/Debug/netcoreapp3.1/rmutr_report.dll differ diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.pdb b/obj/Debug/netcoreapp3.1/rmutr_report.pdb index 4806351..574359f 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/wwwroot/reports/material_computer.frx b/wwwroot/reports/material_computer.frx new file mode 100644 index 0000000..d4ce534 --- /dev/null +++ b/wwwroot/reports/material_computer.frx @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/material_office.frx b/wwwroot/reports/material_office.frx new file mode 100644 index 0000000..7c5abc8 --- /dev/null +++ b/wwwroot/reports/material_office.frx @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/teaching_fee.frx b/wwwroot/reports/teaching_fee.frx new file mode 100644 index 0000000..a7d929d --- /dev/null +++ b/wwwroot/reports/teaching_fee.frx @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/teaching_fee_extra.frx b/wwwroot/reports/teaching_fee_extra.frx new file mode 100644 index 0000000..25252fc --- /dev/null +++ b/wwwroot/reports/teaching_fee_extra.frx @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wwwroot/reports/teaching_fee_workload.frx b/wwwroot/reports/teaching_fee_workload.frx new file mode 100644 index 0000000..63ba7d9 --- /dev/null +++ b/wwwroot/reports/teaching_fee_workload.frx @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +