Combine แบบประเมิน
This commit is contained in:
@@ -107,34 +107,14 @@ namespace TodoAPI2.Controllers
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
|
||||
var p1 = GetParameter(Convert.ToInt16(model.detail_id));
|
||||
|
||||
var httpclient = new WebClient();
|
||||
|
||||
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
|
||||
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
|
||||
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
|
||||
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 data = httpclient.DownloadData(url);
|
||||
//var stream = new MemoryStream(data);
|
||||
|
||||
//return File(stream, model.contentType);
|
||||
|
||||
var stream = new MemoryStream();
|
||||
Document document = new Document();
|
||||
PdfCopy writer = new PdfCopy(document, stream);
|
||||
document.Open();
|
||||
|
||||
var rep_type = new int[] { 1, 2, 3, 4, 5};
|
||||
|
||||
foreach (var k in rep_type)
|
||||
foreach (var k in model.detail_id)
|
||||
{
|
||||
string url = $"{mainurl}{reportsite}/rep_eva_x{k}.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
|
||||
|
||||
var data = httpclient.DownloadData(url);
|
||||
var data = GetReport(k, model);
|
||||
|
||||
PdfReader reader = new PdfReader(data);
|
||||
reader.ConsolidateNamedDestinations();
|
||||
@@ -163,6 +143,49 @@ namespace TodoAPI2.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] GetReport(int detail_id, rep_eva_xReportRequestModel model)
|
||||
{
|
||||
var httpclient = new WebClient();
|
||||
|
||||
string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
|
||||
string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
|
||||
string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
|
||||
string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
|
||||
|
||||
var p1 = GetParameter(detail_id);
|
||||
|
||||
var stream = new MemoryStream();
|
||||
Document document = new Document();
|
||||
PdfCopy writer = new PdfCopy(document, stream);
|
||||
document.Open();
|
||||
|
||||
var rep_type = new int[] { 1, 2, 3, 4, 5 };
|
||||
|
||||
foreach (var k in rep_type)
|
||||
{
|
||||
string url = $"{mainurl}{reportsite}/rep_eva_x{k}.{model.filetype}?{MyHelper.GetParameterForJasperReport(p1)}&j_username={username}&j_password={password}";
|
||||
|
||||
var data = httpclient.DownloadData(url);
|
||||
|
||||
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();
|
||||
return data2;
|
||||
}
|
||||
|
||||
private rep_eva_xInputModel2 GetParameter(int detail_id)
|
||||
{
|
||||
var i = new rep_eva_xInputModel2();
|
||||
@@ -176,10 +199,10 @@ namespace TodoAPI2.Controllers
|
||||
i.employee_position_level = p.employee_position_level;
|
||||
i.employee_org = p.employee_org;
|
||||
i.employee_position = p.employee_position;
|
||||
if (!string.IsNullOrEmpty(p.employee_profile_picture))
|
||||
{
|
||||
i.image_url = MyHelper.GetConfig(Configuration, "SiteInformation:mainsite") + "/api/image/" + 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.chief_fullname = p.chief_fullname;
|
||||
i.chief_position = p.chief_position;
|
||||
i.supervisor2_fullname = p.supervisor2_fullname;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace TodoAPI2.Models
|
||||
|
||||
public Guid id { get; set; }
|
||||
|
||||
public string detail_id { get; set; }
|
||||
public List<int> detail_id { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<th><label>ผู้รับการประเมิน</label></th>
|
||||
<th><label>ตำแหน่ง</label></th>
|
||||
<th><label>ระดับ</label></th>
|
||||
<th><label>สถานะทำแบบประเมิน<br/>(ผู้ประเมิน)</label></th>
|
||||
<th><label>สถานะทำแบบประเมิน<br />(ผู้ประเมิน)</label></th>
|
||||
<th><label>สถานะทำแบบประเมิน<br />(ผู้ประเมินสูงสุด)</label></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -147,9 +147,13 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<br />
|
||||
<iframe id="report_result" style="display:none; height:500px; width:100%;"></iframe>
|
||||
|
||||
@section FooterPlaceHolder{
|
||||
<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/rep_eva_x/rep_eva_x_report.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var id = getUrlParameter("id");
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"modulesite": "http://tb320.zd.co.th/menu/evaluation",
|
||||
"sitename": "เนติบัณฑิตยสภา ในพระบรมราชูปถัมภ์",
|
||||
"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) {
|
||||
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(){
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function rep_eva_x_GetSearchParameter(fileType) {
|
||||
function rep_eva_x_GetSearchParameter(fileType, data) {
|
||||
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;
|
||||
@@ -37,12 +37,10 @@ var s_rep_eva_x_customValidation = function (group) {
|
||||
};
|
||||
|
||||
|
||||
function rep_eva_x_DoSearch(fileType) {
|
||||
if (!ValidateForm('s_rep_eva_x', s_rep_eva_x_customValidation)) {
|
||||
return;
|
||||
}
|
||||
function rep_eva_x_DoSearch(fileType, data) {
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user