This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user