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

This commit is contained in:
kamonwan taengsuk
2023-11-16 17:56:47 +07:00
parent c5370d5128
commit af9a9c8af5
12 changed files with 452 additions and 353 deletions

View File

@@ -14,9 +14,9 @@ using Swashbuckle.AspNetCore.Annotations;
namespace rmutr_report.Controllers
{
[SwaggerTag("สำหรับรายงานคำขอโครงการ Thailand 4.0 (ง.5-2.2)")]
public class project_request_thailand: Controller
public class project_request_thailand : Controller
{
readonly Setting _setting;
readonly Setting _setting;
public project_request_thailand(Setting setting)
{
@@ -28,7 +28,6 @@ namespace rmutr_report.Controllers
public IActionResult GetRequestProjectReport([FromRoute] string type,
[FromBody] project_principle_rationale project)
{
// foreach (var v in project.five)
// {
// string na = "ประเด็นยุทธศาสตร์ที่ " ;
@@ -47,7 +46,7 @@ namespace rmutr_report.Controllers
// }
if (project != null)
{
// var total = project.activity.Count;
// var total = project.activity.Count;
// if (project.activity != null)
// {
// foreach (var v in project.activity)
@@ -64,7 +63,7 @@ namespace rmutr_report.Controllers
// }
// }
if (project.ninth!=null)
if (project.ninth != null)
{
foreach (var vv in project.ninth)
{
@@ -72,25 +71,32 @@ namespace rmutr_report.Controllers
{
vv.clause = "11.1 ตัวชี้วัดผลสัมฤทธิ์";
}
if (vv.clause == "9.2 ตัวชี้วัดเชิงนโยบาย")
{
vv.clause = "11.2 ตัวชี้วัดเชิงนโยบาย";
}
if (vv.ninths==null)
{
vv.ninths.Add(new ninth_data_detail()
{
detail = ""
});
}
if (vv.ninths.Any())
{
if (vv.ninths == null)
{
foreach (var detail6 in vv.ninths)
{
detail6.detail = null;
}
}
}
else
{
vv.ninths.Add(new ninth_data_detail()
{
detail = ""
});
}
}
}
if (project.sixteenths != null)
{
@@ -106,16 +112,19 @@ namespace rmutr_report.Controllers
sixteenthData.klai_kangwon_total = sum4;
}
}
if (project.seventeenth != null)
{
foreach (var v in project.seventeenth)
{
int t = 1;
string a = "กิจกรรมที่ ";
v.activity = a + v.activity;
foreach (var vv in v.seventeenths)
{
string na = "ครั้งที่ ";
vv.the_time = na + vv.the_time;
vv.the_time = na + t;
t++;
foreach (var detail in vv.seventeenths2)
{
string in1 = "พื้นที่ (ภายในมหาวิทยาลัย) ";
@@ -128,9 +137,10 @@ namespace rmutr_report.Controllers
detail.area_province1 = in1 + detail.area_province1;
detail.location1 = in2 + detail.location1;
}
if (detail.internal_external2 == "ภายนอกมหาวิทยาลัย")
{
detail.text2 = "ภายนอกมหาวิทยาลัย";
detail.text2 = "ภายนอกมหาวิทยาลัย";
detail.area_province2 = out1 + detail.area_province2;
detail.location2 = in2 + detail.location2;
}
@@ -138,6 +148,7 @@ namespace rmutr_report.Controllers
}
}
}
if (project.eighteenth != null)
{
foreach (var v in project.eighteenth)
@@ -179,7 +190,6 @@ namespace rmutr_report.Controllers
{
if (vv.count_quantitative != null)
{
string na = " หน่วยนับ";
vv.khrang1 = na;
}
@@ -253,47 +263,44 @@ namespace rmutr_report.Controllers
}
var _project = new List<project_principle_rationale>() { project };
Report report = new Report();
report.Load(_setting.report_path + "project_request_thailands.frx");
report.RegisterData(_project, "project_principle_rationale");
report.Prepare();
Report report = new Report();
report.Load(_setting.report_path + "project_request_thailands.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");
break;
case "xls":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/vnd.ms-excel");
break;
case "xlsx":
Excel2007Export excel1 = new Excel2007Export();
report.Export(excel1, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
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();
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");
break;
case "xls":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/vnd.ms-excel");
break;
case "xlsx":
Excel2007Export excel1 = new Excel2007Export();
report.Export(excel1, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
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();
}
}
}
}