This commit is contained in:
@@ -3476,6 +3476,42 @@ namespace rmutr_report.Controllers
|
||||
"student_overview" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[SwaggerOperation("สรุปงบประมาณรายจ่าย")]
|
||||
[HttpPost, Route("reports/summary_budget_expense/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetBudgetSummaryExpenseReport([FromRoute] string type,
|
||||
[FromBody] summary_budget_expense budget)
|
||||
{
|
||||
|
||||
var summaryBudget = new List<summary_budget_expense>() { budget };
|
||||
|
||||
Report report = new Report();
|
||||
report.Load(_setting.report_path + "summary_budget_expense.frx");
|
||||
report.RegisterData(summaryBudget, "summary_budget_expense");
|
||||
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",
|
||||
"summary_budget_expense" + ".xlsx");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user