From 4022335661166a711d7f38ed1cf846f6b69a21c9 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Tue, 14 Mar 2023 16:33:39 +0700 Subject: [PATCH] bug fixed --- .../CalculationExcessTuitionFee.Controller.cs | 30 +++++++++++++------ .../budget/calculation_excess_tuition_fee.cs | 17 ++++------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Controllers/CalculationExcessTuitionFee.Controller.cs b/Controllers/CalculationExcessTuitionFee.Controller.cs index 61e15ab..bb0f86f 100644 --- a/Controllers/CalculationExcessTuitionFee.Controller.cs +++ b/Controllers/CalculationExcessTuitionFee.Controller.cs @@ -217,7 +217,7 @@ namespace rmutr_report.Controllers expenses.teaching_hours_workload_pertype2); decimal? sum4 = (expenses.teaching_hours_workload2 - expenses.teaching_hours_workload_pertype2) * 400; - _calculation_excess_tuition_fee.total_1 = sum1; + //_calculation_excess_tuition_fee.total_1 = sum1; var sum5 = _calculation_excess_tuition_fee.data.Where(g => g.teaching_hours_workload_pertype1 == g.teaching_hours_workload_pertype1).Sum(a => a.teaching_hours_workload_pertype1); @@ -230,11 +230,23 @@ namespace rmutr_report.Controllers var sum8 = _calculation_excess_tuition_fee.data .Where(g => g.teaching_hours_workload2 == g.teaching_hours_workload2).Sum(a => a.teaching_hours_workload2); - var sum9 = sum6-sum5; + var teach_rate1 = _calculation_excess_tuition_fee.data + .Where(g => g.teach_rate_1 == g.teach_rate_1).Sum(a => + a.teach_rate_1); + var diff_teach1 = _calculation_excess_tuition_fee.data + .Where(g => g.diff_teach1 == g.diff_teach1).Sum(a => + a.diff_teach1); + var teach_rate2 = _calculation_excess_tuition_fee.data + .Where(g => g.teach_rate_2 == g.teach_rate_2).Sum(a => + a.teach_rate_2); + var diff_teach2 = _calculation_excess_tuition_fee.data + .Where(g => g.diff_teach2 == g.diff_teach2).Sum(a => + a.diff_teach2); + var sum9 = diff_teach1; var sum10 = sum9*400; - var sum11 = sum8-sum7; + var sum11 = diff_teach2; var sum12 = sum11*400; - var sum13 = sum10+sum12; + var sum13 = teach_rate1+teach_rate2; if ( expenses.name !="รวม") { ws.Cell(row, 1).Value = rowno; @@ -245,13 +257,13 @@ namespace rmutr_report.Controllers ws.Cell(row, 5).Value = expenses.pertype; ws.Cell(row, 6).Value = expenses.teaching_hours_workload_pertype1; ws.Cell(row, 7).Value = expenses.teaching_hours_workload1; - ws.Cell(row, 8).Value = sum1; - ws.Cell(row, 9).Value = sum2; + ws.Cell(row, 8).Value = expenses.diff_teach1; + ws.Cell(row, 9).Value = expenses.teach_rate_1; ws.Cell(row, 10).Value = expenses.teaching_hours_workload_pertype2; ws.Cell(row, 11).Value = expenses.teaching_hours_workload2; - ws.Cell(row, 12).Value = sum3; - ws.Cell(row, 13).Value = sum4; - ws.Cell(row, 14).Value = sum2 + sum4; + ws.Cell(row, 12).Value = expenses.diff_teach2; + ws.Cell(row, 13).Value = expenses.teach_rate_2; + ws.Cell(row, 14).Value = expenses.teach_rate_1 + expenses.teach_rate_2; ws.Range(ws.Cell(row, 1), ws.Cell(row, 14)).Style.Font.FontName = "TH Sarabun New"; diff --git a/Models/budget/calculation_excess_tuition_fee.cs b/Models/budget/calculation_excess_tuition_fee.cs index d8d2c45..fbc250e 100644 --- a/Models/budget/calculation_excess_tuition_fee.cs +++ b/Models/budget/calculation_excess_tuition_fee.cs @@ -12,14 +12,7 @@ namespace rmutr_report.Models public string academic_semester_name_th1 { get; set; } public string academic_semester_name_th2 { get; set; } public List data { get; set; } - public decimal? total_1 { get; set; } - public decimal? total_2 { get; set; } - public decimal? total_3 { get; set; } - public decimal? total_4 { get; set; } - public decimal? total_5 { get; set; } - public decimal? total_6 { get; set; } - public decimal? total_7 { get; set; } - public decimal? total_8 { get; set; } + } @@ -30,12 +23,12 @@ namespace rmutr_report.Models public string pertype { get; set; } public decimal? teaching_hours_workload_pertype1 { get; set; } public decimal? teaching_hours_workload1 { get; set; } - // public decimal? difference1 { get; set; } - // public decimal? tuition_rate1 { get; set; } + public decimal? diff_teach1 { get; set; } + public decimal? teach_rate_1 { get; set; } public decimal? teaching_hours_workload_pertype2 { get; set; } public decimal? teaching_hours_workload2 { get; set; } - // public decimal? difference2 { get; set; } - // public decimal? tuition_rate2 { get; set; } + public decimal? diff_teach2 { get; set; } + public decimal? teach_rate_2 { get; set; } //public decimal? total_budget { get; set; } } } \ No newline at end of file