add report
This commit is contained in:
@@ -10,6 +10,7 @@ using FastReport.Export.OoXML;
|
||||
using FastReport.Export.Pdf;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using rmutr_report.Models;
|
||||
using rmutr_report.Models.RoThree;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace rmutr_report.Controllers
|
||||
@@ -544,6 +545,104 @@ namespace rmutr_report.Controllers
|
||||
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/revenue_estimate_income_summary/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetEstimateIncomeReport([FromRoute] string type, [FromBody] revenue_estimate_income_summary estimate)
|
||||
{
|
||||
var s1 = estimate.data.Sum(d => d.science_1);
|
||||
var s2 = estimate.data.Sum(d => d.social_1);
|
||||
var s3 = estimate.data.Sum(d => d.science_2);
|
||||
var s4 = estimate.data.Sum(d => d.social_2);
|
||||
var s5 = estimate.data.Sum(d => d.total_register_fee);
|
||||
var s6 = estimate.data.Sum(d => d.science_3);
|
||||
var s7 = estimate.data.Sum(d => d.social_3);
|
||||
var s8 = estimate.data.Sum(d => d.science_4);
|
||||
var s9 = estimate.data.Sum(d => d.social_4);
|
||||
var s10 = estimate.data.Sum(d => d.total_education_fee);
|
||||
var s11 = estimate.data.Sum(d => d.total_science);
|
||||
var s12 = estimate.data.Sum(d => d.total_social);
|
||||
var s13 = estimate.data.Sum(d => d.total_science_social);
|
||||
|
||||
estimate.sum_1 = s1;
|
||||
estimate.sum_2 = s2;
|
||||
estimate.sum_3 = s3;
|
||||
estimate.sum_4 = s4;
|
||||
estimate.sum_5 = s5;
|
||||
estimate.sum_6 = s6;
|
||||
estimate.sum_7 = s7;
|
||||
estimate.sum_8 = s8;
|
||||
estimate.sum_9 = s9;
|
||||
estimate.sum_10 = s10;
|
||||
estimate.sum_11 = s11;
|
||||
estimate.sum_12 = s12;
|
||||
estimate.sum_13 = s13;
|
||||
var estimateEducation = new List<revenue_estimate_income_summary>() { estimate };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "revenue_estimate_income_summary.frx");
|
||||
report.RegisterData(estimateEducation, "revenue_estimate_income_summary");
|
||||
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.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"estimateincome_" + ".xlsx");
|
||||
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost, Route("reports/revenue_estimate_education_fee/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetEstimateReport([FromRoute] string type, [FromBody] revenue_estimate_education_fee estimate)
|
||||
{
|
||||
|
||||
var estimateEducation = new List<revenue_estimate_education_fee>() { estimate };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "revenue_estimate_education_fee.frx");
|
||||
report.RegisterData(estimateEducation, "revenue_estimate_education_fee");
|
||||
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.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"estimateEducation" + ".xlsx");
|
||||
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user