diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 9b32ad6..84dc41b 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2315,6 +2315,42 @@ namespace rmutr_report.Controllers "summary_budget_university_" + date + ".xlsx"); } + return Ok(); + } + [HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type, + [FromBody] budget_expenditure_report_from_revenue budget) + { + var budgetExpenditure = new List() { budget }; + + Report report = new Report(); + report.Load(_setting.report_path + "budget_expenditure_report_from_revenue.frx"); + report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue"); + 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", + "budgetExpenditure_" + date + ".xlsx"); + } + return Ok(); } } diff --git a/Models/budget/budget_expenditure_report_from_revenue.cs b/Models/budget/budget_expenditure_report_from_revenue.cs new file mode 100644 index 0000000..bbb56f7 --- /dev/null +++ b/Models/budget/budget_expenditure_report_from_revenue.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models +{ + public class budget_expenditure_report_from_revenue + { + public string academic_year_name_th { get; set; } + public string start_and_end_date_report { get; set; } + public string sector { get; set; } //ภาค + + //public string revenue_estimates_type { get; set; } + public string parent_agency_name { get; set; } //หน่วยงาน + + public string agency_name_th { get; set; } //พื้นที่ + + //public string year_budget_plan { get; set; } //แผนงาน + //public string agency_category_name { get; set; } //ผลผลิต + public decimal? total { get; set; } + public List budgets { get; set; } + } + + public class budget + { + public decimal? total { get; set; } //แผนงาน + + public List personnel_lists { get; set; } + } + + public class personnel_list //รายการบุคลกร + { + public decimal? total { get; set; } + public List budget_personnel_lists { get; set; } + } + + public class budget_personnel_list //งบบุคลากร + { + public decimal? rate { get; set; } + public decimal? total { get; set; } + public List budget_personnel_lists_2 { get; set; } + } + + public class budget_personnel_list_2 //ค่าจ้างชั่วคราว + { + public string list { get; set; } + public decimal? rate { get; set; } + public decimal? total { get; set; } + public List budget_rates { get; set; } + } + + public class budget_rate //อัตราเดิม/อัตราใหม่ + { + public string list { get; set; } + public decimal? rate { get; set; } + public decimal? total { get; set; } + public List details { get; set; } + } + + public class budget_rate_details //อันรองลงมา + { + public string position_level { get; set; } + public string qualification { get; set; } + public decimal? rate { 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 fede534..d05f379 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 3ce5a57..5b0150e 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 4344303..736fbb6 100644 --- a/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/netcoreapp3.1/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3e8f480a09967665a8bdc7bd40fcb54bfc4702a6 +a94643e2f6cc7c9faeb2697c333a2c13987715a3 diff --git a/obj/Debug/netcoreapp3.1/rmutr_report.dll b/obj/Debug/netcoreapp3.1/rmutr_report.dll index fede534..d05f379 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 3ce5a57..5b0150e 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/budget_expenditure_report_from_revenue.frx b/wwwroot/reports/budget_expenditure_report_from_revenue.frx new file mode 100644 index 0000000..9033a84 --- /dev/null +++ b/wwwroot/reports/budget_expenditure_report_from_revenue.frx @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +