diff --git a/Controllers/project_under_integrated_plan.Controller.cs b/Controllers/project_under_integrated_plan.Controller.cs new file mode 100644 index 0000000..f102f0b --- /dev/null +++ b/Controllers/project_under_integrated_plan.Controller.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using ClosedXML.Excel; +using FastReport; +using FastReport.Export.Csv; +using FastReport.Export.Mht; +using FastReport.Export.OoXML; +using FastReport.Export.Pdf; +using Microsoft.AspNetCore.Mvc; +using rmutr_report.Models; +using Swashbuckle.AspNetCore.Annotations; + +namespace rmutr_report.Controllers +{ + [SwaggerTag("สำหรับรายงานคำขอโครงการภายใต้แผนบูรณาการ ง.5-3")] + public class project_under_integrated_plan: Controller + { + readonly Setting _setting; + + public project_under_integrated_plan(Setting setting) + { + this._setting = setting; + } + [HttpPost, Route("reports/project_under_integrated/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetIntegratedProjectReport([FromRoute] string type, [FromBody] project_under_integrated project) + { + + foreach (var aa in project.sixteen) + { + var a = project.sixteen.Where(p => p.operating_budget == p.operating_budget) + .Sum(j => j.operating_budget); + var b = project.sixteen.Where(p => p.investment_budget == p.investment_budget) + .Sum(j => j.investment_budget); + var c = project.sixteen.Where(p => p.other_budget == p.other_budget) + .Sum(j => j.other_budget); + var d = project.sixteen.Where(p => p.subsidy_budget == p.subsidy_budget) + .Sum(j => j.subsidy_budget); + project.operating_budget = a; + project.investment_budget = b; + project.other_budget = c; + project.subsidy_budget = d; + project.total_budget_all = a+b+c+d; + + } + + // foreach (var v in project.five) + // { + // string na = "ประเด็นยุทธศาสตร์ที่ " ; + // v.strategic_issues = na + v.strategic_issues; + // string na2 = "กลยุทธ์ที่ " ; + // v.measure = na2 + v.measure; + // } + // foreach (var v in project.eleventh) + // { + // foreach (var vv in v.elevenths) + // { + // string na = "ครั้งที่ "; + // vv.the_time = na + vv.the_time; + // } + // } + + var _project = new List() {project}; + + Report report = new Report(); + report.Load(_setting.report_path + "project_under_integrated_plan.frx"); + report.RegisterData(_project, "project_under_integrated"); + 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"); + break; + case "mht": + MHTExport mht = new MHTExport(); + report.Export(mht, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "multipart/related"); + 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/budget/project_under_integrated.cs b/Models/budget/project_under_integrated.cs new file mode 100644 index 0000000..3e65083 --- /dev/null +++ b/Models/budget/project_under_integrated.cs @@ -0,0 +1,206 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class project_under_integrated + { + public string budget_year { get; set; } + public string area { get; set; } + public string faculty { get; set; } + public string ministry { get; set; } + public string project_name { get; set; } + public List two { get; set; } //ข้อ 2 + public string product { get; set; } + public string side { get; set; } + public string project_status { get; set; } //ข้อ 3 + public string subplot { get; set; } //ข้อ 4 + public string target_subplot { get; set; } //ข้อ 4 + public string kpi_subplot { get; set; } //ข้อ 4 + public string consistency { get; set; } //ข้อ 5 + public string kpi_five { get; set; } //ข้อ 5 + public string development_milestones { get; set; } //ข้อ 5 + public string country_reform { get; set; } //ข้อ 6 + public string kpi_six { get; set; } //ข้อ 6 + public string point { get; set; } //ข้อ 6 + public string kpi_plan { get; set; } //ข้อ 7 + public string operational_guidelines { get; set; } //ข้อ 7 + public string operational_kpi { get; set; } //ข้อ 7 + public string principles_reasons { get; set; } //ข้อ 8 + public string objective { get; set; } //ข้อ 9 + public int? count_activity { get; set; } //ข้อ 10 + public List tenth { get; set; } //ข้อ 10 + public List tenths { get; set; } //ข้อ 10 + public List operating_activitie { get; set; } //ข้อ 11 + public string output { get; set; } //ข้อ 12.1 + public List output_data { get; set; } //ข้อ 12 + public string outcome { get; set; } //ข้อ 12.2 + public string impact { get; set; } //ข้อ 12.3 + public List thirteen { get; set; } //ข้อ 13 + public List fourteen { get; set; } //ข้อ 14 + public decimal? total_budget { get; set; } //ข้อ 15 + public decimal? budget { get; set; } //ข้อ 15 + public decimal? out_budget { get; set; } //ข้อ 15 + public string money_source { get; set; } //ข้อ 15 + public List fifteen { get; set; } //ข้อ 15 + public string budget_year_sixteen { get; set; } //ข้อ 16 + public List sixteen { get; set; } //ข้อ 16 + public decimal? operating_budget { get; set; } //ข้อ 16 + public decimal? investment_budget { get; set; } //ข้อ 16 + public decimal? other_budget { get; set; } //ข้อ 16 + public decimal? subsidy_budget { get; set; } //ข้อ 16 + public decimal? total_budget_all { get; set; } //ข้อ 16 + public List thirteenth { get; set; } //ข้อ 17 + public decimal? durable_articles { get; set; } //งบลงทุน + public decimal? land_building { get; set; } //งบลงทุน + public string url_file1 { get; set; } //งบลงทุน + public string url_file2 { get; set; } //งบลงทุน + public string other { get; set; } //งบลงทุน + public decimal? others_budget { get; set; } //งบลงทุน + public string expected_results { get; set; } //ข้อ 18 + public string bad_result { get; set; } //ข้อ 19 + public string way { get; set; } //ข้อ 20 + public string tool { get; set; } //ข้อ 20 + public string period { get; set; } //ข้อ 20 + public string project_achieved { get; set; } //ข้อ 21 + } + + public class two_data + { + public string text { get; set; } + public string display_name { get; set; } + public string agency { get; set; } + public string telephone_number { get; set; } + public string position { get; set; } + public string mobile_number { get; set; } + public string fax { get; set; } + public string email { get; set; } + } + + public class tenths_datas + { + public string activity { get; set; } + } + + public class tenth2_datas_detail + { + public string activity_table { get; set; } + public List tenths2 { get; set; } + } + + public class tenth2_datas_details + { + public decimal? salaya_executive { get; set; } + public decimal? bophitphimuk_executive { get; set; } + public decimal? pohchang_executive { get; set; } + public decimal? klai_kangwon_executive { get; set; } + public decimal? salaya_teacher { get; set; } + public decimal? bophitphimuk_teacher { get; set; } + public decimal? pohchang_teacher { get; set; } + public decimal? klai_kangwon_teacher { get; set; } + public decimal? salaya_officer { get; set; } + public decimal? bophitphimuk_officer { get; set; } + public decimal? pohchang_officer { get; set; } + public decimal? klai_kangwon_officer { get; set; } + public decimal? salaya_internal_student { get; set; } + public decimal? bophitphimuk_internal_student { get; set; } + public decimal? pohchang_internal_student { get; set; } + public decimal? klai_kangwon_internal_student { get; set; } + public decimal? salaya_external_student { get; set; } + public decimal? bophitphimuk_external_student { get; set; } + public decimal? pohchang_external_student { get; set; } + public decimal? klai_kangwon_external_student { get; set; } + public decimal? salaya_person { get; set; } + public decimal? bophitphimuk_person { get; set; } + public decimal? pohchang_person { get; set; } + public decimal? klai_kangwon_person { get; set; } + public decimal? salaya_lecturer { get; set; } + public decimal? bophitphimuk_lecturer { get; set; } + public decimal? pohchang_lecturer { get; set; } + public decimal? klai_kangwon_lecturer { get; set; } + + public decimal? salaya_board { get; set; } + public decimal? bophitphimuk_board { get; set; } + public decimal? pohchang_board { get; set; } + public decimal? klai_kangwon_board { get; set; } + + public decimal? salaya_driver { get; set; } + public decimal? bophitphimuk_driver { get; set; } + public decimal? pohchang_driver { get; set; } + public decimal? klai_kangwon_driver { get; set; } + + public decimal? salaya_other { get; set; } + public decimal? bophitphimuk_other { get; set; } + public decimal? pohchang_other { get; set; } + public decimal? klai_kangwon_other { get; set; } + + public decimal? salaya_total { get; set; } + public decimal? bophitphimuk_total { get; set; } + public decimal? pohchang_total { get; set; } + public decimal? klai_kangwon_total { get; set; } + } + + public class operating_activities + { + public string activity { get; set; } + } + + public class output_datas + { + public string quantity_kpi { get; set; } + public string quantity_target { get; set; } + public string quantity_measure { get; set; } + public string quality_kpi { get; set; } + public string quality_target { get; set; } + public string quality_measure { get; set; } + public string time_kpi { get; set; } + public string time_target { get; set; } + public string time_measure { get; set; } + public string cost_kpi { get; set; } + public string cost_target { get; set; } + public string cost_measure { get; set; } + } + + public class thirteen_data + { + public string the_time { get; set; } + public List thirteens { get; set; } + } + + public class thirteen_data_detail // 1 in 2 out + { + public string internal_external1 { get; set; } + public string area_province1 { get; set; } + public string location1 { get; set; } + public string internal_external2 { get; set; } + public string area_province2 { get; set; } + public string location2 { get; set; } + } + public class fourteen_data + { + public string the_time { get; set; } + public string count_day { get; set; } + public string start_date { get; set; } + public string end_date { get; set; } + } + public class fifteen_datas + { + public string budget_year { get; set; } + public decimal? budget { get; set; } + public decimal? out_budget { get; set; } + } + + public class sixteen_datas + { + public string step { get; set; } + public string one { get; set; } + public string two { get; set; } + public string three { get; set; } + public string four { get; set; } + public string target { get; set; } + public string place_action { get; set; } + public decimal? operating_budget { get; set; } + public decimal? investment_budget { get; set; } + public decimal? other_budget { get; set; } + public decimal? subsidy_budget { get; set; } + } +} \ No newline at end of file diff --git a/wwwroot/reports/project_under_integrated_plan.frx b/wwwroot/reports/project_under_integrated_plan.frx new file mode 100644 index 0000000..329a76e --- /dev/null +++ b/wwwroot/reports/project_under_integrated_plan.frx @@ -0,0 +1,999 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +