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

This commit is contained in:
kamonwan taengsuk
2023-09-28 16:53:25 +07:00
parent 86e6717cf9
commit cbddecb9d5
11 changed files with 314 additions and 43 deletions

View File

@@ -2013,6 +2013,9 @@ namespace rmutr_report.Controllers
ws.Column(1).Width = 30;
ws.Column(2).Width = 15;
ws.Column(3).Width = 15;
ws.Column(4).Width = 15;
ws.Column(5).Width = 15;
ws.Column(6).Width = 15;
ws.Column(7).Width = 15;
@@ -2032,7 +2035,6 @@ namespace rmutr_report.Controllers
ws.Row(6).Height = 30;
int row = 7;
//int no = 1;
if (revenue_estimate != null)
{
ws.Range("A5:A6").Merge().Value = "ผลผลิต / ภาคการศึกษา / ภาคเรียน";
@@ -2110,37 +2112,37 @@ namespace rmutr_report.Controllers
int r1 = 1;
int r2 = 2;
// var sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.revenue_estimates);
// var sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_revenue_estimates);
// var sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_revenue_estimates);
// var sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_accumulated_income);
// var sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_before_allocating_according);
// var sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_utility_bills);
// var sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_budget);
// var sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_expenditure);
// var sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.expenditure_limit);
var sum1 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.revenue_estimates);
var sum2 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_revenue_estimates);
var sum3 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_revenue_estimates);
var sum4 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.less_accumulated_income);
var sum5 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.balance_before_allocating_according);
var sum6 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_utility_bills);
var sum7 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_budget);
var sum8 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.contribution_central_expenditure);
var sum9 = revenue_estimate.revenue_estimates_details.Where(j=>j.topic_type==3).Sum(d => d.expenditure_limit);
foreach (var detail in revenue_estimate.revenue_estimates_details)
{
if (detail.topic_type == 1)
{
ws.Cell(row, 1).Value = detail.topic;
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
@@ -2193,23 +2195,23 @@ namespace rmutr_report.Controllers
if (detail.topic_type == 2)
{
ws.Cell(row, 1).Value = detail.topic;
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
@@ -2281,7 +2283,7 @@ namespace rmutr_report.Controllers
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
"TH SarabunPSK";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 14;
//ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 14;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
@@ -2290,7 +2292,6 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 19)).Style.Alignment.Horizontal =
XLAlignmentHorizontalValues.Right;
//ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor = XLColor.FromArgb(252, 228, 214);
ws.Cell(row, 2).Style.NumberFormat.SetFormat("#,#0");
ws.Cell(row, 4).Style.NumberFormat.SetFormat("#,#0");
@@ -2320,31 +2321,48 @@ namespace rmutr_report.Controllers
ws.Cell(row, 17).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 18).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 19).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 1).Style.Font.FontSize = 14;
ws.Cell(row, 2).Style.Font.FontSize = 14;
ws.Cell(row, 3).Style.Font.FontSize = 14;
ws.Cell(row, 4).Style.Font.FontSize = 14;
ws.Cell(row, 5).Style.Font.FontSize = 14;
ws.Cell(row, 6).Style.Font.FontSize = 14;
ws.Cell(row, 7).Style.Font.FontSize = 14;
ws.Cell(row, 8).Style.Font.FontSize = 14;
ws.Cell(row, 9).Style.Font.FontSize = 14;
ws.Cell(row, 10).Style.Font.FontSize = 14;
ws.Cell(row, 11).Style.Font.FontSize = 14;
ws.Cell(row, 12).Style.Font.FontSize = 14;
ws.Cell(row, 13).Style.Font.FontSize = 14;
ws.Cell(row, 14).Style.Font.FontSize = 14;
ws.Cell(row, 15).Style.Font.FontSize = 14;
ws.Cell(row, 16).Style.Font.FontSize = 14;
ws.Cell(row, 17).Style.Font.FontSize = 14;
ws.Cell(row, 18).Style.Font.FontSize = 14;
ws.Cell(row, 19).Style.Font.FontSize = 14;
row++;
}
// if (detail.topic_type == 4)
// {
if (detail.topic_type == 4)
if (detail.topic_type == 4)
{
ws.Cell(row, 1).Value = "รวม";
ws.Cell(row, 2).Value = detail.revenue_estimates;
ws.Cell(row, 2).Value = sum1;//detail.revenue_estimates;
ws.Cell(row, 3).Value = "บาท";
ws.Cell(row, 4).Value = detail.less_revenue_estimates;
ws.Cell(row, 4).Value = sum2;//detail.less_revenue_estimates;
ws.Cell(row, 5).Value = "บาท";
ws.Cell(row, 6).Value = detail.balance_revenue_estimates;
ws.Cell(row, 6).Value = sum3;//detail.balance_revenue_estimates;
ws.Cell(row, 7).Value = "บาท";
ws.Cell(row, 8).Value = detail.less_accumulated_income;
ws.Cell(row, 8).Value = sum4;//detail.less_accumulated_income;
ws.Cell(row, 9).Value = "บาท";
ws.Cell(row, 10).Value = detail.balance_before_allocating_according;
ws.Cell(row, 10).Value = sum5;//detail.balance_before_allocating_according;
ws.Cell(row, 11).Value = "บาท";
ws.Cell(row, 12).Value = detail.contribution_utility_bills;
ws.Cell(row, 12).Value = sum6;//detail.contribution_utility_bills;
ws.Cell(row, 13).Value = "บาท";
ws.Cell(row, 14).Value = detail.contribution_central_budget;
ws.Cell(row, 14).Value = sum7;//detail.contribution_central_budget;
ws.Cell(row, 15).Value = "บาท";
ws.Cell(row, 16).Value = detail.contribution_central_expenditure;
ws.Cell(row, 16).Value = sum8;//detail.contribution_central_expenditure;
ws.Cell(row, 17).Value = "บาท";
ws.Cell(row, 18).Value = detail.expenditure_limit;
ws.Cell(row, 18).Value = sum9;//detail.expenditure_limit;
ws.Cell(row, 19).Value = "บาท";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =

View File

@@ -4392,6 +4392,43 @@ namespace rmutr_report.Controllers
"budget_income_qualification" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("รายงานสรุปประมาณการรายรับ หลักสูตรสหกิจศึกษา")]
[HttpPost, Route("reports/summary_income_cooperative/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetCooperativeReport([FromRoute] string type,
[FromBody] summary_income_cooperative cooperative)
{
var cooperatives = new List<summary_income_cooperative>() { cooperative };
Report report = new Report();
report.Load(_setting.report_path + "summary_income_cooperative.frx");
report.RegisterData(cooperatives, "summary_income_cooperative");
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",
"Cooperative" + ".xlsx");
}
return Ok();
}
}