This commit is contained in:
kamonwan taengsuk
2023-07-13 14:15:15 +07:00
parent ed6cef4b8d
commit 6ac23499d4
7 changed files with 235 additions and 33 deletions

View File

@@ -1598,11 +1598,76 @@ namespace rmutr_report.Controllers
public IActionResult GetBudgetReport([FromRoute] string type, public IActionResult GetBudgetReport([FromRoute] string type,
[FromBody] budget_expenditure_from_revenue budget_expenditure_from_revenues) [FromBody] budget_expenditure_from_revenue budget_expenditure_from_revenues)
{ {
var topic2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details.ToArray()
.Where(i => i.topic_type == 2).ToList();
var topic3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details.ToArray()
.Where(i => i.topic_type == 3).OrderBy(f=>f.couse_uid).ThenBy(m=>m.major_uid)
.ThenBy(r=>r.row).ToList();
// var sum_1 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.current_students);
// var sum_2 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.students_reduced);
// var sum_3 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.students_estimates);
// var sum_4 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.price_regis_flat_payment);
// var sum_5 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.library_total);
// var sum_6 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.utilities_total);
// var sum_7 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.student_club_library_total);
// var sum_8 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.accident_insurance_total);
// var sum_9 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.academic_activities_total);
// var sum_10 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.examination_and_x_rays_total);
// var sum_11 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.tuition_fee_total);
// var sum_12 = budget_expenditure_from_revenues.budget_expenditure_from_revenue_details
// .Where(h => h.topic_type == 2).Sum(j =>
// j.education_fee_less_fee_total);
if (budget_expenditure_from_revenues.budget_expenditure_from_revenue_details != null) if (budget_expenditure_from_revenues.budget_expenditure_from_revenue_details != null)
{ {
// var _sum1 = topic3.Sum(g => g.current_students);
// var _sum2 = topic3.Sum(j =>
// j.students_reduced);
// var _sum3 = topic3.Sum(j =>
// j.students_estimates);
// var _sum4 = topic3.Sum(j =>
// j.price_regis_flat_payment);
// var _sum5 = topic3.Sum(j =>
// j.library_total);
// var _sum6 = topic3.Sum(j =>
// j.utilities_total);
// var _sum7 = topic3.Sum(j =>
// j.student_club_library_total);
// var _sum8 = topic3.Sum(j =>
// j.accident_insurance_total);
// var _sum9 = topic3.Sum(j =>
// j.academic_activities_total);
// var _sum10 = topic3.Sum(j =>
// j.examination_and_x_rays_total);
// var _sum11 = topic3.Sum(j =>
// j.tuition_fee_total);
// var _sum12 = topic3.Sum(j =>
// j.education_fee_less_fee_total);
foreach (var detail in budget_expenditure_from_revenues.budget_expenditure_from_revenue_details) foreach (var detail in budget_expenditure_from_revenues.budget_expenditure_from_revenue_details)
{ {
if (detail.topic_type == 1) if (detail.topic_type == 1 && detail.topic_type != 2&& detail.topic_type != 3)
{ {
detail.topic_1 = detail.topic; detail.topic_1 = detail.topic;
detail.topic_2 = null; detail.topic_2 = null;
@@ -1654,15 +1719,65 @@ namespace rmutr_report.Controllers
.Where(h => h.topic_type == 1).Sum(j => .Where(h => h.topic_type == 1).Sum(j =>
j.education_fee_less_fee_total); j.education_fee_less_fee_total);
budget_expenditure_from_revenues.sum_12 = sum12; budget_expenditure_from_revenues.sum_12 = sum12;
detail.current_students = topic2.Sum(d=>d.current_students);
detail.students_reduced = topic2.Sum(d=>d.students_reduced);
detail.students_estimates = topic2.Sum(d=>d.students_estimates);
detail.price_regis_flat_payment = topic2.Sum(d=>d.price_regis_flat_payment);
detail.library_total = topic2.Sum(d=>d.library_total);
detail.utilities_total =topic2.Sum(d=>d.utilities_total);
detail.student_club_library_total = topic2.Sum(d=>d.student_club_library_total);
detail.accident_insurance_total = topic2.Sum(d=>d.accident_insurance_total);
detail.academic_activities_total = topic2.Sum(d=>d.academic_activities_total);
detail.examination_and_x_rays_total = topic2.Sum(d=>d.examination_and_x_rays_total);
detail.tuition_fee_total = topic2.Sum(d=>d.tuition_fee_total);
detail.education_fee_less_fee_total = topic2.Sum(d=>d.education_fee_less_fee_total);
} }
if (detail.topic_type == 2)
if (detail.topic_type == 2&& detail.topic_type != 1&& detail.topic_type != 3)
{ {
detail.topic_1 = detail.topic; detail.topic_1 = detail.topic;
detail.topic_2 = null; detail.topic_2 = null;
detail.current_students = topic3.Sum(d=>d.current_students);
detail.students_reduced = topic3.Sum(d=>d.students_reduced);
detail.students_estimates = topic3.Sum(d=>d.students_estimates);
detail.price_regis_flat_payment = topic3.Sum(d=>d.price_regis_flat_payment);
detail.library_total = topic3.Sum(d=>d.library_total);
detail.utilities_total =topic3.Sum(d=>d.utilities_total);
detail.student_club_library_total = topic3.Sum(d=>d.student_club_library_total);
detail.accident_insurance_total = topic3.Sum(d=>d.accident_insurance_total);
detail.academic_activities_total = topic3.Sum(d=>d.academic_activities_total);
detail.examination_and_x_rays_total = topic3.Sum(d=>d.examination_and_x_rays_total);
detail.tuition_fee_total = topic3.Sum(d=>d.tuition_fee_total);
detail.education_fee_less_fee_total = topic3.Sum(d=>d.education_fee_less_fee_total);
} }
if (detail.topic_type == 3) if (detail.topic_type == 3&& detail.topic_type != 1&& detail.topic_type != 2)
{ {
detail.topic_2 = detail.topic; detail.topic_2 = detail.topic;
detail.topic_1 = null; detail.topic_1 = null;
@@ -1834,7 +1949,6 @@ namespace rmutr_report.Controllers
int r2 = 2; int r2 = 2;
foreach (var detail in revenue_estimate.revenue_estimates_details) foreach (var detail in revenue_estimate.revenue_estimates_details)
{ {
if (detail.topic_type == 1) if (detail.topic_type == 1)
{ {
ws.Cell(row, 1).Value = detail.topic; ws.Cell(row, 1).Value = detail.topic;
@@ -2151,8 +2265,6 @@ namespace rmutr_report.Controllers
row++; row++;
row += r1; row += r1;
row += r2; row += r2;
} }
} }
} }
@@ -2169,12 +2281,12 @@ namespace rmutr_report.Controllers
"revenue_estimates_" + date + ".xlsx"); "revenue_estimates_" + date + ".xlsx");
} }
} }
[HttpPost, Route("reports/summary_budget_university/{type}")] [HttpPost, Route("reports/summary_budget_university/{type}")]
[ApiExplorerSettings(GroupName = "reports")] [ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumBudgetUniReport([FromRoute] string type, public IActionResult GetSumBudgetUniReport([FromRoute] string type,
[FromBody] summary_budget_university summary) [FromBody] summary_budget_university summary)
{ {
var summaryBudget = new List<summary_budget_university>() { summary }; var summaryBudget = new List<summary_budget_university>() { summary };
Report report = new Report(); Report report = new Report();

View File

@@ -28,6 +28,9 @@ namespace rmutr_report.Models
public DateTime? version { get; set; } public DateTime? version { get; set; }
public List<t_budget_expenditure_from_revenue_detail> budget_expenditure_from_revenue_details { get; set; } public List<t_budget_expenditure_from_revenue_detail> budget_expenditure_from_revenue_details { get; set; }
// public t_budget_expenditure_from_revenue_detail[] budget_expenditure_from_revenue_details_2 { get; set; }
// public t_budget_expenditure_from_revenue_detail[] budget_expenditure_from_revenue_details_3 { get; set; }
public decimal? sum_1 { get; set; } public decimal? sum_1 { get; set; }
public decimal? sum_2 { get; set; } public decimal? sum_2 { get; set; }
public decimal? sum_3 { get; set; } public decimal? sum_3 { get; set; }
@@ -81,12 +84,99 @@ namespace rmutr_report.Models
public decimal? tuition_less_fee_per_student { get; set; } public decimal? tuition_less_fee_per_student { get; set; }
public decimal? education_fee_less_fee_total { get; set; } public decimal? education_fee_less_fee_total { get; set; }
public int? topic_type { get; set; } public int? topic_type { get; set; }
public int? row { get; set; }
public DateTime? version { get; set; } public DateTime? version { get; set; }
public Guid? semester_uid { get; set; } public Guid? semester_uid { get; set; }
public Guid? academic_year_uid { get; set; } public Guid? academic_year_uid { get; set; }
public int? row { get; set; } public Guid? couse_uid { get; set; }
public Guid? major_uid { get; set; }
} }
// public class t_budget_expenditure_from_revenue_detail_2
// {
// public string topic { get; set; }
// public string topic_1 { get; set; }
// public string topic_2 { get; set; }
// public string academic_year_name_th { get; set; }
// public decimal? current_students { get; set; }
// public decimal? students_reduced { get; set; }
// public decimal? students_estimates { get; set; }
// public decimal? price_regis_flat_payment_per_student { get; set; }
// public decimal? price_regis_flat_payment { get; set; }
// public decimal? price_regis_flat_payment1 { get; set; }
//
// public decimal? library_per_student { get; set; }
// public decimal? library_total { get; set; }
// public decimal? library_total1 { get; set; }
//
// public decimal? utilities_per_student { get; set; }
// public decimal? utilities_total { get; set; }
//
// public decimal? student_club_per_student { get; set; }
// public decimal? student_club_library_total { get; set; }
//
// public decimal? accident_insurance_per_student { get; set; }
// public decimal? accident_insurance_total { get; set; }
//
// public decimal? academic_activities_per_student { get; set; }
// public decimal? academic_activities_total { get; set; }
//
// public decimal? examination_and_x_rays_per_student { get; set; }
// public decimal? examination_and_x_rays_total { get; set; }
//
// public decimal? tuition_fee_per_student { get; set; }
// public decimal? tuition_fee_total { get; set; }
//
// public decimal? tuition_less_fee_per_student { get; set; }
// public decimal? education_fee_less_fee_total { get; set; }
//
//
// public int? topic_type { get; set; }
//
// }
//
// public class t_budget_expenditure_from_revenue_detail_3
// {
// public string topic { get; set; }
// public string topic_1 { get; set; }
// public string topic_2 { get; set; }
// public string academic_year_name_th { get; set; }
// public decimal? current_students { get; set; }
// public decimal? students_reduced { get; set; }
// public decimal? students_estimates { get; set; }
// public decimal? price_regis_flat_payment_per_student { get; set; }
// public decimal? price_regis_flat_payment { get; set; }
// public decimal? price_regis_flat_payment1 { get; set; }
//
// public decimal? library_per_student { get; set; }
// public decimal? library_total { get; set; }
// public decimal? library_total1 { get; set; }
//
// public decimal? utilities_per_student { get; set; }
// public decimal? utilities_total { get; set; }
//
// public decimal? student_club_per_student { get; set; }
// public decimal? student_club_library_total { get; set; }
//
// public decimal? accident_insurance_per_student { get; set; }
// public decimal? accident_insurance_total { get; set; }
//
// public decimal? academic_activities_per_student { get; set; }
// public decimal? academic_activities_total { get; set; }
//
// public decimal? examination_and_x_rays_per_student { get; set; }
// public decimal? examination_and_x_rays_total { get; set; }
//
// public decimal? tuition_fee_per_student { get; set; }
// public decimal? tuition_fee_total { get; set; }
//
// public decimal? tuition_less_fee_per_student { get; set; }
// public decimal? education_fee_less_fee_total { get; set; }
//
//
// public int? topic_type { get; set; }
// }
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="07/12/2023 15:38:17" ReportInfo.CreatorVersion="2021.1.0.0"> <Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="07/12/2023 17:34:29" ReportInfo.CreatorVersion="2021.1.0.0">
<Dictionary> <Dictionary>
<BusinessObjectDataSource Name="budget_expenditure_from_revenue" ReferenceName="budget_expenditure_from_revenue" DataType="null" Enabled="true"> <BusinessObjectDataSource Name="budget_expenditure_from_revenue" ReferenceName="budget_expenditure_from_revenue" DataType="null" Enabled="true">
<Column Name="academic_year_name_th" DataType="System.String"/> <Column Name="academic_year_name_th" DataType="System.String"/>