Combine แบบประเมิน
This commit is contained in:
@@ -107,8 +107,44 @@ namespace TodoAPI2.Controllers
|
|||||||
{
|
{
|
||||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||||
|
|
||||||
var p1 = GetParameter(Convert.ToInt16(model.detail_id));
|
var stream = new MemoryStream();
|
||||||
|
Document document = new Document();
|
||||||
|
PdfCopy writer = new PdfCopy(document, stream);
|
||||||
|
document.Open();
|
||||||
|
|
||||||
|
foreach (var k in model.detail_id)
|
||||||
|
{
|
||||||
|
var data = GetReport(k, model);
|
||||||
|
|
||||||
|
PdfReader reader = new PdfReader(data);
|
||||||
|
reader.ConsolidateNamedDestinations();
|
||||||
|
|
||||||
|
for (int i = 1; i <= reader.NumberOfPages; i++)
|
||||||
|
{
|
||||||
|
PdfImportedPage page = writer.GetImportedPage(reader, i);
|
||||||
|
writer.AddPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Close();
|
||||||
|
document.Close();
|
||||||
|
|
||||||
|
var data2 = stream.ToArray();
|
||||||
|
var stream2 = new MemoryStream(data2);
|
||||||
|
|
||||||
|
return File(stream2, model.contentType);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogCritical($"Exception while GetReport.", ex);
|
||||||
|
return StatusCode(500, $"{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] GetReport(int detail_id, rep_eva_xReportRequestModel model)
|
||||||
|
{
|
||||||
var httpclient = new WebClient();
|
var httpclient = new WebClient();
|
||||||
|
|
||||||
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
|
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
|
||||||
@@ -116,12 +152,7 @@ namespace TodoAPI2.Controllers
|
|||||||
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
|
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
|
||||||
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
|
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
|
||||||
|
|
||||||
//string url = $"{mainurl}{reportsite}/rep_eva_x1.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
|
var p1 = GetParameter(detail_id);
|
||||||
|
|
||||||
//var data = httpclient.DownloadData(url);
|
|
||||||
//var stream = new MemoryStream(data);
|
|
||||||
|
|
||||||
//return File(stream, model.contentType);
|
|
||||||
|
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
Document document = new Document();
|
Document document = new Document();
|
||||||
@@ -152,15 +183,7 @@ namespace TodoAPI2.Controllers
|
|||||||
document.Close();
|
document.Close();
|
||||||
|
|
||||||
var data2 = stream.ToArray();
|
var data2 = stream.ToArray();
|
||||||
var stream2 = new MemoryStream(data2);
|
return data2;
|
||||||
|
|
||||||
return File(stream2, model.contentType);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogCritical($"Exception while GetReport.", ex);
|
|
||||||
return StatusCode(500, $"{ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private rep_eva_xInputModel2 GetParameter(int detail_id)
|
private rep_eva_xInputModel2 GetParameter(int detail_id)
|
||||||
@@ -176,10 +199,10 @@ namespace TodoAPI2.Controllers
|
|||||||
i.employee_position_level = p.employee_position_level;
|
i.employee_position_level = p.employee_position_level;
|
||||||
i.employee_org = p.employee_org;
|
i.employee_org = p.employee_org;
|
||||||
i.employee_position = p.employee_position;
|
i.employee_position = p.employee_position;
|
||||||
if (!string.IsNullOrEmpty(p.employee_profile_picture))
|
//if (!string.IsNullOrEmpty(p.employee_profile_picture))
|
||||||
{
|
//{
|
||||||
i.image_url = MyHelper.GetConfig(Configuration, "SiteInformation:mainsite") + "/api/image/" + p.employee_profile_picture;
|
// i.image_url = MyHelper.GetConfig(Configuration, "SiteInformation:mainsite") + "/api/image/" + p.employee_profile_picture;
|
||||||
}
|
//}
|
||||||
i.chief_fullname = p.chief_fullname;
|
i.chief_fullname = p.chief_fullname;
|
||||||
i.chief_position = p.chief_position;
|
i.chief_position = p.chief_position;
|
||||||
i.supervisor2_fullname = p.supervisor2_fullname;
|
i.supervisor2_fullname = p.supervisor2_fullname;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace TodoAPI2.Models
|
|||||||
|
|
||||||
public Guid id { get; set; }
|
public Guid id { get; set; }
|
||||||
|
|
||||||
public string detail_id { get; set; }
|
public List<int> detail_id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,9 +147,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<iframe id="report_result" style="display:none; height:500px; width:100%;"></iframe>
|
||||||
|
|
||||||
@section FooterPlaceHolder{
|
@section FooterPlaceHolder{
|
||||||
<script src="~/js/eva_create_evaluation/eva_create_evaluation_d.js?version=@MyHelper.GetDummyText()"></script>
|
<script src="~/js/eva_create_evaluation/eva_create_evaluation_d.js?version=@MyHelper.GetDummyText()"></script>
|
||||||
<script src="~/js/eva_create_evaluation_detail/eva_create_evaluation_detail_summary.js?version=@MyHelper.GetDummyText()"></script>
|
<script src="~/js/eva_create_evaluation_detail/eva_create_evaluation_detail_summary.js?version=@MyHelper.GetDummyText()"></script>
|
||||||
|
<script src="~/js/rep_eva_x/rep_eva_x_report.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var id = getUrlParameter("id");
|
var id = getUrlParameter("id");
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
"modulesite": "http://tb320.zd.co.th/menu/evaluation",
|
"modulesite": "http://tb320.zd.co.th/menu/evaluation",
|
||||||
"sitename": "เนติบัณฑิตยสภา ในพระบรมราชูปถัมภ์",
|
"sitename": "เนติบัณฑิตยสภา ในพระบรมราชูปถัมภ์",
|
||||||
"modulename": "ระบบประวัติเงินเดือนและการเลื่อนเงินเดือน",
|
"modulename": "ระบบประวัติเงินเดือนและการเลื่อนเงินเดือน",
|
||||||
"hr_upload_api": "https://hrm.thethaibar.or.th/api/file/upload"
|
"hr_upload_api": "https://hrm.thethaibar.or.th/api/file/upload",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,10 @@ function eva_create_evaluation_detail_GetSelect(f) {
|
|||||||
$.each(eva_create_evaluation_detailTableV.rows('.selected').data(), function (key, value) {
|
$.each(eva_create_evaluation_detailTableV.rows('.selected').data(), function (key, value) {
|
||||||
eva_create_evaluation_detail_selectitem.push(value[f]);
|
eva_create_evaluation_detail_selectitem.push(value[f]);
|
||||||
});
|
});
|
||||||
alert(eva_create_evaluation_detail_selectitem);
|
//alert(eva_create_evaluation_detail_selectitem);
|
||||||
|
|
||||||
|
rep_eva_x_DoSearch("pdf", eva_create_evaluation_detail_selectitem)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function eva_create_evaluation_detail_SelectAll(){
|
function eva_create_evaluation_detail_SelectAll(){
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
//================= Search Customizaiton =========================================
|
//================= Search Customizaiton =========================================
|
||||||
|
|
||||||
function rep_eva_x_GetSearchParameter(fileType) {
|
function rep_eva_x_GetSearchParameter(fileType, data) {
|
||||||
var rep_eva_xSearchObject = new Object();
|
var rep_eva_xSearchObject = new Object();
|
||||||
rep_eva_xSearchObject.detail_id = $("#s_rep_eva_x_detail_id").val();
|
rep_eva_xSearchObject.detail_id = data;
|
||||||
|
|
||||||
|
|
||||||
rep_eva_xSearchObject.fileType = fileType;
|
rep_eva_xSearchObject.fileType = fileType;
|
||||||
@@ -37,12 +37,10 @@ var s_rep_eva_x_customValidation = function (group) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function rep_eva_x_DoSearch(fileType) {
|
function rep_eva_x_DoSearch(fileType, data) {
|
||||||
if (!ValidateForm('s_rep_eva_x', s_rep_eva_x_customValidation)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var p = $.param(rep_eva_x_GetSearchParameter(fileType));
|
var p = $.param(rep_eva_x_GetSearchParameter(fileType, data)).replaceAll("%5B%5D", '');
|
||||||
|
console.log(p);
|
||||||
|
|
||||||
var report_url = apisite + "/api/rep_eva_x/rep_eva_x_report?" + p;
|
var report_url = apisite + "/api/rep_eva_x/rep_eva_x_report?" + p;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user