add report
This commit is contained in:
@@ -227,6 +227,122 @@ namespace rmutr_report.Controllers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
[HttpPost, Route("reports/student_news_year/{type}")]
|
||||||
|
[ApiExplorerSettings(GroupName = "reports")]
|
||||||
|
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 student_news_facultys = new List<student_news_year>() {_student_news_faculty};
|
||||||
|
|
||||||
|
Report report = new Report();
|
||||||
|
report.Load(_setting.report_path + "student_news_year.frx");
|
||||||
|
report.RegisterData(student_news_facultys, "student_news_year");
|
||||||
|
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.ms-excel");
|
||||||
|
break;
|
||||||
|
case "mht":
|
||||||
|
MHTExport mht = new MHTExport();
|
||||||
|
report.Export(mht, stream);
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return File(stream, "multipart/related");
|
||||||
|
break;
|
||||||
|
case "csv":
|
||||||
|
CSVExport csv = new CSVExport();
|
||||||
|
report.Export(csv, stream);
|
||||||
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return File(stream, "text/csv");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
Models/budget/student_news_year.cs
Normal file
35
Models/budget/student_news_year.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace rmutr_report.Models
|
||||||
|
{
|
||||||
|
public class student_news_year
|
||||||
|
{
|
||||||
|
public string curriculum_name_th { get; set; }
|
||||||
|
public string academic_year_range { get; set; }
|
||||||
|
public string academic_year_name_th1 { get; set; }
|
||||||
|
public string academic_year_name_th2 { get; set; }
|
||||||
|
public List<student_news_year_detail> data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class student_news_year_detail
|
||||||
|
{
|
||||||
|
public string faculty_academy_name_th { get; set; }
|
||||||
|
|
||||||
|
public decimal? bachelors_degree_science1 { get; set; }
|
||||||
|
public decimal? bachelors_degree_social1 { get; set; }
|
||||||
|
public decimal? bachelors_degree_total1 { get; set; }
|
||||||
|
public decimal? bachelors_degree_science2 { get; set; }
|
||||||
|
public decimal? bachelors_degree_social2 { get; set; }
|
||||||
|
public decimal? bachelors_degree_total2 { get; set; }
|
||||||
|
public decimal? sum_percentage_science { get; set; }
|
||||||
|
public decimal? sum_percentage_social { get; set; }
|
||||||
|
public decimal? total1 { get; set; }
|
||||||
|
public decimal? total2 { get; set; }
|
||||||
|
public decimal? total3 { get; set; }
|
||||||
|
public decimal? total4 { get; set; }
|
||||||
|
public decimal? total5 { get; set; }
|
||||||
|
public decimal? total6 { get; set; }
|
||||||
|
public decimal? total7 { get; set; }
|
||||||
|
public decimal? total8 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="01/23/2023 21:46:25" ReportInfo.CreatorVersion="2022.1.0.0">
|
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="01/23/2023 22:31:18" ReportInfo.CreatorVersion="2022.1.0.0">
|
||||||
<Dictionary>
|
<Dictionary>
|
||||||
<BusinessObjectDataSource Name="student_news_area" ReferenceName="student_news_area" DataType="null" Enabled="true">
|
<BusinessObjectDataSource Name="student_news_area" ReferenceName="student_news_area" DataType="null" Enabled="true">
|
||||||
<Column Name="academic_year_name_th" DataType="System.String"/>
|
<Column Name="academic_year_name_th" DataType="System.String"/>
|
||||||
@@ -80,13 +80,13 @@
|
|||||||
<TableColumn Name="Column86" Width="75.6"/>
|
<TableColumn Name="Column86" Width="75.6"/>
|
||||||
<TableColumn Name="Column87" Width="75.6"/>
|
<TableColumn Name="Column87" Width="75.6"/>
|
||||||
<TableRow Name="Row15" Height="28.35">
|
<TableRow Name="Row15" Height="28.35">
|
||||||
<TableCell Name="Cell121" Fill.Color="InactiveCaption" Text="รวมทั้งสิ้น" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt" ColSpan="2"/>
|
<TableCell Name="Cell121" Fill.Color="InactiveCaption" Text="รวมทั้งสิ้น" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold" ColSpan="2"/>
|
||||||
<TableCell Name="Cell122" Border.Lines="All" Fill.Color="InactiveCaption" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell122" Border.Lines="All" Fill.Color="InactiveCaption" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell123" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell123" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell124" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell124" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell125" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell125" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell126" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total4]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell126" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total4]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell127" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total5]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell127" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total5]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableObject>
|
</TableObject>
|
||||||
</ReportSummaryBand>
|
</ReportSummaryBand>
|
||||||
|
|||||||
@@ -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="01/23/2023 21:57:14" ReportInfo.CreatorVersion="2022.1.0.0">
|
<Report ScriptLanguage="CSharp" ReportInfo.Created="09/14/2021 15:20:39" ReportInfo.Modified="01/23/2023 22:31:09" ReportInfo.CreatorVersion="2022.1.0.0">
|
||||||
<Dictionary>
|
<Dictionary>
|
||||||
<BusinessObjectDataSource Name="student_news_area" ReferenceName="student_news_area" DataType="null" Enabled="true">
|
<BusinessObjectDataSource Name="student_news_area" ReferenceName="student_news_area" DataType="null" Enabled="true">
|
||||||
<Column Name="academic_year_name_th" DataType="System.String"/>
|
<Column Name="academic_year_name_th" DataType="System.String"/>
|
||||||
@@ -80,13 +80,13 @@
|
|||||||
<TableColumn Name="Column86" Width="75.6"/>
|
<TableColumn Name="Column86" Width="75.6"/>
|
||||||
<TableColumn Name="Column87" Width="75.6"/>
|
<TableColumn Name="Column87" Width="75.6"/>
|
||||||
<TableRow Name="Row15" Height="28.35">
|
<TableRow Name="Row15" Height="28.35">
|
||||||
<TableCell Name="Cell121" Fill.Color="InactiveCaption" Text="รวมทั้งสิ้น" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt" ColSpan="2"/>
|
<TableCell Name="Cell121" Fill.Color="InactiveCaption" Text="รวมทั้งสิ้น" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold" ColSpan="2"/>
|
||||||
<TableCell Name="Cell122" Border.Lines="All" Fill.Color="InactiveCaption" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell122" Border.Lines="All" Fill.Color="InactiveCaption" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell123" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell123" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total1]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell124" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell124" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total2]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell125" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell125" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total3]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell126" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total4]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell126" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total4]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
<TableCell Name="Cell127" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total5]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 11pt"/>
|
<TableCell Name="Cell127" Border.Lines="All" Fill.Color="InactiveCaption" Text="[student_news_area.data.total5]" Format="Number" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Center" VertAlign="Center" Font="TH Sarabun New, 12pt, style=Bold"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableObject>
|
</TableObject>
|
||||||
</ReportSummaryBand>
|
</ReportSummaryBand>
|
||||||
|
|||||||
Reference in New Issue
Block a user