add split sum_budget report

This commit is contained in:
kamonwan taengsuk
2023-07-27 13:45:57 +07:00
parent e26ded902c
commit 3f34b172ad
8 changed files with 5783 additions and 0 deletions

View File

@@ -245,6 +245,155 @@ namespace rmutr_report.Controllers
return Ok();
}
[HttpPost, Route("reports/summary_building_table/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumbuildingReport([FromRoute] string type,
[FromBody] budget_summary_report budget_summary_reports)
{
var _budget_summary_report = new List<budget_summary_report>() { budget_summary_reports };
if (budget_summary_reports.building_1 != null)
{
foreach (var bDetail in budget_summary_reports.building_1)
{
if (bDetail.color == 1)
{
budget_summary_reports.list1 = bDetail.list;
budget_summary_reports.total_amount1 = bDetail.total_amount;
}
// if (bDetail.color == 2)
// {
// budget_summary_reports.list1 = bDetail.list;
// budget_summary_reports.total_amount1 = bDetail.total_amount;
// }
}
}
Report report = new Report();
report.Load(_setting.report_path + "summary_building_table.frx");
report.RegisterData(_budget_summary_report, "budget_summary_report");
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.ms-excel");
break;
case "mht":
MHTExport mht = new MHTExport();
report.Export(mht, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "multipart/related");
break;
case "csv":
CSVExport csv = new CSVExport();
report.Export(csv, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "text/csv");
break;
}
return Ok();
}
[HttpPost, Route("reports/summary_durable_articles_table/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumDurableArticlesReport([FromRoute] string type,
[FromBody] budget_summary_report budget_summary_reports)
{
var _budget_summary_report = new List<budget_summary_report>() { budget_summary_reports };
Report report = new Report();
report.Load(_setting.report_path + "summary_durable_articles_table.frx");
report.RegisterData(_budget_summary_report, "budget_summary_report");
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.ms-excel");
break;
case "mht":
MHTExport mht = new MHTExport();
report.Export(mht, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "multipart/related");
break;
case "csv":
CSVExport csv = new CSVExport();
report.Export(csv, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "text/csv");
break;
}
return Ok();
}
[HttpPost, Route("reports/summary_all_project_table/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetSumAllProjectReport([FromRoute] string type,
[FromBody] budget_summary_report budget_summary_reports)
{
var _budget_summary_report = new List<budget_summary_report>() { budget_summary_reports };
Report report = new Report();
report.Load(_setting.report_path + "summary_all_project_table.frx");
report.RegisterData(_budget_summary_report, "budget_summary_report");
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.ms-excel");
break;
case "mht":
MHTExport mht = new MHTExport();
report.Export(mht, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "multipart/related");
break;
case "csv":
CSVExport csv = new CSVExport();
report.Export(csv, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "text/csv");
break;
}
return Ok();
}
[HttpPost, Route("reports/summary_project_budget_proposals/{type}")]
[ApiExplorerSettings(GroupName = "reports")]