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,
[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)
{
// 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)
{
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_2 = null;
@@ -1654,15 +1719,65 @@ namespace rmutr_report.Controllers
.Where(h => h.topic_type == 1).Sum(j =>
j.education_fee_less_fee_total);
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_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_1 = null;
@@ -1834,7 +1949,6 @@ namespace rmutr_report.Controllers
int r2 = 2;
foreach (var detail in revenue_estimate.revenue_estimates_details)
{
if (detail.topic_type == 1)
{
ws.Cell(row, 1).Value = detail.topic;
@@ -1899,7 +2013,7 @@ 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;
row++;
}
@@ -2102,15 +2216,15 @@ namespace rmutr_report.Controllers
row++;
}
if (detail.is_footer== true)
if (detail.is_footer == true)
{
ws.Cell(row, 14).Value = "ลงชื่อ";
ws.Cell(row, 15).Value = revenue_estimate.author_name;
ws.Cell(row, 15).Value = revenue_estimate.author_name;
ws.Cell(row, 17).Value = "ผู้จัดทำ";
ws.Cell(row + r1, 14).Value = "ตำแหน่ง";
ws.Cell(row+r1, 15).Value = revenue_estimate.position_name;
ws.Cell(row+r2, 14).Value = "เบอร์โทรติดต่อ";
ws.Cell(row+r2, 15).Value = "'"+revenue_estimate.phone;
ws.Cell(row + r1, 15).Value = revenue_estimate.position_name;
ws.Cell(row + r2, 14).Value = "เบอร์โทรติดต่อ";
ws.Cell(row + r2, 15).Value = "'" + revenue_estimate.phone;
ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 14), ws.Cell(row, 17)).Style.Font.SetBold().Font.FontSize = 14;
@@ -2118,30 +2232,30 @@ namespace rmutr_report.Controllers
// ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Border.BottomBorder = XLBorderStyleValues.Dotted;
ws.Cell(row, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+1, 14).Style.Alignment.Horizontal =
ws.Cell(row + 1, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+2, 14).Style.Alignment.Horizontal =
ws.Cell(row + 2, 14).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
ws.Cell(row+1, 14).Style.Font.FontName =
ws.Cell(row + 1, 14).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+2, 14).Style.Font.FontName =
ws.Cell(row + 2, 14).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+1, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row+2, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row + 1, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row + 2, 14).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.FontName =
ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Font.FontName =
"TH SarabunPSK";
ws.Cell(row+2, 15).Style.Font.FontName =
ws.Cell(row + 2, 15).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row+2, 15).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Font.SetBold().Font.FontSize = 14;
ws.Cell(row + 2, 15).Style.Font.SetBold().Font.FontSize = 14;
ws.Range(ws.Cell(row, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row+1, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal =
ws.Range(ws.Cell(row + 1, 15), ws.Cell(row, 16)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
ws.Cell(row+2, 15).Style.Alignment.Horizontal =
ws.Cell(row + 2, 15).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Center;
// ws.Cell(row+3, 15).Style.Font.FontName =
// "TH SarabunPSK";
@@ -2151,8 +2265,6 @@ namespace rmutr_report.Controllers
row++;
row += r1;
row += r2;
}
}
}
@@ -2169,13 +2281,13 @@ namespace rmutr_report.Controllers
"revenue_estimates_" + date + ".xlsx");
}
}
[HttpPost, Route("reports/summary_budget_university/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumBudgetUniReport([FromRoute] string type,
[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.Load(_setting.report_path + "summary_budget_university.frx");
@@ -2201,7 +2313,7 @@ namespace rmutr_report.Controllers
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"summary_budget_university_"+date + ".xlsx");
"summary_budget_university_" + date + ".xlsx");
}
return Ok();

View File

@@ -28,6 +28,9 @@ namespace rmutr_report.Models
public DateTime? version { 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_2 { 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? 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 Guid? semester_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"?>
<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>
<BusinessObjectDataSource Name="budget_expenditure_from_revenue" ReferenceName="budget_expenditure_from_revenue" DataType="null" Enabled="true">
<Column Name="academic_year_name_th" DataType="System.String"/>
@@ -37,7 +37,7 @@
<Column Name="tuition_less_fee_per_student" DataType="System.Decimal"/>
<Column Name="education_fee_less_fee_total" DataType="System.Decimal"/>
<Column Name="topic_type" DataType="System.Int32"/>
</BusinessObjectDataSource>
</BusinessObjectDataSource>
<Column Name="sum_1" DataType="System.Decimal"/>
<Column Name="sum_2" DataType="System.Decimal"/>
<Column Name="sum_3" DataType="System.Decimal"/>