diff --git a/Controllers/Budget.Controller.cs b/Controllers/Budget.Controller.cs index 96fcacc..0a17023 100644 --- a/Controllers/Budget.Controller.cs +++ b/Controllers/Budget.Controller.cs @@ -2013,6 +2013,9 @@ namespace rmutr_report.Controllers ws.Column(1).Width = 30; + ws.Column(2).Width = 15; + ws.Column(3).Width = 15; + ws.Column(4).Width = 15; ws.Column(5).Width = 15; ws.Column(6).Width = 15; ws.Column(7).Width = 15; @@ -2032,7 +2035,6 @@ namespace rmutr_report.Controllers ws.Row(6).Height = 30; int row = 7; - //int no = 1; if (revenue_estimate != null) { ws.Range("A5:A6").Merge().Value = "ผลผลิต / ภาคการศึกษา / ภาคเรียน"; @@ -2110,37 +2112,37 @@ namespace rmutr_report.Controllers int r1 = 1; int r2 = 2; - // var sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.revenue_estimates); - // var sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_revenue_estimates); - // var sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_revenue_estimates); - // var sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_accumulated_income); - // var sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_before_allocating_according); - // var sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_utility_bills); - // var sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_budget); - // var sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_expenditure); - // var sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.expenditure_limit); + var sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.revenue_estimates); + var sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_revenue_estimates); + var sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_revenue_estimates); + var sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_accumulated_income); + var sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_before_allocating_according); + var sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_utility_bills); + var sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_budget); + var sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_expenditure); + var sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.expenditure_limit); foreach (var detail in revenue_estimate.revenue_estimates_details) { if (detail.topic_type == 1) { ws.Cell(row, 1).Value = detail.topic; - ws.Cell(row, 2).Value = detail.revenue_estimates; + ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates; ws.Cell(row, 3).Value = "บาท"; - ws.Cell(row, 4).Value = detail.less_revenue_estimates; + ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates; ws.Cell(row, 5).Value = "บาท"; - ws.Cell(row, 6).Value = detail.balance_revenue_estimates; + ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates; ws.Cell(row, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; + ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income; ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; + ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according; ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; + ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills; ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; + ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget; ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; + ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure; ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; + ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit; ws.Cell(row, 19).Value = "บาท"; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = @@ -2193,23 +2195,23 @@ namespace rmutr_report.Controllers if (detail.topic_type == 2) { ws.Cell(row, 1).Value = detail.topic; - ws.Cell(row, 2).Value = detail.revenue_estimates; + ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates; ws.Cell(row, 3).Value = "บาท"; - ws.Cell(row, 4).Value = detail.less_revenue_estimates; + ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates; ws.Cell(row, 5).Value = "บาท"; - ws.Cell(row, 6).Value = detail.balance_revenue_estimates; + ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates; ws.Cell(row, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; + ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income; ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; + ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according; ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; + ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills; ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; + ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget; ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; + ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure; ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; + ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit; ws.Cell(row, 19).Value = "บาท"; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = @@ -2281,7 +2283,7 @@ namespace rmutr_report.Controllers ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = "TH SarabunPSK"; - ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 14; + //ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 14; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; @@ -2290,7 +2292,6 @@ namespace rmutr_report.Controllers ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right; - //ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214); ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0"); ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0"); @@ -2320,31 +2321,48 @@ namespace rmutr_report.Controllers ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + ws.Cell(row, 1).Style.Font.FontSize = 14; + ws.Cell(row, 2).Style.Font.FontSize = 14; + ws.Cell(row, 3).Style.Font.FontSize = 14; + ws.Cell(row, 4).Style.Font.FontSize = 14; + ws.Cell(row, 5).Style.Font.FontSize = 14; + ws.Cell(row, 6).Style.Font.FontSize = 14; + ws.Cell(row, 7).Style.Font.FontSize = 14; + ws.Cell(row, 8).Style.Font.FontSize = 14; + ws.Cell(row, 9).Style.Font.FontSize = 14; + ws.Cell(row, 10).Style.Font.FontSize = 14; + ws.Cell(row, 11).Style.Font.FontSize = 14; + ws.Cell(row, 12).Style.Font.FontSize = 14; + ws.Cell(row, 13).Style.Font.FontSize = 14; + ws.Cell(row, 14).Style.Font.FontSize = 14; + ws.Cell(row, 15).Style.Font.FontSize = 14; + ws.Cell(row, 16).Style.Font.FontSize = 14; + ws.Cell(row, 17).Style.Font.FontSize = 14; + ws.Cell(row, 18).Style.Font.FontSize = 14; + ws.Cell(row, 19).Style.Font.FontSize = 14; row++; } - // if (detail.topic_type == 4) - // { - if (detail.topic_type == 4) + if (detail.topic_type == 4) { ws.Cell(row, 1).Value = "รวม"; - ws.Cell(row, 2).Value = detail.revenue_estimates; + ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates; ws.Cell(row, 3).Value = "บาท"; - ws.Cell(row, 4).Value = detail.less_revenue_estimates; + ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates; ws.Cell(row, 5).Value = "บาท"; - ws.Cell(row, 6).Value = detail.balance_revenue_estimates; + ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates; ws.Cell(row, 7).Value = "บาท"; - ws.Cell(row, 8).Value = detail.less_accumulated_income; + ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income; ws.Cell(row, 9).Value = "บาท"; - ws.Cell(row, 10).Value = detail.balance_before_allocating_according; + ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according; ws.Cell(row, 11).Value = "บาท"; - ws.Cell(row, 12).Value = detail.contribution_utility_bills; + ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills; ws.Cell(row, 13).Value = "บาท"; - ws.Cell(row, 14).Value = detail.contribution_central_budget; + ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget; ws.Cell(row, 15).Value = "บาท"; - ws.Cell(row, 16).Value = detail.contribution_central_expenditure; + ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure; ws.Cell(row, 17).Value = "บาท"; - ws.Cell(row, 18).Value = detail.expenditure_limit; + ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit; ws.Cell(row, 19).Value = "บาท"; ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName = diff --git a/Controllers/RoFive.Controller.cs b/Controllers/RoFive.Controller.cs index d9c71b6..d4d0dba 100644 --- a/Controllers/RoFive.Controller.cs +++ b/Controllers/RoFive.Controller.cs @@ -4392,6 +4392,43 @@ namespace rmutr_report.Controllers "budget_income_qualification" + ".xlsx"); } + return Ok(); + } + [SwaggerOperation("รายงานสรุปประมาณการรายรับ หลักสูตรสหกิจศึกษา")] + [HttpPost, Route("reports/summary_income_cooperative/{type}")] + [ApiExplorerSettings(GroupName = "reports")] + public IActionResult GetCooperativeReport([FromRoute] string type, + [FromBody] summary_income_cooperative cooperative) + { + + var cooperatives = new List() { cooperative }; + + Report report = new Report(); + report.Load(_setting.report_path + "summary_income_cooperative.frx"); + report.RegisterData(cooperatives, "summary_income_cooperative"); + 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.openxmlformats-officedocument.spreadsheetml.sheet", + "Cooperative" + ".xlsx"); + } + return Ok(); } } diff --git a/Models/RoReport/summary_income_cooperative.cs b/Models/RoReport/summary_income_cooperative.cs new file mode 100644 index 0000000..1b4c83f --- /dev/null +++ b/Models/RoReport/summary_income_cooperative.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace rmutr_report.Models.RoThree +{ + public class summary_income_cooperative + { + public string budget_year { get; set; } + public string date_range { get; set; } + public string faculty_college { get; set; } + public string area { get; set; } + public List data { get; set; } + public string maker { get; set; } + public string position_maker { get; set; } + public string maker_date { get; set; } + } + + public class summary_income_cooperative_detail + { + public int? topic_type { get; set; } + public string topic { get; set; } + public decimal? revenue_estimates { get; set; } + public decimal? deduct_expenses_percent60 { get; set; } + public decimal? deduct_expenses_percent10 { get; set; } + public decimal? balance { get; set; } + public decimal? deduct_tuition_fees { get; set; } + public decimal? balance_university { get; set; } + } +} \ No newline at end of file diff --git a/bin/Debug/net5.0/rmutr_report.dll b/bin/Debug/net5.0/rmutr_report.dll index 5b45468..0c7049d 100644 Binary files a/bin/Debug/net5.0/rmutr_report.dll and b/bin/Debug/net5.0/rmutr_report.dll differ diff --git a/bin/Debug/net5.0/rmutr_report.pdb b/bin/Debug/net5.0/rmutr_report.pdb index 07f0bc8..acfeacc 100644 Binary files a/bin/Debug/net5.0/rmutr_report.pdb and b/bin/Debug/net5.0/rmutr_report.pdb differ diff --git a/obj/Debug/net5.0/ref/rmutr_report.dll b/obj/Debug/net5.0/ref/rmutr_report.dll index 6b17bdf..83aea42 100644 Binary files a/obj/Debug/net5.0/ref/rmutr_report.dll and b/obj/Debug/net5.0/ref/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/refint/rmutr_report.dll b/obj/Debug/net5.0/refint/rmutr_report.dll index 6b17bdf..83aea42 100644 Binary files a/obj/Debug/net5.0/refint/rmutr_report.dll and b/obj/Debug/net5.0/refint/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache b/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache index 82ae9c5..4132dda 100644 --- a/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net5.0/rmutr_report.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -34f6847c55c258dd2ba577a21dc408fdad799519 +6f98eaa7cd9622032caa74a0439d02842244e219 diff --git a/obj/Debug/net5.0/rmutr_report.dll b/obj/Debug/net5.0/rmutr_report.dll index 5b45468..0c7049d 100644 Binary files a/obj/Debug/net5.0/rmutr_report.dll and b/obj/Debug/net5.0/rmutr_report.dll differ diff --git a/obj/Debug/net5.0/rmutr_report.pdb b/obj/Debug/net5.0/rmutr_report.pdb index 07f0bc8..acfeacc 100644 Binary files a/obj/Debug/net5.0/rmutr_report.pdb and b/obj/Debug/net5.0/rmutr_report.pdb differ diff --git a/wwwroot/reports/summary_income_cooperative.frx b/wwwroot/reports/summary_income_cooperative.frx new file mode 100644 index 0000000..14b5ed6 --- /dev/null +++ b/wwwroot/reports/summary_income_cooperative.frx @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +