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

This commit is contained in:
kamonwan taengsuk
2023-08-22 17:07:36 +07:00
parent edf731702c
commit 5d6843f33e
9 changed files with 545 additions and 128 deletions

View File

@@ -2482,141 +2482,323 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("แผนงานบุคลากรภาครัฐ")]
[HttpPost, Route("reports/budget_expenditure_report_from_revenue/{type}")]
// [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("แบบฟอร์มสรุปรายจ่าย")]
[HttpPost, Route("reports/budget_expenditure_report_from_revenue_v2/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetBudgetExpenditureRevenueReport([FromRoute] string type,
[FromBody] budget_expenditure_report_from_revenue budget)
[FromBody] budget_expenditure_report_from_revenue_v2 budget)
{
int no = 1;
var b = budget.budgets.ToArray();
foreach (var bb in b)
int no1 = 1;
int no2 = 1;
int no3 = 1;
int no4 = 1;
int no5 = 1;
int no6 = 1;
var detail = budget.details.ToArray();
foreach (var indetail in detail)
{
bb.personnel_list_s = new List<personnel_list> { bb.personnel_lists };
foreach (var detail in bb.personnel_list_s)
if (indetail.topic_type==1)
{
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;
}
indetail.topic1 = indetail.topic;
indetail.amount1 = indetail.value1;
indetail.text1 = "บาท";
indetail.topic2 = null;
indetail.amount2 = null;
indetail.text2 = null;
}
if (indetail.topic_type==2)
{
indetail.topic2 = indetail.topic;
indetail.amount2 = indetail.value1;
indetail.text2 = "บาท";
indetail.topic1 = null;
indetail.amount1 = null;
indetail.text1 = null;
}
if (indetail.topic_type==3)
{
indetail.topic3 = indetail.topic;
indetail.amount3 = indetail.value1;
indetail.amount4 = indetail.value2;
indetail.text3 = "อัตรา";
indetail.text4 = "บาท";
indetail.topic1 = null;
indetail.amount1 = null;
indetail.text1 = null;
indetail.topic2 = null;
indetail.amount2 = null;
indetail.text2 = null;
}
if (indetail.topic_type==3 && indetail.topic=="งบดําเนินงาน")
{
indetail.topic3 = indetail.topic;
//indetail.amount3 = indetail.value1;
indetail.amount4 = indetail.value1;
indetail.text3 = null;
indetail.text4 = "บาท";
indetail.topic1 = null;
indetail.amount1 = null;
indetail.text1 = null;
indetail.topic2 = null;
indetail.amount2 = null;
indetail.amount3 = null;
indetail.text2 = null;
}
if (indetail.topic_type==4)
{
indetail.topic4 = indetail.topic;
indetail.amount5 = indetail.value1;
indetail.amount6 = indetail.value2;
indetail.text5 = "อัตรา";
indetail.text6 = "บาท";
indetail.row_no1 = no1;
no1++;
}
if (indetail.topic_type==4&& indetail.topic=="ค่าตอบแทน ค่าใช้สอยและค่าวัสดุ")
{
indetail.row_no1 = null;
indetail.amount6 = indetail.value1;
indetail.text5 = null;
indetail.amount5 =null;
indetail.text6 = "บาท";
}
if (indetail.topic_type==5)
{
indetail.topic5 = indetail.topic;
indetail.amount7 = indetail.value1;
indetail.amount8 = indetail.value2;
indetail.text7 = "อัตรา";
indetail.text8 = "บาท";
indetail.row_no2 = no2;
no2++;
}
if (indetail.topic_type==5&& indetail.topic=="ค่าตอบแทน")
{
indetail.topic5 = indetail.topic;
indetail.amount7 = null;
indetail.amount8 = indetail.value1;
indetail.text7 = null;
indetail.text8 = "บาท";
indetail.row_no2 = null;
}
if (indetail.topic_type==6)
{
indetail.topic9 = indetail.topic;
indetail.topic10 = indetail.qualification;
indetail.amount9 = indetail.value1;
indetail.amount10 = indetail.value2;
indetail.text9 = "อัตรา";
indetail.text10 = "บาท";
indetail.row_no3 = no3;
no3++;
}
if (indetail.topic_type==7)
{
indetail.topic11 = indetail.topic;
indetail.amount11 = indetail.value1;
indetail.text11 = "บาท";
indetail.row_no4 = no4;
no4++;
}
if (indetail.topic_type==8)
{
indetail.topic12 = indetail.topic;
indetail.amount12 = indetail.value1;
indetail.text12 = "บาท";
indetail.row_no5 = no5;
no5++;
}
if (indetail.topic_type==9)
{
indetail.text13 = "รายการ";
indetail.text14 = "จำนวน";
indetail.text15 = "หน่วยนับ";
indetail.text16 = "ราคาต่อหน่วย";
indetail.text17 = "รวมเงิน";
}
if (indetail.topic_type==10)
{
indetail.topic13 = indetail.topic;
indetail.amount13 = indetail.value1;
indetail.amount14 = indetail.value2;
indetail.amount15 = indetail.value3;
//indetail.amount16 = indetail.value4;
indetail.text18 = "บาท";
indetail.text19 = ".";
indetail.row_no6 = no6;
no6++;
}
}
var budgetExpenditure = new List<budget_expenditure_report_from_revenue>() { budget };
var budgetExpenditure = new List<budget_expenditure_report_from_revenue_v2>() { 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.Load(_setting.report_path + "budget_expenditure_report_from_revenue_v2.frx");
report.RegisterData(budgetExpenditure, "budget_expenditure_report_from_revenue_v2");
report.Prepare();
MemoryStream stream = new MemoryStream();
@@ -2638,11 +2820,12 @@ namespace rmutr_report.Controllers
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"budgetExpenditure_" + date + ".xlsx");
"budgetExpenditureV2_" + date + ".xlsx");
}
return Ok();
}
[SwaggerOperation("สรุปงบประมาณแผนปฏิบัติราชการประจำปี")]
[HttpPost, Route("reports/summary_government_budget_plan/{type}")]