This commit is contained in:
@@ -3612,7 +3612,7 @@ namespace rmutr_report.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
[SwaggerOperation("request_summary")]
|
||||
[SwaggerOperation("รวมทุกแผน")]
|
||||
[HttpPost, Route("reports/request_summary_all_plans/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetRequestSummaryAllReport([FromRoute] string type, [FromBody] request_summary requestSummary)
|
||||
@@ -3626,25 +3626,460 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell("A2").Value = "มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
|
||||
ws.Cell("A2").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A2").Style.Font.FontSize = 16;
|
||||
|
||||
ws.Columns().AdjustToContents();
|
||||
int col = 2;
|
||||
int cols = 2;
|
||||
int rowheads = 3;
|
||||
int rowhead = 4;
|
||||
int rowt = 5;
|
||||
int rowvalue = 5;
|
||||
int row = 6;
|
||||
|
||||
int rowno = 1;
|
||||
|
||||
if (requestSummary != null)
|
||||
{
|
||||
var countbudgetplan = requestSummary.budget_plans.Count;
|
||||
var countbudgetplan = requestSummary.plans.Count;
|
||||
if (countbudgetplan==1)
|
||||
{
|
||||
foreach (var i in requestSummary.budget_plans)
|
||||
foreach (var i in requestSummary.plans)
|
||||
{
|
||||
ws.Range("A3:A5").Merge().Value = "งบรายจ่าย";
|
||||
ws.Cell(3, 2).Value = "งบประมาณ " + requestSummary.budget_year + " (คำขอ)";
|
||||
ws.Cell(4, 2).Value = i.budget_plan_name;
|
||||
ws.Cell(5, 2).Value = i.total_value;
|
||||
ws.Cell(5, 2).Value = i.value;
|
||||
ws.Cell(4, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(4, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(4, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(4, 2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(4, 2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(4, 2).Style.Font.FontSize = 16;
|
||||
ws.Cell(4, 2).Style.Alignment.WrapText = true;
|
||||
ws.Cell("A3").Style.Alignment.WrapText = true;
|
||||
ws.Cell("A3").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A3").Style.Font.FontSize = 16;
|
||||
ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(3, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(3, 2).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(3, 2).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(3, 2).Style.Font.FontSize = 16;
|
||||
ws.Cell(3, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
ws.Cell(4, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(4, 2).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(4, 2).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(4, 2).Style.Font.FontSize = 16;
|
||||
ws.Cell(4, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
ws.Cell(5, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(5, 2).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(5, 2).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(5, 2).Style.Font.FontSize = 16;
|
||||
ws.Cell(5, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
}
|
||||
|
||||
foreach (var detail in requestSummary.data_1)
|
||||
{
|
||||
|
||||
ws.Cell(row, 1).Value = detail.rowno + "." + detail.list;
|
||||
foreach (var budgetPlan in detail.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(5, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.SetBold().Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Fill.BackgroundColor =
|
||||
XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
|
||||
foreach (var detail2 in detail.data_2)
|
||||
{
|
||||
if (detail2.color=="1" && detail2.is_bold==true)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.list;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(153, 204, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
if (detail2.color=="2" && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.list;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor =XLColor.FromArgb(255, 204, 153);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
if (detail2.color=="3" && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.rowno + "." + detail2.list;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 255, 204);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
if (detail2.color==null && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.rowno + detail2.list;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
// ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 204, 153);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
foreach (var detail3 in detail2.data_3)
|
||||
{
|
||||
if (detail3.is_bold==true)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail3.rowno+detail3.list;
|
||||
foreach (var budgetPlan in detail3.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (countbudgetplan>1)
|
||||
{
|
||||
foreach (var i in requestSummary.plans)
|
||||
{
|
||||
|
||||
ws.Range("A3:A5").Merge().Value = "งบรายจ่าย";
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Merge().Value = "งบประมาณ " + requestSummary.budget_year + " (คำขอ)";
|
||||
ws.Cell(rowhead, col).Value = i.budget_plan_name;
|
||||
ws.Cell(rowvalue, col).Value = i.value;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style
|
||||
.Border
|
||||
.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
|
||||
ws.Cell(rowhead, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(rowhead, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(rowhead, col).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowhead, col).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowhead, col).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(rowhead, col).Style.Font.FontSize = 16;
|
||||
ws.Cell(rowhead, col).Style.Alignment.WrapText = true;
|
||||
ws.Cell(rowhead, col).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
|
||||
ws.Cell("A3").Style.Alignment.WrapText = true;
|
||||
ws.Cell("A3").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A3").Style.Font.FontSize = 16;
|
||||
ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(rowvalue, col).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowvalue, col).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(rowvalue, col).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(rowvalue, col).Style.Font.FontSize = 16;
|
||||
ws.Cell(rowvalue, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(rowvalue, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(rowvalue, col).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col++;
|
||||
}
|
||||
|
||||
foreach (var detail in requestSummary.data_1)
|
||||
{
|
||||
int col2 = 2;
|
||||
ws.Cell(row, 1).Value = detail.rowno + "." + detail.list;
|
||||
// int col2 = 2;
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.SetBold().Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Fill.BackgroundColor =
|
||||
XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
foreach (var budgetPlan in detail.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Fill.BackgroundColor = XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.SetBold().Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
}
|
||||
row++;
|
||||
|
||||
foreach (var detail2 in detail.data_2)
|
||||
{
|
||||
if (detail2.color=="1" && detail2.is_bold==true)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.list;
|
||||
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(153, 204, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Fill.BackgroundColor = XLColor.FromArgb(153, 204, 255);
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.SetBold().Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
}
|
||||
// col2++;
|
||||
row++;
|
||||
|
||||
}
|
||||
if (detail2.color=="2" && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.list;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor =XLColor.FromArgb(255, 204, 153);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 204, 153);
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
|
||||
}
|
||||
//col2++;
|
||||
row++;
|
||||
|
||||
}
|
||||
if (detail2.color=="3" && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.rowno + "." + detail2.list;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 255, 204);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 255, 204);
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
|
||||
}
|
||||
// col2++;
|
||||
row++;
|
||||
|
||||
}
|
||||
if (detail2.color==null && detail2.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail2.rowno + detail2.list;
|
||||
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
|
||||
}
|
||||
//col2++;
|
||||
row++;
|
||||
|
||||
}
|
||||
foreach (var detail3 in detail2.data_3)
|
||||
{
|
||||
if (detail3.is_bold==true)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail3.rowno+detail3.list;
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail3.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.SetBold().Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
|
||||
col2++;
|
||||
}
|
||||
// col2++;
|
||||
row++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
workbook.SaveAs(stream);
|
||||
var content = stream.ToArray();
|
||||
return File(
|
||||
content,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"all_plans" + ".xlsx");
|
||||
}
|
||||
}
|
||||
[SwaggerOperation("แผนบูรณาการแผนยุทธศาสตร์")]
|
||||
[HttpPost, Route("reports/request_summary_integrated_strategic/{type}")]
|
||||
[ApiExplorerSettings(GroupName = "reports")]
|
||||
public IActionResult GetRequestSummary2Report([FromRoute] string type, [FromBody] request_summary requestSummary)
|
||||
{
|
||||
var workbook = new XLWorkbook();
|
||||
var ws = workbook.Worksheets.Add("Sheet1");
|
||||
|
||||
ws.Cell("A1").Value = "งบประมาณแผ่นดิน ปีงบประมาณ พ.ศ. "+requestSummary.budget_year+" (คำขอ)";
|
||||
ws.Cell("A1").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A1").Style.Font.FontSize = 16;
|
||||
ws.Cell("A2").Value = "มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
|
||||
ws.Cell("A2").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A2").Style.Font.FontSize = 16;
|
||||
ws.Columns().AdjustToContents();
|
||||
int col = 2;
|
||||
int cols = 2;
|
||||
int rowheads = 3;
|
||||
int rowhead = 4;
|
||||
int rowvalue = 5;
|
||||
int row = 6;
|
||||
|
||||
int rowno = 1;
|
||||
|
||||
if (requestSummary != null)
|
||||
{
|
||||
var countbudgetplan = requestSummary.plans.Count;
|
||||
if (countbudgetplan==1)
|
||||
{
|
||||
foreach (var i in requestSummary.plans)
|
||||
{
|
||||
ws.Range("A3:A5").Merge().Value = "งบรายจ่าย";
|
||||
ws.Cell(3, 2).Value = "งบประมาณ " + requestSummary.budget_year + " (คำขอ)";
|
||||
ws.Cell(4, 2).Value = i.budget_plan_name;
|
||||
ws.Cell(5, 2).Value = i.value;
|
||||
ws.Cell(4, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(4, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(4, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
@@ -3674,126 +4109,224 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell(5, 2).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(5, 2).Style.Font.FontSize = 16;
|
||||
ws.Cell(5, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
// ws.Cell(rowhead, col).Value = i.budget_plan_name;
|
||||
// ws.Cell(rowhead, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
// ws.Cell(rowhead, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
// ws.Cell(rowhead, col).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
// ws.Cell(rowhead, col).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||
// ws.Cell(rowhead, col).Style.Font.FontName = "TH SarabunPSK";
|
||||
// ws.Cell(rowhead, col).Style.Font.FontSize = 16;
|
||||
// ws.Cell(rowhead, col).Style.Alignment.WrapText = true;
|
||||
// col++;
|
||||
// ws.Cell(3, 2).Value = "งบประมาณ " + requestSummary.budget_year + " (คำขอ)";
|
||||
}
|
||||
|
||||
foreach (var detail in requestSummary.data)
|
||||
foreach (var detail in requestSummary.data_1)
|
||||
{
|
||||
if (detail.color==1&&detail.is_bold==null)
|
||||
|
||||
ws.Cell(row, 1).Value = detail.rowno + "." + detail.list;
|
||||
foreach (var budgetPlan in detail.plans)
|
||||
{
|
||||
ws.Cell(row, 1).Value = rowno+"."+detail.list;
|
||||
rowno++;
|
||||
foreach (var budgetPlan in detail.budget_plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Cell(row,1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(5,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
|
||||
row++;
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
if (detail.color==2&&detail.is_bold==true)
|
||||
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(5, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.SetBold().Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Fill.BackgroundColor =
|
||||
XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
|
||||
foreach (var detail2 in detail.data_2)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail.list;
|
||||
foreach (var budgetPlan in detail.budget_plans)
|
||||
ws.Cell(row, 1).Value = detail2.rowno + detail2.list;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
|
||||
foreach (var detail3 in detail2.data_3)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
|
||||
ws.Cell(row, 1).Value = detail3.rowno+detail3.list;
|
||||
foreach (var budgetPlan in detail3.plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
|
||||
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(153, 204, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
if (detail.color==3&&detail.is_bold==null)
|
||||
{
|
||||
ws.Cell(row, 1).Value = detail.list;
|
||||
foreach (var budgetPlan in detail.budget_plans)
|
||||
{
|
||||
ws.Cell(row, 2).Value = budgetPlan.value;
|
||||
}
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 204, 153);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
row++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (countbudgetplan>1)
|
||||
{
|
||||
foreach (var i in requestSummary.plans)
|
||||
{
|
||||
|
||||
ws.Range("A3:A5").Merge().Value = "งบรายจ่าย";
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Merge().Value = "งบประมาณ " + requestSummary.budget_year + " (คำขอ)";
|
||||
ws.Cell(rowhead, col).Value = i.budget_plan_name;
|
||||
ws.Cell(rowvalue, col).Value = i.value;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style
|
||||
.Border
|
||||
.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(rowheads, cols), ws.Cell(rowheads , cols+ countbudgetplan - 1)).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
|
||||
ws.Cell(rowhead, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(rowhead, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(rowhead, col).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowhead, col).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowhead, col).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(rowhead, col).Style.Font.FontSize = 16;
|
||||
ws.Cell(rowhead, col).Style.Alignment.WrapText = true;
|
||||
ws.Cell(rowhead, col).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
|
||||
ws.Cell("A3").Style.Alignment.WrapText = true;
|
||||
ws.Cell("A3").Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell("A3").Style.Font.FontSize = 16;
|
||||
ws.Range("A3:A5").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range("A3:A5").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range("A3:A5").Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(rowvalue, col).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(rowvalue, col).Style.Fill.BackgroundColor = XLColor.FromArgb(255, 153, 204);
|
||||
ws.Cell(rowvalue, col).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(rowvalue, col).Style.Font.FontSize = 16;
|
||||
ws.Cell(rowvalue, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Cell(rowvalue, col).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(rowvalue, col).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(rowvalue, col).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col++;
|
||||
}
|
||||
|
||||
foreach (var detail in requestSummary.data_1)
|
||||
{
|
||||
int col2 = 2;
|
||||
ws.Cell(row, 1).Value = detail.rowno + "." + detail.list;
|
||||
// int col2 = 2;
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Alignment.Vertical =
|
||||
XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.SetBold().Font.FontName =
|
||||
"TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.FontSize = 16;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Fill.BackgroundColor =
|
||||
XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
foreach (var budgetPlan in detail.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Fill.BackgroundColor = XLColor.FromArgb(204, 153, 255);
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.SetBold().Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
col2++;
|
||||
}
|
||||
row++;
|
||||
|
||||
foreach (var detail2 in detail.data_2)
|
||||
{
|
||||
ws.Cell(row, 1).Value =detail2.rowno + detail2.list;
|
||||
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.SetBold().Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail2.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.SetBold().Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
}
|
||||
|
||||
row++;
|
||||
|
||||
|
||||
|
||||
foreach (var detail3 in detail2.data_3)
|
||||
{
|
||||
|
||||
ws.Cell(row, 1).Value = detail3.rowno+detail3.list;
|
||||
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
ws.Cell(row,2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Range(ws.Cell(row, 1),ws.Cell(row,2)).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
col2 = 2;
|
||||
foreach (var budgetPlan in detail3.plans)
|
||||
{
|
||||
ws.Cell(row, col2).Value = budgetPlan.value;
|
||||
ws.Cell(row, col2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, col2).Style.Font.FontName = "TH SarabunPSK";
|
||||
ws.Cell(row, col2).Style.Font.FontSize = 16;
|
||||
ws.Cell(row, col2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Cell(row, col2).Style.NumberFormat.SetFormat("#,#");
|
||||
ws.Cell(row, col2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
col2++;
|
||||
|
||||
}
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
workbook.SaveAs(stream);
|
||||
var content = stream.ToArray();
|
||||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
return File(
|
||||
content,
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
date + ".xlsx");
|
||||
"integrated_strategic" + ".xlsx");
|
||||
}
|
||||
}
|
||||
// [SwaggerOperation("แผนบูรณาการแผนยุทธศาสตร์")]
|
||||
// [HttpPost, Route("reports/request_summary_integrated_strategic/{type}")]
|
||||
// [ApiExplorerSettings(GroupName = "reports")]
|
||||
// public IActionResult GetBudgetRequestSummary2Report([FromRoute] string type,
|
||||
// [FromBody] request_summary requestSummary)
|
||||
// {
|
||||
//
|
||||
// var requestSummaries = new List<request_summary>() { requestSummary };
|
||||
//
|
||||
// Report report = new Report();
|
||||
// report.Load(_setting.report_path + "integrated_strategic.frx");
|
||||
// report.RegisterData(requestSummaries, "request_summary");
|
||||
// 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",
|
||||
// "request_summary" + ".xlsx");
|
||||
// }
|
||||
//
|
||||
// return Ok();
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,27 +5,42 @@ namespace rmutr_report.Models.RoThree
|
||||
public class request_summary
|
||||
{
|
||||
public string budget_year { get; set; }
|
||||
public List<request_summary_detail> data { get; set; }
|
||||
public List<budget_plan_data> budget_plans { get; set; }
|
||||
public string short_budget_year { get; set; }
|
||||
public List<budget_plan> plans { get; set; }
|
||||
public List<request_summary_detail> data_1 { get; set; }
|
||||
}
|
||||
|
||||
public class request_summary_detail
|
||||
{
|
||||
public string rowno { get; set; }
|
||||
public string list { get; set; }
|
||||
public bool? is_bold { get; set; }
|
||||
public int? color { get; set; }
|
||||
public List<budget_plan> budget_plans { get; set; }
|
||||
public List<budget_plan> plans { get; set; }
|
||||
public List<request_summary_detail2> data_2 { get; set; }
|
||||
}
|
||||
|
||||
public class request_summary_detail2
|
||||
{
|
||||
public string rowno { get; set; }
|
||||
public string list { get; set; }
|
||||
public List<budget_plan> plans { get; set; }
|
||||
public bool? is_bold { get; set; } // 1 true 2 null 3 null , //true
|
||||
public string color { get; set; } //1 ฟ้า 2 ส้ม 3 เหลือง ,
|
||||
public List<request_summary_detail3> data_3 { get; set; }
|
||||
}
|
||||
|
||||
public class request_summary_detail3
|
||||
{
|
||||
public string rowno { get; set; }
|
||||
public string list { get; set; }
|
||||
public List<budget_plan> plans { get; set; }
|
||||
public bool? is_bold { get; set; } // true
|
||||
}
|
||||
|
||||
public class budget_plan
|
||||
{
|
||||
public string budget_plan_name { get; set; }
|
||||
public decimal? value { get; set; }
|
||||
|
||||
}
|
||||
public class budget_plan_data
|
||||
{
|
||||
public string budget_plan_name { get; set; }
|
||||
public decimal? total_value { get; set; }
|
||||
|
||||
}
|
||||
// public class request_summary_detail2
|
||||
// {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("rmutr_report")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9c37d45f5cd26f307eeed46e82c6833c27288b33")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e3335ae91ef9baabb47da357b8b7aab82d9a6379")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("rmutr_report")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("rmutr_report")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
ce1e068e9e13ade3aae57571fad3b5eebac258828f5dbf8839f024cafd6dced7
|
||||
a7b7d5b2aff46867fbc8b661104f49364ba3a3101b36bc40e3ec970d1c88ff22
|
||||
|
||||
@@ -1 +1 @@
|
||||
71dbdc370cb9ef82945d6737f2f7a61200e20b5f6e8324df2cb0a1160a0f7103
|
||||
7d8bc7748bcb23f08efa6e2e64caaaec25fe7f0de58058885b3c182813ae57c3
|
||||
|
||||
@@ -1 +1 @@
|
||||
c81af41a9295edacc0b0b98a065abf98cbd4813501de03ef2da5eb8042cde125
|
||||
bd7a28b1ff560d689700f9ca68bb84d5faf27c38aa05370d4e053cc99d63dbce
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -48,6 +48,38 @@
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\academic_position_leave_graph.frx))</OriginalItemSpec>
|
||||
</StaticWebAsset>
|
||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\all_plans.frx))">
|
||||
<SourceType>Package</SourceType>
|
||||
<SourceId>rmutr_report</SourceId>
|
||||
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
|
||||
<BasePath>_content/rmutr_report</BasePath>
|
||||
<RelativePath>reports\all_plans.frx</RelativePath>
|
||||
<AssetKind></AssetKind>
|
||||
<AssetMode></AssetMode>
|
||||
<AssetRole></AssetRole>
|
||||
<RelatedAsset></RelatedAsset>
|
||||
<AssetTraitName></AssetTraitName>
|
||||
<AssetTraitValue></AssetTraitValue>
|
||||
<CopyToOutputDirectory></CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\all_plans.frx))</OriginalItemSpec>
|
||||
</StaticWebAsset>
|
||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\all_plans2.frx))">
|
||||
<SourceType>Package</SourceType>
|
||||
<SourceId>rmutr_report</SourceId>
|
||||
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
|
||||
<BasePath>_content/rmutr_report</BasePath>
|
||||
<RelativePath>reports\all_plans2.frx</RelativePath>
|
||||
<AssetKind></AssetKind>
|
||||
<AssetMode></AssetMode>
|
||||
<AssetRole></AssetRole>
|
||||
<RelatedAsset></RelatedAsset>
|
||||
<AssetTraitName></AssetTraitName>
|
||||
<AssetTraitValue></AssetTraitValue>
|
||||
<CopyToOutputDirectory></CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\all_plans2.frx))</OriginalItemSpec>
|
||||
</StaticWebAsset>
|
||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\appoint_higher_position.frx))">
|
||||
<SourceType>Package</SourceType>
|
||||
<SourceId>rmutr_report</SourceId>
|
||||
@@ -864,6 +896,22 @@
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\hr_summary_study_leave.frx))</OriginalItemSpec>
|
||||
</StaticWebAsset>
|
||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\integrated_strategic.frx))">
|
||||
<SourceType>Package</SourceType>
|
||||
<SourceId>rmutr_report</SourceId>
|
||||
<ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
|
||||
<BasePath>_content/rmutr_report</BasePath>
|
||||
<RelativePath>reports\integrated_strategic.frx</RelativePath>
|
||||
<AssetKind></AssetKind>
|
||||
<AssetMode></AssetMode>
|
||||
<AssetRole></AssetRole>
|
||||
<RelatedAsset></RelatedAsset>
|
||||
<AssetTraitName></AssetTraitName>
|
||||
<AssetTraitValue></AssetTraitValue>
|
||||
<CopyToOutputDirectory></CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\integrated_strategic.frx))</OriginalItemSpec>
|
||||
</StaticWebAsset>
|
||||
<StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\reports\investment_budget_summary.frx))">
|
||||
<SourceType>Package</SourceType>
|
||||
<SourceId>rmutr_report</SourceId>
|
||||
|
||||
@@ -1 +1 @@
|
||||
33814906f52e0f8cfd7bb5360baea6c562ab42de0f2574d78acf3490ba1b4515
|
||||
5e2b0a0b0aae1729058a1b869c574d0d8376900c6cb993c5031e219c517c5065
|
||||
|
||||
Reference in New Issue
Block a user