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

This commit is contained in:
kamonwan taengsuk
2023-11-23 17:12:25 +07:00
parent 3a2f956d02
commit 5ba7919b29
16 changed files with 836 additions and 472 deletions

View File

@@ -67,8 +67,16 @@ namespace rmutr_report.Controllers
sixteenthData.bophitphimuk_total = sum2;
sixteenthData.pohchang_total = sum3;
sixteenthData.klai_kangwon_total = sum4;
sixteenthData.activity_table = a + sixteenthData.activity_table;
t++;
if (sixteenthData.activity_table != null)
{
sixteenthData.activity_table = a + sixteenthData.activity_table;
t++;
}
if (sixteenthData.activity_table == null)
{
sixteenthData.activity_table = null;
}
}
}
@@ -78,7 +86,17 @@ namespace rmutr_report.Controllers
{
int t = 1;
string a = "กิจกรรมที่ ";
v.activity = a + v.activity;
if (v.activity != null)
{
v.activity = a + v.activity;
t++;
}
if (v.activity == null)
{
v.activity = null;
}
foreach (var vv in v.seventeenths)
{
string na = "ครั้งที่ ";
@@ -112,6 +130,20 @@ namespace rmutr_report.Controllers
{
foreach (var v in project.eighteenth)
{
int t = 1;
string a = "กิจกรรมที่ ";
if (v.activity != null)
{
v.activity = a + v.activity;
t++;
}
if (v.activity == null)
{
v.activity = null;
}
foreach (var vv in v.eighteenths)
{
string na = "ครั้งที่ ";
@@ -126,16 +158,48 @@ namespace rmutr_report.Controllers
}
}
if (project.nineteenth != null)
{
foreach (var v in project.nineteenth)
{
foreach (var vv in v.nineteenth_data_header)
{
int t = 1;
string a = "กิจกรรมที่ ";
if (vv.activity != null)
{
vv.activity = a + vv.activity;
t++;
}
if (vv.activity == null)
{
vv.activity = null;
}
}
}
}
if (project.total_target != null)
{
project.text1 = "ผลรวมกลุ่มเป้าหมาย " + project.total_target;
}
if (project.total_target == null)
{
project.text1 = "ผลรวมกลุ่มเป้าหมาย -";
}
if (project.total_board != null)
{
project.text2 = "ผลรวมคณะกรรมการ " + project.total_board;
}
if (project.total_board == null)
{
project.text2 = "ผลรวมคณะกรรมการ -";
}
if (project.twenty_one != null)
{
foreach (var v in project.twenty_one)
@@ -262,10 +326,23 @@ namespace rmutr_report.Controllers
if (project.twenty_four != null)
{
int no = 1;
foreach (var tw in project.twenty_four)
foreach (var v in project.twenty_four)
{
foreach (var dataDetail in tw.twenty_fours)
int t = 1;
string aa = "กิจกรรมที่ ";
if (v.activity != null)
{
v.activity = aa + v.activity;
t++;
}
if (v.activity == null)
{
v.activity = null;
}
foreach (var dataDetail in v.twenty_fours)
{
string a = "ชื่อผู้รับผิดชอบ กิจกรรมที่ " + no;
no++;
@@ -371,266 +448,220 @@ 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;
if (project.activity != null)
{
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;
}
}
}
if (project.eighth != null)
{
foreach (var v in project.eighth)
{
string na = "ประเด็นยุทธศาสตร์ที่ ";
v.strategic_issues = na + v.strategic_issues;
string na2 = "กลยุทธ์ที่ ";
v.measure = na2 + v.measure;
}
}
if (project.fourteenth != null)
{
foreach (var vv in project.fourteenth)
{
// string na = "องค์ประกอบที่ " ;
// vv.component = na + vv.component;
string na2 = "ตัวบ่งชี้ที่ ";
vv.indicator = na2 + vv.indicator;
}
}
if (project.sixteenths != null)
{
foreach (var sixteenthData in project.sixteenths)
{
var sum1 = sixteenthData.sixteenths2.Sum(d => d.salaya);
var sum2 = sixteenthData.sixteenths2.Sum(d => d.bophitphimuk);
var sum3 = sixteenthData.sixteenths2.Sum(d => d.pohchang);
var sum4 = sixteenthData.sixteenths2.Sum(d => d.klai_kangwon);
sixteenthData.salaya_total = sum1;
sixteenthData.bophitphimuk_total = sum2;
sixteenthData.pohchang_total = sum3;
sixteenthData.klai_kangwon_total = sum4;
}
}
if (project.eighteenth != null)
{
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;
}
}
if (project.twenty_four != null)
{
int no = 1;
foreach (var tw in project.twenty_four)
{
foreach (var dataDetail in tw.twenty_fours)
{
string a = "ชื่อผู้รับผิดชอบ กิจกรรมที่ " + no;
no++;
if (dataDetail.responsible_person != null)
{
dataDetail.text1 = a + " " + dataDetail.responsible_person;
}
string b = "หน่วยงาน / คณะ ";
if (dataDetail.agency != null)
{
dataDetail.text2 = b + dataDetail.agency;
}
string c = "พื้นที่ ";
if (dataDetail.area != null)
{
dataDetail.text3 = c + dataDetail.area;
}
string d = "เบอร์โทรศัพท์ภายใน ";
if (dataDetail.telephone_number != null)
{
dataDetail.text4 = d + dataDetail.telephone_number;
}
string e = "เบอร์มือถือ ";
if (dataDetail.mobile_number != null)
{
dataDetail.text5 = e + dataDetail.mobile_number;
}
string f = "อีเมล ";
if (dataDetail.email != null)
{
dataDetail.text6 = f + dataDetail.email;
}
}
}
}
if (project.twenty_fifth != null)
{
foreach (var fifthData in project.twenty_fifth)
{
foreach (var acti in fifthData.activity)
{
fifthData.activitys = acti;
}
foreach (var locat in fifthData.location)
{
fifthData.locations = locat;
}
}
}
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();
}
// [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;
// if (project.activity != null)
// {
// 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;
// }
// }
// }
//
// if (project.eighth != null)
// {
// foreach (var v in project.eighth)
// {
// string na = "ประเด็นยุทธศาสตร์ที่ ";
// v.strategic_issues = na + v.strategic_issues;
// string na2 = "กลยุทธ์ที่ ";
// v.measure = na2 + v.measure;
// }
// }
//
// if (project.fourteenth != null)
// {
// foreach (var vv in project.fourteenth)
// {
// // string na = "องค์ประกอบที่ " ;
// // vv.component = na + vv.component;
// string na2 = "ตัวบ่งชี้ที่ ";
// vv.indicator = na2 + vv.indicator;
// }
// }
//
// if (project.sixteenths != null)
// {
// foreach (var sixteenthData in project.sixteenths)
// {
// var sum1 = sixteenthData.sixteenths2.Sum(d => d.salaya);
// var sum2 = sixteenthData.sixteenths2.Sum(d => d.bophitphimuk);
// var sum3 = sixteenthData.sixteenths2.Sum(d => d.pohchang);
// var sum4 = sixteenthData.sixteenths2.Sum(d => d.klai_kangwon);
// sixteenthData.salaya_total = sum1;
// sixteenthData.bophitphimuk_total = sum2;
// sixteenthData.pohchang_total = sum3;
// sixteenthData.klai_kangwon_total = sum4;
// }
// }
//
// if (project.eighteenth != null)
// {
// 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;
// }
// }
//
//
// if (project.twenty_fifth != null)
// {
// foreach (var fifthData in project.twenty_fifth)
// {
// foreach (var acti in fifthData.activity)
// {
// fifthData.activitys = acti;
// }
//
// foreach (var locat in fifthData.location)
// {
// fifthData.locations = locat;
// }
// }
// }
//
// 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();
// }
}
}