add report ง
This commit is contained in:
@@ -234,78 +234,118 @@ namespace rmutr_report.Controllers
|
||||
public IActionResult GetStd4Report([FromRoute] string type,
|
||||
[FromBody] student_news_year _student_news_faculty)
|
||||
{
|
||||
// var std = _student_news_faculty.data;
|
||||
// var a1 = _student_news_faculty.data.Where(d => d.bachelors_degree_science1 == d.bachelors_degree_science1)
|
||||
// .Sum(o => o.bachelors_degree_science1);
|
||||
// var a2 = _student_news_faculty.data.Where(d => d.bachelors_degree_social1 == d.bachelors_degree_social1)
|
||||
// .Sum(o => o.bachelors_degree_social1);
|
||||
//
|
||||
// foreach (var data in std)
|
||||
// {
|
||||
// if (data.bachelors_degree_science1 != 0 && data.bachelors_degree_social1 != 0)
|
||||
// {
|
||||
// data.bachelors_degree_total1 = data.bachelors_degree_science1 + data.bachelors_degree_social1;
|
||||
// }
|
||||
// if (data.bachelors_degree_social1 == 0)
|
||||
// {
|
||||
// data.bachelors_degree_total1 = data.bachelors_degree_science1;
|
||||
// }
|
||||
// if (data.bachelors_degree_social1 == 0 && data.bachelors_degree_social2 == 0 )
|
||||
// {
|
||||
// data.bachelors_degree_total1 = data.bachelors_degree_science1;
|
||||
// data.bachelors_degree_total2 = data.bachelors_degree_science2;
|
||||
// }
|
||||
// if (data.bachelors_degree_science2 != 0 && data.bachelors_degree_social2 != 0)
|
||||
// {
|
||||
// data.bachelors_degree_total2 = data.bachelors_degree_science2 + data.bachelors_degree_social2;
|
||||
// }
|
||||
//
|
||||
// if (data.bachelors_degree_science1 == 0 && data.bachelors_degree_science2 == 0 )
|
||||
// {
|
||||
// data.bachelors_degree_total2 = data.bachelors_degree_social2;
|
||||
// data.bachelors_degree_total1 = data.bachelors_degree_social1;
|
||||
// }
|
||||
// data.total1 = a1;
|
||||
// data.sum_percentage_science =
|
||||
// ((data.bachelors_degree_science2 - data.bachelors_degree_science1) /
|
||||
// data.bachelors_degree_science1) * 100;
|
||||
//
|
||||
// data.sum_percentage_social = ((data.bachelors_degree_social2 - data.bachelors_degree_social1) /
|
||||
// data.bachelors_degree_social1) * 100;
|
||||
//
|
||||
// if (data.bachelors_degree_science1 == 0 || data.bachelors_degree_science2 == 0)
|
||||
// {
|
||||
//
|
||||
// data.sum_percentage_science =
|
||||
// null;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (data.bachelors_degree_social1 == 0 || data.bachelors_degree_social2 == 0)
|
||||
// {
|
||||
// data.sum_percentage_social = null;
|
||||
// }
|
||||
// var a3 = _student_news_faculty.data
|
||||
// .Where(d => d.bachelors_degree_total1 == d.bachelors_degree_total1)
|
||||
// .Sum(o => o.bachelors_degree_total1);
|
||||
// var a4 = _student_news_faculty.data
|
||||
// .Where(d => d.bachelors_degree_science2 == d.bachelors_degree_science2)
|
||||
// .Sum(o => o.bachelors_degree_science2);
|
||||
// var a5 = _student_news_faculty.data
|
||||
// .Where(d => d.bachelors_degree_social2 == d.bachelors_degree_social2)
|
||||
// .Sum(o => o.bachelors_degree_social2);
|
||||
// var a6 = _student_news_faculty.data
|
||||
// .Where(d => d.bachelors_degree_total2 == d.bachelors_degree_total2)
|
||||
// .Sum(o => o.bachelors_degree_total2);
|
||||
// data.total2 = a2;
|
||||
// data.total3 = a3;
|
||||
// data.total4 = a4;
|
||||
// data.total5 = a5;
|
||||
// data.total6 = a6;
|
||||
// data.total7 = ((data.total4 - data.total1) / data.total1) * 100;
|
||||
// data.total8 = ((data.total5 - data.total2) / data.total2) * 100;
|
||||
//
|
||||
//}
|
||||
var std = _student_news_faculty.data;
|
||||
var a1 = _student_news_faculty.data.Where(d => d.bachelors_degree_science1 == d.bachelors_degree_science1)
|
||||
.Sum(o => o.bachelors_degree_science1);
|
||||
var a2 = _student_news_faculty.data.Where(d => d.bachelors_degree_social1 == d.bachelors_degree_social1)
|
||||
.Sum(o => o.bachelors_degree_social1);
|
||||
|
||||
foreach (var data in std)
|
||||
{
|
||||
if (data.bachelors_degree_science1 != 0 && data.bachelors_degree_social1 != 0)
|
||||
{
|
||||
data.bachelors_degree_total1 = data.bachelors_degree_science1 + data.bachelors_degree_social1;
|
||||
}
|
||||
if (data.bachelors_degree_social1 == 0)
|
||||
{
|
||||
data.bachelors_degree_total1 = data.bachelors_degree_science1;
|
||||
}
|
||||
if (data.bachelors_degree_social1 == 0 && data.bachelors_degree_social2 == 0 )
|
||||
{
|
||||
data.bachelors_degree_total1 = data.bachelors_degree_science1;
|
||||
data.bachelors_degree_total2 = data.bachelors_degree_science2;
|
||||
}
|
||||
if (data.bachelors_degree_science2 != 0 && data.bachelors_degree_social2 != 0)
|
||||
{
|
||||
data.bachelors_degree_total2 = data.bachelors_degree_science2 + data.bachelors_degree_social2;
|
||||
}
|
||||
|
||||
if (data.bachelors_degree_science1 == 0 && data.bachelors_degree_science2 == 0 )
|
||||
{
|
||||
data.bachelors_degree_total2 = data.bachelors_degree_social2;
|
||||
data.bachelors_degree_total1 = data.bachelors_degree_social1;
|
||||
}
|
||||
|
||||
if (data.bachelors_degree_science1 != 0 && data.bachelors_degree_science2!=0)
|
||||
{
|
||||
|
||||
data.sum_percentage_science =
|
||||
((data.bachelors_degree_science2 - data.bachelors_degree_science1) /
|
||||
data.bachelors_degree_science1) * 100;
|
||||
|
||||
}
|
||||
// if (data.bachelors_degree_science1 == 0 || data.bachelors_degree_science2==0)
|
||||
// {
|
||||
// data.total1 = a1;
|
||||
// data.sum_percentage_science =
|
||||
// ((data.bachelors_degree_science2 - data.bachelors_degree_science1) /
|
||||
// data.bachelors_degree_science1) * 100;
|
||||
//
|
||||
// }
|
||||
if (data.bachelors_degree_social1 != 0 && data.bachelors_degree_social2 != 0)
|
||||
{
|
||||
data.sum_percentage_social = ((data.bachelors_degree_social2 - data.bachelors_degree_social1) /
|
||||
data.bachelors_degree_social1) * 100;
|
||||
}
|
||||
|
||||
if (data.bachelors_degree_science1 == 0 || data.bachelors_degree_science2 == 0)
|
||||
{
|
||||
|
||||
data.sum_percentage_science =
|
||||
null;
|
||||
|
||||
}
|
||||
|
||||
if (data.bachelors_degree_social1 == 0 || data.bachelors_degree_social2 == 0)
|
||||
{
|
||||
data.sum_percentage_social = null;
|
||||
}
|
||||
var a3 = _student_news_faculty.data
|
||||
.Where(d => d.bachelors_degree_total1 == d.bachelors_degree_total1)
|
||||
.Sum(o => o.bachelors_degree_total1);
|
||||
var a4 = _student_news_faculty.data
|
||||
.Where(d => d.bachelors_degree_science2 == d.bachelors_degree_science2)
|
||||
.Sum(o => o.bachelors_degree_science2);
|
||||
var a5 = _student_news_faculty.data
|
||||
.Where(d => d.bachelors_degree_social2 == d.bachelors_degree_social2)
|
||||
.Sum(o => o.bachelors_degree_social2);
|
||||
var a6 = _student_news_faculty.data
|
||||
.Where(d => d.bachelors_degree_total2 == d.bachelors_degree_total2)
|
||||
.Sum(o => o.bachelors_degree_total2);
|
||||
data.total1 = a1;
|
||||
data.total2 = a2;
|
||||
data.total3 = a3;
|
||||
data.total4 = a4;
|
||||
data.total5 = a5;
|
||||
data.total6 = a6;
|
||||
if (data.total1!=0 && data.total4!=0 )
|
||||
{
|
||||
data.total7 = ((data.total4 - data.total1) / data.total1) * 100;
|
||||
}
|
||||
|
||||
if (data.total1 == 0 || data.total4 == 0)
|
||||
{
|
||||
data.total7 = ((data.total4 - data.total1) / data.total1) * 100;
|
||||
}
|
||||
|
||||
if (data.total2!=0 && data.total5!=0)
|
||||
{
|
||||
data.total8 = ((data.total5 - data.total2) / data.total2) * 100;
|
||||
}
|
||||
if (data.total2==0 || data.total5==0)
|
||||
{
|
||||
data.total8 = ((data.total5 - data.total2) / data.total2) * 100;
|
||||
}
|
||||
|
||||
if (data.sum_percentage_science == null)
|
||||
{
|
||||
data.sum_percentage_science = 0;
|
||||
}
|
||||
if (data.sum_percentage_social == null)
|
||||
{
|
||||
data.sum_percentage_social = 0;
|
||||
}
|
||||
}
|
||||
var student_news_facultys = new List<student_news_year>() {_student_news_faculty};
|
||||
|
||||
Report report = new Report();
|
||||
|
||||
Reference in New Issue
Block a user