252 lines
12 KiB
Plaintext
252 lines
12 KiB
Plaintext
<!-- #include virtual = "lib/Config.asp" -->
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="euc-kr">
|
||
<meta name="viewport" content="width=1800">
|
||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
||
<link rel="stylesheet" href="/css/all.min.css">
|
||
<link rel="stylesheet" href="/css/AdminLTE.css">
|
||
<link rel="stylesheet" href="/css/koin.css">
|
||
<link rel="stylesheet" href="/css/jquery-ui.min.css">
|
||
<link rel="stylesheet" href="/css/jquery-confirm.min.css">
|
||
<link rel="stylesheet" href="/css/bootstrap-select.min.css"/>
|
||
<link rel="stylesheet" href="/css/Chart.min.css">
|
||
<link rel="stylesheet" href="/css/datatables.min.css"/>
|
||
<link rel="stylesheet" href="/css/treejs.min.css">
|
||
<link rel="stylesheet" href="/css/style.css">
|
||
<script src="/js/jquery.min.js"></script>
|
||
<script src="/js/jquery.pjax.min.js"></script>
|
||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||
<script src="/js/adminlte.min.js"></script>
|
||
<script src="/js/jquery-ui.min.js"></script>
|
||
<script src="/js/jquery.cookie.js"></script>
|
||
<script src="/js/jquery.dialogextend.js"></script>
|
||
<script src="/js/jquery-confirm.min.js"></script>
|
||
<script src="/js/jquery.form.min.js"></script>
|
||
<script src="/js/jquery-ajax-call.js"></script>
|
||
<script src="/js/jquery.table2excel.js?v=1"></script>
|
||
<script src="/js/bootstrap-select.min.js"></script>
|
||
<script src="/js/moment.js"></script>
|
||
<script src="/js/Chart.js"></script>
|
||
<script src="/js/datatables.min.js"></script>
|
||
<script src="/js/filterDropDown.js"></script>
|
||
<script src="/js/pagination.js"></script>
|
||
<script src="/js/FileSaver.min.js"></script>
|
||
<script src="/js/tree.min.js"></script>
|
||
<script src="/js/sort-table.js"></script>
|
||
<script src="/js/pdf.js"></script>
|
||
<script src="/js/pdf.worker.js"></script>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="content-wrapper" style="margin-left: 100px; margin-right: 100px; margin-top: 100px;">
|
||
<div class="content-header">
|
||
<h1>CATI Surveylink <20><><EFBFBD>߽<EFBFBD></h1>
|
||
</div>
|
||
|
||
<div class="content-body">
|
||
<div class="content">
|
||
<div class="container-fluid">
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<form name="xform" method="post" onsubmit="return handleFormSubmit();">
|
||
<table class="table table-sm table-bordered table-head tr-colors">
|
||
<tr>
|
||
<td colspan="5" align="center">
|
||
<span><3E≯<EFBFBD> : </span>
|
||
<input type="text" name="user_name" value="<%= Request.Form("user_name") %>" style="width:100px; margin-right:15px;">
|
||
<span><3E>ֹε<D6B9><CEB5>Ϲ<EFBFBD>ȣ : </span>
|
||
<input type="text" name="trans_number" value="<%= Request.Form("trans_number") %>" style="width:130px; margin-right:10px;" onchange="getNumber(this);" onkeyup="getNumber(this);">
|
||
<input type="submit" name="xbtn" value="<22>˻<EFBFBD>" style="width:200px; cursor:pointer;">
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th style="text-align:center;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE></th>
|
||
<th style="text-align:center;">Surveylink<br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD>ڵ<EFBFBD></th>
|
||
<th style="text-align:center;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></th>
|
||
<th style="text-align:center;"><3E><><EFBFBD>߽<EFBFBD></th>
|
||
<th style="text-align:center;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<br><3E><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD></th>
|
||
</tr>
|
||
|
||
<%
|
||
Dim userName, transNumber, condition, query
|
||
userName = Trim(Request.Form("user_name"))
|
||
transNumber = Trim(Request.Form("trans_number"))
|
||
|
||
condition = ""
|
||
|
||
If Len(userName) > 0 Then
|
||
condition = condition & " and m.m_name = '" & Replace(userName, "'", "''") & "'"
|
||
End If
|
||
|
||
If Len(transNumber) > 0 Then
|
||
condition = condition & " and m.m_jumin = '" & Replace(transNumber, "'", "''") & "'"
|
||
End If
|
||
|
||
If Len(userName) > 0 Or Len(transNumber) > 0 Then
|
||
' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: JOIN <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
query = " SELECT p.prj_code, p.prj_name " & _
|
||
" FROM new_cati.dbo.T_PRJ_USER tp with(nolock) " & _
|
||
" inner join project2.dbo.man m on tp.sel_user = m.id " & _
|
||
" left outer join new_cati.dbo.project p On tp.prj_code = p.prj_code " & _
|
||
" WHERE p.prj_end_chk='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' " & _
|
||
" AND tp.use_yn='Y' " & _
|
||
" AND m.m_activity = 'Ȱ<><C8B0>' " & _
|
||
condition
|
||
Else
|
||
' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: <20>ܼ<EFBFBD> project <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
query = " SELECT p.prj_code, p.prj_name " & _
|
||
" FROM new_cati.dbo.project p with(nolock) " & _
|
||
" WHERE p.prj_end_chk='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'"
|
||
End If
|
||
|
||
adoRs.Open query, adoconn, 1
|
||
|
||
Do While Not adoRs.EOF
|
||
%>
|
||
|
||
<tr>
|
||
<td class="text-left" style="width:1500px;">
|
||
<span><%=adoRs("prj_name")%></span>
|
||
</td>
|
||
<td class="text-center" style="width:200px;">
|
||
<input type="text" name="prjCd" style="width:180px; text-align:center; margin-top:5px;">
|
||
</td>
|
||
<td class="text-center result-cell" style="width:300px;">
|
||
<span class="result-text">-</span>
|
||
</td>
|
||
<td class="text-center" style="width:200px;">
|
||
<button type="button" class="btn btn-sm btn-warning" style="color: #000;" data-prj="<%=adoRs("prj_code")%>" onclick="surveylinkApiCall(this);"><3E><><EFBFBD>߽<EFBFBD> <20><><EFBFBD><EFBFBD></button>
|
||
</td>
|
||
<td class="text-center" style="width:250px;">
|
||
<button type="button" class="btn btn-sm" style="background-color:#28a745; color:#fff;" data-prj="<%=adoRs("prj_code")%>" onclick="surveylinkGetCallDataApiCall(this);">
|
||
<20><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
<%
|
||
adoRs.MoveNext
|
||
Loop
|
||
adoRs.Close
|
||
%>
|
||
</table>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
function getNumber(obj){
|
||
obj.value = obj.value.replace(/\D/g, "");
|
||
}
|
||
|
||
function surveylinkApiCall(btn) {
|
||
const $btn = $(btn);
|
||
const $row = $btn.closest('tr');
|
||
const prjCdFromInput = $row.find('input[name="prjCd"]').val().trim(); //SKT Surveylink<6E><6B><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||
const prjCode = $btn.data('prj'); //CATI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||
|
||
$.ajax({
|
||
url: "cati_surveylink_api_ajax.asp",
|
||
type: "POST",
|
||
data: {
|
||
prjCd: prjCdFromInput,
|
||
prjCode: prjCode,
|
||
apiType: "callData"
|
||
},
|
||
dataType: "json",
|
||
success: function(res) {
|
||
let message = res.message || '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>';
|
||
if (Number(res.code) === 104) {
|
||
message += ' (<28><><EFBFBD>߽<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ <20><><EFBFBD><EFBFBD>)';
|
||
}
|
||
$row.find('.result-text').text(message);
|
||
},
|
||
error: function(xhr, status, err) {
|
||
$row.find('.result-text').text("<22><><EFBFBD><EFBFBD> <20><EFBFBD>");
|
||
}
|
||
});
|
||
}
|
||
|
||
function prjSearch() {
|
||
const x = document.forms["xform"];
|
||
x.target = "";
|
||
x.action = "cati_surveylink_api.asp";
|
||
x.submit();
|
||
}
|
||
|
||
function handleFormSubmit() {
|
||
prjSearch();
|
||
return false;
|
||
}
|
||
|
||
function surveylinkGetCallDataApiCall(btn) {
|
||
const $btn = $(btn);
|
||
const $row = $btn.closest('tr');
|
||
const prjCdFromInput = $row.find('input[name="prjCd"]').val().trim(); //SKT Surveylink<6E><6B><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||
const prjCode = $btn.data('prj'); //CATI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>ڵ<EFBFBD>
|
||
|
||
$.ajax({
|
||
url: "cati_surveylink_api_ajax.asp",
|
||
type: "POST",
|
||
data: {
|
||
prjCd: prjCdFromInput,
|
||
prjCode: prjCode,
|
||
apiType: "getCallData"
|
||
},
|
||
dataType: "text",
|
||
success: function(res) {
|
||
let message = '';
|
||
|
||
try {
|
||
// JSON<4F><4E><EFBFBD><EFBFBD> <20>Ľ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>õ<EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||
const json = JSON.parse(res);
|
||
|
||
// JSON <20>Ľ<EFBFBD><C4BD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߰<EFBFBD> code<64><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ? <20><><EFBFBD><EFBFBD> ó<><C3B3>
|
||
if (json.code) {
|
||
message = `<60><><EFBFBD><EFBFBD> (${json.code}) : ${json.message}`;
|
||
$row.find('.result-text').text(message);
|
||
return; // CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
}
|
||
} catch (e) {
|
||
// JSON <20>Ľ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> CSV<53><56><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
// code<64><65> <20><><EFBFBD><EFBFBD> CSV <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٿ<EFBFBD><D9BF>ε<EFBFBD> ó<><C3B3>
|
||
if (typeof res === "string" && res.includes(",")) {
|
||
const fileName = `${prjCdFromInput}.csv`;
|
||
|
||
// CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD>
|
||
const blob = new Blob([res], { type: "text/csv;charset=utf-8;" });
|
||
const link = document.createElement("a");
|
||
link.href = URL.createObjectURL(blob);
|
||
link.download = fileName;
|
||
document.body.appendChild(link);
|
||
link.click();
|
||
document.body.removeChild(link);
|
||
|
||
message = `${fileName}<br><3E>ٿ<EFBFBD><D9BF>ε<EFBFBD> <20>Ϸ<EFBFBD>`;
|
||
$row.find('.result-text').html(message); // <br> <20>ٹٲ<D9B9> <20><><EFBFBD><EFBFBD>
|
||
} else {
|
||
message = 'CSV <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.';
|
||
$row.find('.result-text').text(message);
|
||
}
|
||
},
|
||
error: function(xhr, status, err) {
|
||
console.error("AJAX Error:", status, err);
|
||
console.error("Status Code:", xhr.status);
|
||
console.error("Response Text:", xhr.responseText);
|
||
|
||
$row.find('.result-text').text(`<60><><EFBFBD><EFBFBD> <20><EFBFBD> (<28>ڵ<EFBFBD>: ${xhr.responseText}, CSV <20>ٿ<EFBFBD><D9BF>ε<EFBFBD><CEB5><EFBFBD>)`);
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
</div>
|
||
</body>
|
||
<!-- #include virtual = "include/footer.asp" --> |