bug fixed
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kamonwan taengsuk
2023-09-28 16:53:25 +07:00
parent 86e6717cf9
commit cbddecb9d5
11 changed files with 314 additions and 43 deletions

View File

@@ -4392,6 +4392,43 @@ namespace rmutr_report.Controllers
"budget_income_qualification" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("รายงานสรุปประมาณการรายรับ หลักสูตรสหกิจศึกษา")]
[HttpPost, Route("reports/summary_income_cooperative/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetCooperativeReport([FromRoute] string type,
[FromBody] summary_income_cooperative cooperative)
{
var cooperatives = new List<summary_income_cooperative>() { cooperative };
Report report = new Report();
report.Load(_setting.report_path + "summary_income_cooperative.frx");
report.RegisterData(cooperatives, "summary_income_cooperative");
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",
"Cooperative" + ".xlsx");
}
return Ok();
}
}