diff --git a/Controllers/RoThree.Controller.cs b/Controllers/RoThree.Controller.cs index 10240a0..59963a8 100644 --- a/Controllers/RoThree.Controller.cs +++ b/Controllers/RoThree.Controller.cs @@ -300,241 +300,112 @@ namespace rmutr_report.Controllers return Ok(); } - [SwaggerOperation("รายงานค่าวัสดุสำนักงาน")] - [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(); - } - [SwaggerOperation("รายงานวัสดุคอมพิวเตอร์")] - [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(); - } + // [SwaggerOperation("รายงานค่าวัสดุสำนักงาน")] + // [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(); + // } + // [SwaggerOperation("รายงานวัสดุคอมพิวเตอร์")] + // [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(); + // } [SwaggerOperation("รายงานวัสดุการศึกษา")] [HttpPost, Route("reports/material_education/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetMaterial3Report([FromRoute] string type, [FromBody] material_education three) { - // if (three != null) - // { - // var suml_1 = three.data_1.Sum(d => d.semester_year_1_level_1); - // var suml_2 = three.data_1.Sum(d => d.semester_year_1_level_2); - // var suml_3 = three.data_1.Sum(d => d.semester_year_1_level_3); - // var suml_4 = three.data_1.Sum(d => d.semester_year_1_level_4); - // var suml_5 = three.data_1.Sum(d => d.semester_year_1_level_5); - // var suml_6 = three.data_1.Sum(d => d.rate_semester_year_level_1); - // var suml_7 = three.data_1.Sum(d => d.total_semester_year_level_1); - // var suml_8 = three.data_1.Sum(d => d.material_amount_1); - // var suml_9 = three.data_1.Sum(d => d.semester_year_2_level_1); - // var suml_10 = three.data_1.Sum(d => d.semester_year_2_level_2); - // var suml_11 = three.data_1.Sum(d => d.semester_year_2_level_3); - // var suml_12 = three.data_1.Sum(d => d.semester_year_2_level_4); - // var suml_13 = three.data_1.Sum(d => d.semester_year_2_level_5); - // var suml_14 = three.data_1.Sum(d => d.rate_semester_year_level_2); - // var suml_15 = three.data_1.Sum(d => d.total_semester_year_level_2); - // var suml_16 = three.data_1.Sum(d => d.material_amount_2); - // var suml_17 = three.data_1.Sum(d => d.total_material); - // three.semester_year_1_level_1 = suml_1; - // three.semester_year_1_level_2 = suml_2; - // three.semester_year_1_level_3 = suml_3; - // three.semester_year_1_level_4 = suml_4; - // three.semester_year_1_level_5 = suml_5; - // three.rate_semester_year_level_1 = suml_6; - // three.total_semester_year_level_1 = suml_7; - // three.material_amount_1 = suml_8; - // three.semester_year_2_level_1 = suml_9; - // three.semester_year_2_level_2 = suml_10; - // three.semester_year_2_level_3 = suml_11; - // three.semester_year_2_level_4 = suml_12; - // three.semester_year_2_level_5 = suml_13; - // three.rate_semester_year_level_2 = suml_14; - // three.total_semester_year_level_2 = suml_15; - // three.material_amount_2 = suml_16; - // three.total_material = suml_17; - // - // foreach (var d1 in three.data_1) - // { - // if (three.data_1 != null) - // { - // var suml1 = d1.data_2.Sum(d => d.semester_year_1_level_1); - // var suml2 = d1.data_2.Sum(d => d.semester_year_1_level_2); - // var suml3 = d1.data_2.Sum(d => d.semester_year_1_level_3); - // var suml4 = d1.data_2.Sum(d => d.semester_year_1_level_4); - // var suml5 = d1.data_2.Sum(d => d.semester_year_1_level_5); - // var suml6 = d1.data_2.Sum(d => d.rate_semester_year_level_1); - // var suml7 = d1.data_2.Sum(d => d.total_semester_year_level_1); - // var suml8 = d1.data_2.Sum(d => d.material_amount_1); - // var suml9 = d1.data_2.Sum(d => d.semester_year_2_level_1); - // var suml10 = d1.data_2.Sum(d => d.semester_year_2_level_2); - // var suml11 = d1.data_2.Sum(d => d.semester_year_2_level_3); - // var suml12 = d1.data_2.Sum(d => d.semester_year_2_level_4); - // var suml13 = d1.data_2.Sum(d => d.semester_year_2_level_5); - // var suml14 = d1.data_2.Sum(d => d.rate_semester_year_level_2); - // var suml15 = d1.data_2.Sum(d => d.total_semester_year_level_2); - // var suml16 = d1.data_2.Sum(d => d.material_amount_2); - // var suml17 = d1.data_2.Sum(d => d.total_material); - // d1.semester_year_1_level_1 = suml1; - // d1.semester_year_1_level_2 = suml2; - // d1.semester_year_1_level_3 = suml3; - // d1.semester_year_1_level_4 = suml4; - // d1.semester_year_1_level_5 = suml5; - // d1.rate_semester_year_level_1 = suml6; - // d1.total_semester_year_level_1 = suml7; - // d1.material_amount_1 = suml8; - // d1.semester_year_2_level_1 = suml9; - // d1.semester_year_2_level_2 = suml10; - // d1.semester_year_2_level_3 = suml11; - // d1.semester_year_2_level_4 = suml12; - // d1.semester_year_2_level_5 = suml13; - // d1.rate_semester_year_level_2 = suml14; - // d1.total_semester_year_level_2 = suml15; - // d1.material_amount_2 = suml16; - // d1.total_material = suml17; - // } - // foreach (var d2 in d1.data_2) - // { - // if (d1.data_2!=null) - // { - // var suml1 = d1.data_2.Sum(d => d.semester_year_1_level_1); - // var suml2 = d1.data_2.Sum(d => d.semester_year_1_level_2); - // var suml3 = d1.data_2.Sum(d => d.semester_year_1_level_3); - // var suml4 = d1.data_2.Sum(d => d.semester_year_1_level_4); - // var suml5 = d1.data_2.Sum(d => d.semester_year_1_level_5); - // var t1 = d1.data_2.Sum(d => d.total_semester_year_level_1); - // var r1 = d1.data_2.Sum(d => d.rate_semester_year_level_1); - // var suml6 = d1.data_2.Sum(d => d.semester_year_2_level_1); - // var suml7 = d1.data_2.Sum(d => d.semester_year_2_level_2); - // var suml8 = d1.data_2.Sum(d => d.semester_year_2_level_3); - // var suml9 = d1.data_2.Sum(d => d.semester_year_2_level_4); - // var suml10 = d1.data_2.Sum(d => d.semester_year_2_level_5); - // var t2 = d1.data_2.Sum(d => d.total_semester_year_level_2); - // var r2 = d1.data_2.Sum(d => d.rate_semester_year_level_2); - // d2.total_semester_year_level_1 = suml1+suml2+suml3+suml4+suml5; - // d2.material_amount_1 = t1*r1; - // d2.total_semester_year_level_2 = suml6+suml7+suml8+suml9+suml10; - // d2.material_amount_2 = t2*r2; - // d2.total_material = (t1*r1)+(t2*r2); - // } - // - // foreach (var d3 in d2.data_3) - // { - // if (d2.data_3 != null) - // { - // - // var suml1 = d2.data_3.Sum(d => d.semester_year_1_level_1); - // var suml2 = d2.data_3.Sum(d => d.semester_year_1_level_2); - // var suml3 = d2.data_3.Sum(d => d.semester_year_1_level_3); - // var suml4 = d2.data_3.Sum(d => d.semester_year_1_level_4); - // var suml5 = d2.data_3.Sum(d => d.semester_year_1_level_5); - // var t1 = d2.data_3.Sum(d => d.total_semester_year_level_1); - // var r1 = d2.data_3.Sum(d => d.rate_semester_year_level_1); - // var suml6 = d2.data_3.Sum(d => d.semester_year_2_level_1); - // var suml7 = d2.data_3.Sum(d => d.semester_year_2_level_2); - // var suml8 = d2.data_3.Sum(d => d.semester_year_2_level_3); - // var suml9 = d2.data_3.Sum(d => d.semester_year_2_level_4); - // var suml10 = d2.data_3.Sum(d => d.semester_year_2_level_5); - // var t2 = d2.data_3.Sum(d => d.total_semester_year_level_2); - // var r2 = d2.data_3.Sum(d => d.rate_semester_year_level_2); - // d3.total_semester_year_level_1 = suml1 + suml2 + suml3 + suml4 + suml5; - // d3.material_amount_1 = t1 * r1; - // d3.total_semester_year_level_2 = suml6 + suml7 + suml8 + suml9 + suml10; - // d3.material_amount_2 = t2 * r2; - // d3.total_material = (t1 * r1) + (t2 * r2); - // } - // } - // } - // } - // } + var threes = new List() { three }; @@ -574,182 +445,162 @@ namespace rmutr_report.Controllers return Ok(); } - [SwaggerOperation("รายงานวัสดุหนังสือ")] - [HttpPost, Route("reports/material_book/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial4Report([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_book.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(); - } - [SwaggerOperation("รายงานวัสดุโฆษณาและเผยแพร่")] - [HttpPost, Route("reports/material_advertise/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial5Report([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_advertise.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(); - } - [SwaggerOperation("รายงานวัสดุงานสิ่งก่อสร้าง")] - [HttpPost, Route("reports/material_construction/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial6Report([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_construction.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(); - } + // [SwaggerOperation("รายงานวัสดุหนังสือ")] + // [HttpPost, Route("reports/material_book/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial4Report([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_book.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(); + // } + // [SwaggerOperation("รายงานวัสดุโฆษณาและเผยแพร่")] + // [HttpPost, Route("reports/material_advertise/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial5Report([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_advertise.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(); + // } + // [SwaggerOperation("รายงานวัสดุงานสิ่งก่อสร้าง")] + // [HttpPost, Route("reports/material_construction/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial6Report([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_construction.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(); + // } [SwaggerOperation("รายงานวัสดุเชื้อเพลิงและหล่อลื่น")] [HttpPost, Route("reports/material_fuel_lubricant/{type}")] [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetMaterial7Report([FromRoute] string type, [FromBody] material_fuel_lubricant three) { - // if (three.data != null) - // { - // var s4 = three.data.Sum(f => f.total_amount); - // foreach (var data in three.data) - // { - // var s1 = data.data_detail.Sum(f => f.distance); - // var s2 = data.data_detail.Sum(f => f.average_rate); - // var s3 = data.data_detail.Sum(i => i.total_amount); - // foreach (var detail in data.data_detail) - // { - // if (detail != null) - // { - // detail.total_amount = detail.distance * detail.average_rate; - // } - // - // data.total_amount = s3; - // } - // - // three.total_amount = data.total_amount; - // } - // } + var threes = new List() { three }; @@ -789,209 +640,209 @@ namespace rmutr_report.Controllers return Ok(); } - [SwaggerOperation("รายงานวัสดุไฟฟ้าและวิทยุ")] - [HttpPost, Route("reports/material_electric/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial8Report([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_electric.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(); - } - [SwaggerOperation("รายงานวัสดุการเกษตร")] - [HttpPost, Route("reports/material_agricultural/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial9Report([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_agricultural.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(); - } - [SwaggerOperation("รายงานวัสดุงานบ้านงานครัว")] - [HttpPost, Route("reports/material_housework/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial10Report([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_housework.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(); - } - [SwaggerOperation("รายงานวัสดุวิทยาศาสตร์หรือการแพทย์")] - [HttpPost, Route("reports/material_science_medical/{type}")] - [ApiExplorerSettings(GroupName = "reports")] - public IActionResult GetMaterial11Report([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_science_medical.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(); - } - [SwaggerOperation("รายงานวัสดุกีฬา")] - [HttpPost, Route("reports/material_sport/{type}")] - [ApiExplorerSettings(GroupName = "reports")] + // [SwaggerOperation("รายงานวัสดุไฟฟ้าและวิทยุ")] + // [HttpPost, Route("reports/material_electric/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial8Report([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_electric.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(); + // } + // [SwaggerOperation("รายงานวัสดุการเกษตร")] + // [HttpPost, Route("reports/material_agricultural/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial9Report([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_agricultural.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(); + // } + // [SwaggerOperation("รายงานวัสดุงานบ้านงานครัว")] + // [HttpPost, Route("reports/material_housework/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial10Report([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_housework.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(); + // } + // [SwaggerOperation("รายงานวัสดุวิทยาศาสตร์หรือการแพทย์")] + // [HttpPost, Route("reports/material_science_medical/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] + // public IActionResult GetMaterial11Report([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_science_medical.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(); + // } + // [SwaggerOperation("รายงานวัสดุกีฬา")] + // [HttpPost, Route("reports/material_sport/{type}")] + // [ApiExplorerSettings(GroupName = "reports")] public IActionResult GetMaterial12Report([FromRoute] string type, [FromBody] material_ro_three three) { if (three.data != null) @@ -1039,6 +890,56 @@ namespace rmutr_report.Controllers return Ok(); } + [SwaggerOperation("รายงานวัสดุ ร3")] + [HttpPost, Route("reports/material_ro_three/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetMaterialRoThreeReport([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_ro_three.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(); + } [SwaggerOperation("ค่าตอบแทนอื่นๆ")] [HttpPost, Route("reports/other_compensation/{type}")] [ApiExplorerSettings(GroupName = "reports")] diff --git a/Models/RoReport/material_ro_three.cs b/Models/RoReport/material_ro_three.cs index d1afd31..7b20819 100644 --- a/Models/RoReport/material_ro_three.cs +++ b/Models/RoReport/material_ro_three.cs @@ -4,6 +4,7 @@ namespace rmutr_report.Models.RoThree { public class material_ro_three { + public string material_name { get; set; } public string product { get; set; } public string agency_name_th { get; set; } public string sector { get; set; } diff --git a/bin/Debug/netcoreapp3.1/rmutr_report.dll b/bin/Debug/netcoreapp3.1/rmutr_report.dll index f8dd30a..ba5f0ff 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 6684f70..f30c156 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.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index f8dd30a..ba5f0ff 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 6684f70..f30c156 100644 Binary files a/obj/Debug/netcoreapp3.1/rmutr_report.pdb and b/obj/Debug/netcoreapp3.1/rmutr_report.pdb differ diff --git a/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props b/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props index b646d34..73489c0 100644 --- a/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props +++ b/obj/Debug/netcoreapp3.1/staticwebassets/msbuild.rmutr_report.Microsoft.AspNetCore.StaticWebAssets.props @@ -1008,6 +1008,22 @@ PreserveNewest $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\material_office.frx)) + + Package + rmutr_report + $(MSBuildThisFileDirectory)..\staticwebassets\ + _content/rmutr_report + reports\material_ro_three.frx + + + + + + + + PreserveNewest + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\material_ro_three.frx)) + Package rmutr_report diff --git a/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache b/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache index 8784ff1..4914a35 100644 --- a/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache +++ b/obj/Debug/netcoreapp3.1/staticwebassets/rmutr_report.StaticWebAssets.Pack.cache @@ -1 +1 @@ -29054d1f7148e9432a37c4b95d7e6c92af540091 +8aa91144802a2244f9777f6b035a014da508a7f0 diff --git a/obj/rider.project.model.nuget.info b/obj/rider.project.model.nuget.info index 25aad06..8c10d1e 100644 --- a/obj/rider.project.model.nuget.info +++ b/obj/rider.project.model.nuget.info @@ -1 +1 @@ -17001321833144528 \ No newline at end of file +17001930966561955 \ No newline at end of file diff --git a/obj/rider.project.restore.info b/obj/rider.project.restore.info index 8c10d1e..1c77f1b 100644 --- a/obj/rider.project.restore.info +++ b/obj/rider.project.restore.info @@ -1 +1 @@ -17001930966561955 \ No newline at end of file +17004727362833215 \ No newline at end of file diff --git a/wwwroot/reports/material_ro_three.frx b/wwwroot/reports/material_ro_three.frx new file mode 100644 index 0000000..e14bfb5 --- /dev/null +++ b/wwwroot/reports/material_ro_three.frx @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +