add report
This commit is contained in:
@@ -1554,5 +1554,41 @@ namespace rmutr_report.Controllers
|
||||
"basic_plan_all_" + date + ".xlsx");
|
||||
}
|
||||
}
|
||||
[HttpPost, Route("reports/summary_strategic/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetSumStrategicReport([FromRoute] string type, [FromBody] summary_strategic summary_strategics)
|
||||
{ var _summary_strategic = new List<summary_strategic>() { summary_strategics };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "summary_strategic.frx");
|
||||
report.RegisterData(_summary_strategic, "summary_strategic");
|
||||
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");
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
return File(
|
||||
stream,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
date + ".xlsx");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user