This commit is contained in:
kamonwan taengsuk
2023-03-22 17:16:42 +07:00
parent 843be595c0
commit 6e8fb252f0
10 changed files with 3081 additions and 1707 deletions

View File

@@ -484,6 +484,67 @@ namespace rmutr_report.Controllers
foreach (var equipments in summary_of_equipments.header_data)
{
if (equipments.color == 1)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = equipments.list;
ws.Cell(row, 3).Value = null;
ws.Cell(row, 4).Value = null;
ws.Cell(row, 5).Value = null;
ws.Cell(row, 6).Value = null;
ws.Cell(row, 7).Value = null;
ws.Cell(row, 8).Value = equipments.unit_price;
ws.Cell(row, 9).Value = equipments.price_1;
ws.Cell(row, 10).Value = equipments.price_2;
ws.Cell(row, 11).Value = equipments.price_3;
ws.Cell(row, 12).Value = equipments.price_4;
ws.Cell(row, 13).Value = equipments.price_5;
ws.Cell(row, 14).Value = null;
ws.Cell(row, 15).Value = null;
ws.Cell(row, 16).Value = null;
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontName =
"TH Sarabun New";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Font.FontSize = 12;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Style.Fill.BackgroundColor = XLColor.OrangeColorWheel;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 8), ws.Cell(row, 14)).Style.NumberFormat.SetFormat("#,#");
row++;
}
if (equipments.color == 2)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = equipments.list;
@@ -547,7 +608,7 @@ namespace rmutr_report.Controllers
foreach (var equipments1 in equipments.data)
{
if (equipments1.color == 2)
if (equipments1.color == 3)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = equipments1.faculty_name;
@@ -611,7 +672,7 @@ namespace rmutr_report.Controllers
foreach (var equipments2 in equipments1.data)
{
if (equipments2.color == 3)
if (equipments2.color == 4)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = equipments2.list;
@@ -1132,7 +1193,77 @@ namespace rmutr_report.Controllers
ws.Range("H4:S4").Style.Fill.BackgroundColor = XLColor.Gainsboro;
foreach (var buildings in summary_building_constructions.header_data)
{
if (buildings.color == 1)
if (buildings.color == 1)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = buildings.list;
ws.Cell(row, 3).Value = null;
ws.Cell(row, 4).Value = null;
ws.Cell(row, 5).Value = null;
ws.Cell(row, 6).Value = null;
ws.Cell(row, 7).Value = null;
ws.Cell(row, 8).Value = null;
ws.Cell(row, 9).Value = null;
ws.Cell(row, 10).Value = null;
ws.Cell(row, 11).Value = buildings.budget;
ws.Cell(row, 12).Value = buildings.price_1;
ws.Cell(row, 13).Value = buildings.price_2;
ws.Cell(row, 14).Value = buildings.price_3;
ws.Cell(row, 15).Value = buildings.price_4;
ws.Cell(row, 16).Value = buildings.price_5;
ws.Cell(row, 17).Value = null;
ws.Cell(row, 18).Value = null;
ws.Cell(row, 19).Value = null;
ws.Cell(row, 1).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 3).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 4).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 5).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 6).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 7).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 8).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 9).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 10).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 11).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 12).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 13).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 14).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 15).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell(row, 16).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
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.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontName =
"TH Sarabun New";
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Font.FontSize = 11;
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;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Style.Fill.BackgroundColor =
XLColor.OrangeColorWheel;
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 12).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 13).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 14).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 15).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 16).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
ws.Cell(row, 17).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 18).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 19).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Range(ws.Cell(row, 11), ws.Cell(row, 16)).Style.NumberFormat.SetFormat("#,#");
row++;
}
if (buildings.color == 2)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = buildings.list;
@@ -1206,7 +1337,7 @@ namespace rmutr_report.Controllers
foreach (var buildings1 in buildings.data)
{
if (buildings1.color == 2)
if (buildings1.color == 3)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = buildings1.faculty_name;
@@ -1284,7 +1415,7 @@ namespace rmutr_report.Controllers
foreach (var buildings2 in buildings1.data)
{
if (buildings2.color == 3)
if (buildings2.color == 4)
{
ws.Cell(row, 1).Value = null;
ws.Cell(row, 2).Value = buildings2.list;

View File

@@ -190,6 +190,176 @@ namespace rmutr_report.Controllers
return Ok();
}
[HttpPost, Route("reports/project_principle_rationale_no_activity/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetProject2Report([FromRoute] string type, [FromBody] project_principle_rationale project)
{
var total = project.activity.Count;
//var total2 = project.sixteenth.Count;
foreach (var v in project.activity)
{
if (v.activity != null)
{
//var total = project.activity.Select(r => r.count).Sum(t => t.Value);
project.together_with = "ประกอบด้วยกิจกรรมหรือโครงการย่อย " + total +" โครงการดังนี้คือ";
}
else
{
project.together_with = null;
}
}
foreach (var v in project.eighth)
{
string na = "ประเด็นยุทธศาสตร์ที่ " ;
v.strategic_issues = na + v.strategic_issues;
string na2 = "กลยุทธ์ที่ " ;
v.measure = na2 + v.measure;
}
foreach (var v in project.fourteenth)
{
string na = "องค์ประกอบที่ " ;
v.component = na + v.component;
string na2 = "ตัวบ่งชี้ที่ " ;
v.indicator = na2 + v.indicator;
}
// project.count_activity = total2;
foreach (var v in project.eighteenth)
{
foreach (var vv in v.eighteenths)
{
string na = "ครั้งที่ ";
vv.the_time = na + vv.the_time;
string na2 = " จำนวน ";
vv.count_day = na2 + vv.count_day + " วัน";
if (project.count_day != null)
{
project.text3 = "จำนวน " + project.count_day + " วัน";
}
}
}
if (project.total_target != null)
{
project.text1 = "ผลรวมกลุ่มเป้าหมาย " + project.total_target;
}
if (project.total_board != null)
{
project.text2 = "ผลรวมคณะกรรมการ " + project.total_board;
}
if (project.twenty_one != null)
{
// foreach (var vv in project.twenty_one)
// {
// if (vv.activity != null || vv.activity!= "")
// {
// vv.activity = vv.activity;
// }
// if (vv.clause1 != null || vv.clause1!= "")
// {
// vv.clause1 = vv.clause1;
// }
// if (vv.clause2 != null || vv.clause2!= "")
// {
// vv.clause2 = vv.clause2;
// }
// if (vv.clause3 != null || vv.clause3!= "")
// {
// vv.clause3 = vv.clause3;
// }
// if (vv.clause4 != null || vv.clause4!= "")
// {
// vv.clause4 = vv.clause4;
// }
// if (vv.count_unit != null || vv.count_unit != "")
// {
// string na = "ผู้เข้าร่วมโครงการ จำนวน ";
// string na2 = " หน่วยนับ";
// project.text1 = na + vv.count_unit + na2;
// }
//
// if (vv.count_project != null || vv.count_project != "")
// {
// string na = "จำนวนครั้งที่ดำเนินโครงการ ";
// string na2 = " ครั้ง";
// project.text2 = na + vv.count_project + na2;
// }
//
// if (vv.count_training != null || vv.count_training != "")
// {
// string na = "จำนวนการจัดอบรมและสัมมนา ";
// string na2 = " เรื่อง";
// project.text3 = na + vv.count_training + na2;
// }
//
// if (vv.count_knowledge != null || vv.count_knowledge != "")
// {
// string na = "จำนวนเผยแพร่ความรู้บริการวิชาการ ";
// string na2 = " ครั้ง";
// project.text4 = na + vv.count_knowledge + na2;
// }
// string na3 = "วัน/เดือน/ปี ที่จะดำเนินโครงการ ";
// string na4 = " ถึง ";
// project.text5 = na3 + vv.project_start_date + na4 + vv.project_end_date;
// string na5 = "โครงการแล้วเสร็จตามเวลาที่กำหนด (ร้อยละ) ";
// project.text6 = na5 + vv.percentage_finish;
//
// }
if (project.twenty_one == null)
{
project.twenty_one = null;
}
}
var _project = new List<project_principle_rationale>() {project};
Report report = new Report();
report.Load(_setting.report_path + "project_principle_rationale_no_activity.frx");
report.RegisterData(_project, "project_principle_rationale");
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;
case "doc": case "docx":
Word2007Export word = new Word2007Export();
report.Export(word, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "appllication/vnd.ms-word");
break;
}
return Ok();
}
}
}