add รายงานผลรอบ 6 เดือน
This commit is contained in:
@@ -287,6 +287,40 @@ namespace rmutr_report.Controllers
|
||||
"kpi_" + date + ".xlsx");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost, Route("reports/kpi_performance_expenditure_budget/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetKpiBudgetReport([FromRoute] string type, [FromBody] kpi_performance_expenditure_budget kpiPerformance)
|
||||
{
|
||||
|
||||
var kpiPerformanceExpenditure = new List<kpi_performance_expenditure_budget>() { kpiPerformance };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "kpi_performance_expenditure_budget.frx");
|
||||
report.RegisterData(kpiPerformanceExpenditure, "kpi_performance_expenditure_budget");
|
||||
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",
|
||||
"kpi_performance_expenditure_budget_" + ".xlsx");
|
||||
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user