undo แบบฟอร์มสรุปรายจ่าย v1
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kamonwan taengsuk
2023-08-29 14:55:51 +07:00
parent c29c95b2e6
commit 0d68171be0
12 changed files with 161 additions and 161 deletions

View File

@@ -2482,166 +2482,166 @@ namespace rmutr_report.Controllers
return Ok();
}
// [SwaggerOperation("แผนงานบุคลากรภาครัฐ")]
// [HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")]
// [ApiExplorerSettings(GroupName = "reports")]
// public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type,
// [FromBody] budget_expenditure_report_from_revenue budget)
// {
// int no = 1;
//
// var b = budget.budgets.ToArray();
// foreach (var bb in b)
// {
// bb.personnel_list_s = new List<personnel_list> { bb.personnel_lists };
// foreach (var detail in bb.personnel_list_s)
// {
// foreach (var detail2 in detail.budget_personnel_lists)
// {
// if (detail2.rate != null)
// {
// detail2.text1 = "อัตรา";
// }
//
// var cperson = detail.budget_personnel_lists.Count();
//
// if (cperson == 1)
// {
// detail.budget_personnel_lists[0].topic = "งบบุคลากร";
// }
//
// foreach (var detail3 in detail2.budget_personnel_lists_2)
// {
// if (detail3.rate != null)
// {
// detail3.text1 = "อัตรา";
// }
//
// int no2 = 1;
//
// if (detail3.topic != null)
// {
// detail3.row_no = no;
// no++;
// }
//
// foreach (var detail4 in detail3.budget_rates)
// {
// if (detail4.rate != null)
// {
// detail4.text1 = "อัตรา";
// }
//
// int no3 = 1;
// if (detail4.topic != null)
// {
// detail4.row_no = no2;
// no2++;
// }
//
// foreach (var detail5 in detail4.details)
// {
// int no4 = 1;
// if (detail5.rate != null)
// {
// detail5.text1 = "อัตรา";
// }
//
// if (detail5.position_level != null)
// {
// detail5.row_no = no3;
// no3++;
// }
//
// if (detail5.details2 != null)
// {
// foreach (var detail6 in detail5.details2)
// {
// if (detail6.topic != null)
// {
// detail6.row_no = no4;
// no4++;
// detail6.text1 = "บาท";
// }
// }
// }
//
// if (detail5.details2.Any())
// {
// if (detail5.details2==null)
// {
// foreach (var detail6 in detail5.details2)
// {
// detail6.topic = null;
// detail6.total = null;
// detail6.row_no = null;
// detail6.text1 = null;
// }
// }
// }
// else
// {
// detail5.details2.Add(new details2()
// {
// topic = "", total = 999999999
// });
// }
// }
// }
// }
//
//
// if (cperson == 2)
// {
// detail.budget_personnel_lists[0].topic = "งบบุคลากร";
// detail.budget_personnel_lists[1].topic = "งบดําเนินงาน";
// detail.budget_personnel_lists[1].text1 = null;
// detail.budget_personnel_lists[1].budget_personnel_lists_2[0].text1 = null;
// detail.budget_personnel_lists[1].budget_personnel_lists_2[0].row_no = null;
// detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
// .row_no = null;
// detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
// .text1 = null;
// detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
// .details[0].text1 = null;
// }
// }
// }
// }
//
//
// var budgetExpenditure = new List<budget_expenditure_report_from_revenue>() { budget };
//
// Report report = new Report();
// report.Load(_setting.report_path + "budget_expenditure_report_from_revenue.frx");
// report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue");
// 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");
// string date = DateTime.Now.ToString("yyyyMMddHHmmss");
// return File(
// stream,
// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
// "budgetExpenditure_" + date + ".xlsx");
// }
//
// return Ok();
// }
[SwaggerOperation("แบบฟอร์มสรุปรายจ่าย")]
[SwaggerOperation("แบบฟอร์มสรุปรายจ่าย v1")]
[HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type,
[FromBody] budget_expenditure_report_from_revenue budget)
{
int no = 1;
var b = budget.budgets.ToArray();
foreach (var bb in b)
{
bb.personnel_list_s = new List<personnel_list> { bb.personnel_lists };
foreach (var detail in bb.personnel_list_s)
{
foreach (var detail2 in detail.budget_personnel_lists)
{
if (detail2.rate != null)
{
detail2.text1 = "อัตรา";
}
var cperson = detail.budget_personnel_lists.Count();
if (cperson == 1)
{
detail.budget_personnel_lists[0].topic = "งบบุคลากร";
}
foreach (var detail3 in detail2.budget_personnel_lists_2)
{
if (detail3.rate != null)
{
detail3.text1 = "อัตรา";
}
int no2 = 1;
if (detail3.topic != null)
{
detail3.row_no = no;
no++;
}
foreach (var detail4 in detail3.budget_rates)
{
if (detail4.rate != null)
{
detail4.text1 = "อัตรา";
}
int no3 = 1;
if (detail4.topic != null)
{
detail4.row_no = no2;
no2++;
}
foreach (var detail5 in detail4.details)
{
int no4 = 1;
if (detail5.rate != null)
{
detail5.text1 = "อัตรา";
}
if (detail5.position_level != null)
{
detail5.row_no = no3;
no3++;
}
if (detail5.details2 != null)
{
foreach (var detail6 in detail5.details2)
{
if (detail6.topic != null)
{
detail6.row_no = no4;
no4++;
detail6.text1 = "บาท";
}
}
}
if (detail5.details2.Any())
{
if (detail5.details2==null)
{
foreach (var detail6 in detail5.details2)
{
detail6.topic = null;
detail6.total = null;
detail6.row_no = null;
detail6.text1 = null;
}
}
}
else
{
detail5.details2.Add(new details2()
{
topic = "", total = 999999999
});
}
}
}
}
if (cperson == 2)
{
detail.budget_personnel_lists[0].topic = "งบบุคลากร";
detail.budget_personnel_lists[1].topic = "งบดําเนินงาน";
detail.budget_personnel_lists[1].text1 = null;
detail.budget_personnel_lists[1].budget_personnel_lists_2[0].text1 = null;
detail.budget_personnel_lists[1].budget_personnel_lists_2[0].row_no = null;
detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
.row_no = null;
detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
.text1 = null;
detail.budget_personnel_lists[1].budget_personnel_lists_2[0].budget_rates[0]
.details[0].text1 = null;
}
}
}
}
var budgetExpenditure = new List<budget_expenditure_report_from_revenue>() { budget };
Report report = new Report();
report.Load(_setting.report_path + "budget_expenditure_report_from_revenue.frx");
report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue");
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");
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"budgetExpenditure_" + date + ".xlsx");
}
return Ok();
}
[SwaggerOperation("แบบฟอร์มสรุปรายจ่าย v2")]
[HttpPost, Route("reports/budget_expenditure_report_from_revenue_v2/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type,