add รายงานผลรอบ 6 เดือน

This commit is contained in:
kamonwan taengsuk
2023-07-18 12:09:15 +07:00
parent e723b808af
commit be0182b6ac
8 changed files with 318 additions and 2 deletions

View File

@@ -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();
}
}
}