Add report
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
kamonwan taengsuk
2024-02-16 14:13:50 +07:00
parent 5f44fa4ecb
commit aa6b674ced
26 changed files with 320 additions and 11 deletions

View File

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