Update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kamonwan taengsuk
2024-08-07 17:30:09 +07:00
parent 14cf3e4081
commit a1f853b870
5 changed files with 376 additions and 0 deletions

View File

@@ -3512,6 +3512,77 @@ namespace rmutr_report.Controllers
"summary_budget_expense" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("ประมาณการรายรับ รายจ่าย")]
[HttpPost, Route("reports/estimate_income_expenses/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetEstimateReport([FromRoute] string type,
[FromBody] estimate_income_expenses budget)
{
var summaryBudget = new List<estimate_income_expenses>() { budget };
Report report = new Report();
report.Load(_setting.report_path + "estimate_income_expenses.frx");
report.RegisterData(summaryBudget, "estimate_income_expenses");
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",
"estimate_income_expenses" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("สรุปรายรับ และการจัดสรร")]
[HttpPost, Route("reports/summary_income_allocation/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetAllocationReport([FromRoute] string type,
[FromBody] estimate_income_expenses budget)
{
var summaryBudget = new List<estimate_income_expenses>() { budget };
Report report = new Report();
report.Load(_setting.report_path + "summary_income_allocation.frx");
report.RegisterData(summaryBudget, "estimate_income_expenses");
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_income_allocation" + ".xlsx");
}
return Ok();
}
}