From ef2e2dbeb3e4f72abbd14ba4ec8ace7799fa2bfc Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Wed, 1 Mar 2023 17:30:52 +0700 Subject: [PATCH] =?UTF-8?q?add=20=E0=B8=87=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../durable_articles_three.Controller.cs | 94 ++++ Models/budget/durable_articles_three.cs | 151 ++++++ wwwroot/reports/durable_articles_three.frx | 428 ++++++++++++++++++ 3 files changed, 673 insertions(+) create mode 100644 Controllers/durable_articles_three.Controller.cs create mode 100644 Models/budget/durable_articles_three.cs create mode 100644 wwwroot/reports/durable_articles_three.frx diff --git a/Controllers/durable_articles_three.Controller.cs b/Controllers/durable_articles_three.Controller.cs new file mode 100644 index 0000000..cdbb58b --- /dev/null +++ b/Controllers/durable_articles_three.Controller.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +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("สำหรับรายงาน ง3")] + public class DurableArticlesThree : Controller + { + readonly Setting _setting; + + public DurableArticlesThree(Setting setting) + { + this._setting = setting; + } + + [HttpPost, Route("reports/durable_articles_three/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetHrReport([FromRoute] string type, + [FromBody] durable_articles_three durable_articles_threes) + { + + var a1 = durable_articles_threes.data.Where(d => d.amount == d.amount) + .Sum(o => o.amount); + durable_articles_threes.total_amount = a1; + + int a = 1; + foreach (var q in durable_articles_threes.quotation) + { + + string t = "ใบเสนอราคาบริษัทที่ " + a++ +" "; + q.company = t + q.company; + //a++; + } + + var _durable_articles_three = new List() {durable_articles_threes}; + + Report report = new Report(); + report.Load(_setting.report_path + "durable_articles_three.frx"); + report.RegisterData(_durable_articles_three, "durable_articles_three"); + report.Prepare(); + + MemoryStream stream = new MemoryStream(); + switch (type) + { + case "view": + return File(stream, "application/pdf"); + 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 "csv": + CSVExport csv = new CSVExport(); + report.Export(csv, stream); + stream.Seek(0, SeekOrigin.Begin); + return File(stream, "text/csv"); + 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/durable_articles_three.cs b/Models/budget/durable_articles_three.cs new file mode 100644 index 0000000..1655b84 --- /dev/null +++ b/Models/budget/durable_articles_three.cs @@ -0,0 +1,151 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class durable_articles_three + { + public string budget_year { get; set; } + public string agency_faculty { get; set; } + public string major { get; set; } + public string area { get; set; } + public string responsible_person { get; set; } + public string phone_no { get; set; } + public string product { get; set; } + public List data { get; set; } + public decimal? total_amount { get; set; } + public string durable_type { get; set; } + public string building_name { get; set; } + public string room_name { get; set; } + public string durable_from { get; set; } + public string strategic_issues { get; set; } + public string target { get; set; } + public string strategy { get; set; } + public string necessity_reason { get; set; } + public List objective { get; set; } + public string already_exist { get; set; } + public string workable { get; set; } + public string broken { get; set; } + public string quantity_student { get; set; } + public string quantity_major { get; set; } + public string quantity_faculty { get; set; } + public string quantity_knowledge { get; set; } + public string teaching { get; set; } + public string training_seminar { get; set; } + public string test { get; set; } + public string other_work { get; set; } + public string quantity_user_teaching { get; set; } + public string quantity_user_training { get; set; } + public string description_included { get; set; } + public string description_more1 { get; set; } + public string description_more2 { get; set; } + public string image_description1 { get; set; } + public string image_description2 { get; set; } + public List specification_data { get; set; } + public string specification { get; set; } + public string quantity_specification { get; set; } + public decimal? unit_price_specification { get; set; } + public decimal? amount_specification { get; set; } + public List budget_spending_plan {get; set; } + public string procurement_process { get; set; } + public string incurring_debt { get; set; } + public string quarter { get; set; } + public string disbursement_durable { get; set; } + public List objective_management {get; set; } + public string other_clarifications { get; set; } + public List quotation { get; set; } + //public string analysis_durable { get; set; } + public List analysis { get; set; } + public string investment_budget_analysis { get; set; } + public List investment { get; set; } + //public string show_cases { get; set; } + // public string text1 { get; set; } + // public string text2 { get; set; } + // public string text3 { get; set; } + // public string text4 { get; set; } + // public string text5 { get; set; } + // public string text6 { get; set; } + // public string text7 { get; set; } + + + } + + public class durable_articles_three_detail + { + public string list { get; set; } + public string quantity { get; set; } + public decimal? unit_price { get; set; } + public decimal? amount { get; set; } + + } + + public class objective_seven + { + public string detail { get; set; } + } + + public class specification_datas + { + public string specification { get; set; } + public string quantity { get; set; } + public decimal? unit_price { get; set; } + public decimal? amount { get; set; } + public List data_detail { get; set; } + } + + public class specification_data_details + { + public string list { get; set;} + public string quantity { get; set;} + public string attribute { get; set;} + } + + public class budget_spending_plans + { + public string list { get; set; } + public string month_1 { get; set; } + public string month_2 { get; set; } + public string month_3 { get; set; } + public string month_4 { get; set; } + public string month_5 { get; set; } + public string month_6 { get; set; } + public string month_7 { get; set; } + public string month_8 { get; set; } + public string month_9 { get; set; } + public string month_10 { get; set; } + public string month_11 { get; set; } + public string month_12 { get; set; } + } + + public class objective_managements + { + public string expected_results { get; set; } + public string unit { get; set; } + public string year1 { get; set; } + public string year2 { get; set; } + public string year3 { get; set; } + public string year4 { get; set; } + public string year5 { get; set; } + } + + public class quotations + { + public string company { get; set; } + } + + public class analysis_durables + { + public string list { get; set; } + } + + public class investment_budget_analysis + { + public string cases { get; set; } + public List detail { get; set; } + } + + public class investment_budget_analysis_details + { + + public string list { get; set; } + } +} \ No newline at end of file diff --git a/wwwroot/reports/durable_articles_three.frx b/wwwroot/reports/durable_articles_three.frx new file mode 100644 index 0000000..84e8378 --- /dev/null +++ b/wwwroot/reports/durable_articles_three.frx @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +