Files
KON-KIWI/viewpage_quota.asp
2026-08-07 12:52:33 +09:00

1406 lines
59 KiB
Plaintext

<!--#include file="./include/Header.asp" -->
<%
IF request("type") = "GUEST" then
ELSE
Call Login()
END IF
Dim Code : Code = request("code")
Dim viewType : viewType = request("viewType")
%>
<style>
.col_row_sel{
outline:none;
box-shadow:none;
-webkit-box-shadow:none;
}
#menubutton{
display:none;
}
</style>
<body>
<div class="container-fluid h-100" style="text-align: center;">
<div class="row sticky-top p-3 bg-dark shadow-sm">
<div class="col-xl-12 align-self-center text-left text-white text-bold ">
<strong><%=CODE%></strong>
<span class="p-2 m-1 rounded" id="menubutton">
<i class="fa fa-bars" aria-hidden="true"></i>
</span>
</div>
</div>
<div class="row h-100">
<div class="col-xl-12">
<div class="container-fluid" id="mframe">
<div class="row">
<div class="col-xl-12" id="mtop">
</div>
</div>
<div class="row" id="mcontent">
</div>
</div>
</div>
</div>
<div class="row fixed-bottom p-3 bg-dark shadow-sm">
<div class="col-xl-12 align-self-center">
</div>
</div>
</div>
<div id="Progress_Loading">
<img src="./img/96x96.gif" style="position:absolute;top:calc(50% - (96px / 2));left:calc(50% - (96px / 2));z-index:100;"/>
</div>
<div id="fixedContent"></div>
<div id="content"></div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel" style="color:#343a40;">저장 위치를 선택하세요.</h4>
</div>
<div class="modal-body">
<select class="form-control" id="sel_quotaView">
<option value="1">View 1</option>
<option value="2">View 2</option>
<option value="3">View 3</option>
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="fnVarSave();">Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" >Close</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade bd-example-modal-xl" id="guideModal" tabindex="-1" role="dialog" aria-labelledby="myExtraLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<img src="./img/quotaview_guide.png" style="width:100%;">
</div>
</div>
</div>
</body>
<link type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic&display=swap" rel="stylesheet">
<!--<link rel="stylesheet" href="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.css" />
<script src="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.js"></script>-->
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="./module/toExcel.js"></script>
<script src="./module/ToastrCustom.js?ver=1"></script>
<script type="text/javascript">
// k1 엑셀 테이블 선언.
var k1 = kon.exceltable;
k1.makeContext("k1", "C");
var Code = "<%=Code%>"
$(function(){
$('#Progress_Loading').hide();
var fixedContent = document.getElementById("fixedContent")
var content = document.getElementById("content");
$(content).css("width","1600px")
var tab_li_1 = createnode("li", [ createnode("a","Create View", { "class" : "active" , "id" : "li_1" }) ], {"style" : "padding:0;" , "href" : "#/qbox"});
var tab_li_2 = createnode("li", [ createnode("a","View 1", { "id" : "li_2", "style" : "cursor:pointer;" }) ], {"style" : "padding:0;" , "href" : "#/first" , "data-toggle" : "tooltip", "data-placement" : "left"});
var tab_li_3 = createnode("li", [ createnode("a","View 2", { "id" : "li_3", "style" : "cursor:pointer;" }) ], {"style" : "padding:0;" , "href" : "#/second", "data-toggle" : "tooltip", "data-placement" : "left"});
var tab_li_4 = createnode("li", [ createnode("a","View 3", { "id" : "li_4", "style" : "cursor:pointer;" }) ], {"style" : "padding:0;" , "href" : "#/third" , "data-toggle" : "tooltip", "data-placement" : "left"});
var tab_ul = createnode("ul", [tab_li_1, tab_li_2, tab_li_3, tab_li_4] , {"class" : "tabMenu" , "style" : "width:100%;margin:0 auto;margin-top:10px;"}, "");
content.appendChild(tab_ul);
var viewData = $.map(make_view_info(), function(o){
return { "QID" : o.QIDX , "COL_1" : strReplace(o.COL_1), "COL_2" : strReplace(o.COL_2), "COL_3" : strReplace(o.COL_3), "ROW_1" : strReplace(o.ROW_1) }
})
var viewArr = []
for(var i = 0 ; i < 3 ; i ++){
viewArr[i] = document.getElementById("li_" + ( i + 2 ) )
}
viewArr.forEach(function(v, i){
$.each($.grep(viewData, function(obj, idx){ return obj.QID == (i + 1) }), function(idx, obj){
v.innerText = "View " + (idx + 1) + " (설정완료)"
for(var j = 0 ; j < 3 ; j ++){
if( j == 0 ) obj.COL_1 != "" ? viewLabel = "Column : [ " + obj.COL_1 + " ] / Row : [ " + obj.ROW_1 + " ]" : viewLabel = ""
if( j == 1 ) obj.COL_2 != "" ? viewLabel = "Column : [ " + obj.COL_2 + " ] / Row : [ " + obj.ROW_1 + " ]" : viewLabel = ""
if( j == 2 ) obj.COL_3 != "" ? viewLabel = "Column : [ " + obj.COL_3 + " ] / Row : [ " + obj.ROW_1 + " ]" : viewLabel = ""
if( viewLabel.charAt(viewLabel.length-1) === "," ) viewLabel = viewLabel.slice(-1)
v.title += viewLabel + "\n"
}
})
})
$('[data-toggle="tooltip"]').tooltip()
var select_qid_div = createnode("DIV", "", {"class" : "", "id" : "select_qid_div", "style" : "width:100%;display:inline-block;float:left;padding:10px;"})
var show_qid_div = createnode("DIV", "", {"class" : "", "id" : "show_qid_div", "style" : "width:100%;height:900px;display:inline-block;padding:10px;overflow-y:scroll;" } )
var qbox = createnode("DIV", [select_qid_div], { "id" : "qbox", "style" : "width:100%;height:900px;padding:10px;border:1px solid #dadada;overflow:hidden;" });
var first = createnode("DIV", "" , { "class" : "table-container table-responsive", "id" : "first", "style" : "width:100%;height:900px;padding:10px;overflow:auto;border:1px solid #dadada;display:none;" });
var second = createnode("DIV", "" , { "class" : "table-container table-responsive", "id" : "second", "style" : "width:100%;height:900px;padding:10px;overflow:auto;border:1px solid #dadada;display:none;" });
var third = createnode("DIV", "" , { "class" : "table-container table-responsive", "id" : "third", "style" : "width:100%;height:900px;padding:10px;overflow:auto;border:1px solid #dadada;display:none;" });
var guideTopLine = createnode("DIV", "Variable Drag & Drop" , { "style" : "background-color:#343a40;border-bottom:1px solid #aaa;border-radius:3px 3px 0 0;height:45px;text-align:center;color:#ffffff;line-height:40px;" } );
var guideFrame = createnode("DIV", [guideTopLine, show_qid_div] , { "id" : "" , "class" : "ui-widget-content", "style" : "width:200px;position:fixed;top:100px;right:50px;border-radius:5px;z-index:5;border:1px solid rgb(218, 218, 218);overflow:hidden;" })
fixedContent.appendChild(guideFrame)
appendChild_m( content , [qbox, first, second, third] );
make_btn_QID();
$(".col_row_sel").on("click", function(){
if( $("input[name=col_row_sel]:checked").val() == "col" ){
$("#radio_col").parent("label").addClass("active");
$("#radio_row").parent("label").removeClass("active");
}else{
$("#radio_row").parent("label").addClass("active");
$("#radio_col").parent("label").removeClass("active");
}
});
var tabs = $(".tabMenu li a");
tabs.click(function() {
var content = this.hash.replace('/','');
var viewType = "<%=viewType%>";
tabs.removeClass("active");
$(this).addClass("active");
switch ($(this).attr("id")) {
case "li_1":
$("#content").children('div').hide();
$("#qbox").show();
break;
case "li_2":
$("#content").children('div').hide();
$("#first").show();
$('#Progress_Loading').show(function(){
showQuotaTable(1,"first");
});
break;
case "li_3":
$("#content").children('div').hide();
$("#second").show();
$('#Progress_Loading').show(function(){
showQuotaTable(2,"second");
});
break;
case "li_4":
$("#content").children('div').hide();
$("#third").show();
$('#Progress_Loading').show(function(){
showQuotaTable(3,"third");
});
break;
}
});
$(".guideSize").on("click", function(e){
if(e.target.id == "btnMinimum"){
$("#draggable").animate({ height : "45px" }, 500)
$("#btnMaximum").css("display", "");
}else{
$("#draggable").animate({ height : "900px" }, 500)
$("#btnMinimum").css("display", "");
}
e.target.style.display = "none";
});
$(document).on("mouseenter", ".data-table", function(e){
k1.setTable(document.getElementById($(e.target).closest('table').attr("id")))
});
if("<%=request("type")%>" == "GUEST"){
$("#fixedContent").remove()
$("#content").attr("class" , "m-0 m-auto p-0").attr("style" , "width:90%;")
$(".tabMenu").find("li:first").remove()
$("#select_qid_div").remove()
$(".tabMenu").find("li a").attr("style" , "width:33%;")
$(".tabMenu").find("li:last a").attr("style" , "width:34%;")
}
/*
viewType 파라미터로 추가할시, 자동 뷰 보여줌.
2021-02-19 추가
*/
if("<%=viewType%>" != ""){
switch("<%=viewType%>"){
case "1":
$("#li_2").click();
$('#Progress_Loading').show(function(){
showQuotaTable(1,"first");
});
break;
case "2":
$("#li_3").click();
$('#Progress_Loading').show(function(){
showQuotaTable(2,"second");
});
break;
case "3":
$("#li_4").click();
$('#Progress_Loading').show(function(){
showQuotaTable(3,"third");
});
break;
}
}
});
function strReplace(str){
str = str.replace(/\[/gi, "");
str = str.replace(/\]/gi, "");
str = str.replace(/\˝/gi, "");
return str
}
/* 쿼터뷰에 이용할 단수문항 생성 */
function make_btn_QID(){
var param = {
"COMMAND" : "SELECT_VARIABLE",
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(json) {
typeof(json) === "string" ? json = JSON.parse(json) : json = json
fnMakeDiv(json);
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
}
function make_view_info(){
var data = []
var param = {
"COMMAND" : "SELECT_VIEW_VARIABLE",
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(json) {
typeof(json) === "string" ? json = JSON.parse(json) : json = json
data = json
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
return data;
}
function make_PREVIEW_JSON(qid, flag){
var data = []
var param = {
"COMMAND" : "PREVIEW_JSON",
"qid" : qid,
"pkey" : Code,
"flag" : flag
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(json) {
data = json
$.each(data, function(i, o){
typeof(o.json) === "string" ? o.json = JSON.parse(o.json) : o.json = o.json
});
},
error: function(xhr, option, error) {
console.log(xhr.responseText);
}
});
return data;
}
function make_TABLE_SQL(jsonData){
var data = [];
sql = "";
$.each(jsonData, function(i, o){
data = o.json
sql = sql + " ( "
$.each(data, function(idx, obj){
sql = sql + "select ";
sql = sql + " '" + obj.value + "' as " + String.fromCharCode(65 + parseInt(i)) + " union all ";
});
sql = sql.substr(0, sql.length - 10); //union all 문자열 제외
sql = sql + " ) " + String.fromCharCode(65 + parseInt(i)) + String.fromCharCode(65 + parseInt(i));
if(i != 0) sql = sql + " on 1 = 1 ";
sql = sql + " left join ";
});
sql = sql.substr(0, sql.length - 10); //left join 문자열 제외
return sql;
}
function make_TABLE_DATA(jsonData, columnList, rowList){
var tableData = [];
$.each(jsonData, function(i, o){
if(o.flag == "col"){
$.each(o.json, function(idx, obj){
$.each(columnList , function(index, object){
if(o.QID == object){
//console.log(i, o.QID, obj.label, obj.value, "col", index)
tableData.push({ "idx" : i, "QID" : o.QID ,"label" : obj.label, "value" : obj.value, "gubun" : "col", "length" : index, "variable" : o.variable });
}
})
});
}else{
$.each(o.json, function(idx, obj){
$.each(rowList , function(index, object){
if(o.QID == object){
//console.log(i, o.QID, obj.label, obj.value, "col", index)
tableData.push({ "idx" : i, "QID" : o.QID ,"label" : obj.label, "value" : obj.value, "gubun" : "row", "length" : index, "variable" : o.variable });
}
});
});
}
});
return tableData;
}
function make_PREVIEW_DATA(tableData, sql, qid, groupVariable, qIndex){
var jsonData = [];
var param = {
"COMMAND" : "PREVIEW_DATA",
"sql" : sql,
"qid" : qid,
"groupVariable" : groupVariable,
"qIndex" : qIndex,
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
//datatype: "text",
async: false,
success: function(json) {
jsonData = json;
//console.log(json)
},
error: function(xhr, option, error) {
console.log(xhr.responseText);
}
});
return jsonData;
}
function make_SUCCESS_CNT(){
var cnt
var param = {
"COMMAND" : "SUCCESS_CNT",
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(response) {
cnt = response
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
return cnt;
}
function make_RESULT_QUOTA(){
var cnt
var param = {
"COMMAND" : "RESULT_QUOTA",
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(response) {
cnt = response;
console.log(cnt)
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
return cnt;
}
function drag(ev) {
$(".quota-list").css("border", "2px dashed #17a2b8")
.css("background-image", "url(/img/plus.png)")
.css("background-repeat","no-repeat")
.css("background-position", "center")
.css("background-color", "#f6f6f6")
ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
$(".quota-list").css("border", "1px solid #ced4da")
.css("background-image", "none")
.css("background-color", "#fff")
var idx = 0;
var overIdx = 0;
var data = ev.dataTransfer.getData("text");
var e = document.getElementById(data)
var attr = {};
attr["title"] = e.getAttribute("title")
attr["tabindex"] = e.getAttribute("tabindex")
attr["data-placement"] = e.getAttribute("data-placement")
attr["data-value"] = e.getAttribute("data-value")
attr["ondragend"] = e.getAttribute("ondragend")
attr["class"] = "btn btn-light";
attr["onclick"] = "fnVarDel(this)";
if(ev.target.id != "sel_row_0"){
attr["style"] = "width:100px;height:65px;margin:5px;background-color:#fff;border:1px solid #ddd;outline:none;color:#343a40;";
}else{
attr["style"] = "width:120px;height:65px;margin:5px;background-color:#fff;border:1px solid #ddd;outline:none;color:#343a40;";
}
var newNode = createnode(e.tagName, e.innerText, attr)
ev.target.childNodes.forEach(function(o, i){
if( o.dataset["value"] == newNode.dataset["value"] ) idx = idx + 1;
})
if(ev.target.childNodes.length >= 3){
tAlert("최대 3문항까지 설정가능합니다.")
return false;
}
if(ev.target.id == "sel_row_0"){
for(var j = 0 ; j < 3 ; j ++){
document.getElementById("sel_col_" + j).childNodes.forEach(function(v, i){
if(newNode.dataset["value"] == v.dataset["value"]) overIdx = overIdx + 1;
})
}
}else{
document.getElementById("sel_row_0").childNodes.forEach(function(v, i){
if(newNode.dataset["value"] == v.dataset["value"]) overIdx = overIdx + 1;
})
}
if(idx == 0 && overIdx == 0) ev.target.appendChild(newNode)
else if(idx > 0) tAlert("이미 선택된 문항입니다.")
else if(overIdx > 0) tAlert("행과 열에 같은 변수를 설정할 수 없습니다.")
}
function notdrag(ev){
$(".quota-list").css("border", "1px solid #ced4da")
.css("background-image", "none")
.css("background-color", "#fff")
}
function allowDrop(ev) {
ev.preventDefault();
}
/* 쿼터뷰 레이아웃 구성 */
function fnMakeDiv(json){
var show_qid_div = document.getElementById("show_qid_div");
var select_qid_div = document.getElementById("select_qid_div");
var hr = createnode("hr" , "" , {"style" : "border-top:1px solid #dadada"});
$.each(json, function(i, o){
show_qid_div.appendChild(createnode("SPAN" , "" , {"id" : "qidNum_" + i , "style" : "display:none;" } ))
document.getElementById("qidNum_" + i).innerHTML = o.title
show_qid_div.appendChild(
createnode("P" , [{"element" : "BUTTON", "text" : o.QID + " [" + o.variable + "]", "attr" : {
"class" : "btn btn-outline-info",
"id" : "qidBtn_" + i,
"style" : "width:80%;height:60px;margin-right:5px;",
"title" : document.getElementById("qidNum_" + i).innerText,
"tabindex" : "0",
"data-toggle" : "tooltip",
"data-placement" : "left",
"data-value" : o.QID,
"draggable" : "true" ,
"ondragstart" : "drag(event)",
"ondragend" : "notdrag(event)"
} , "thisText" : "" }], {"style" : "text-align:center;"} )
);
});
var btSelFormat = createnode("BUTTON" , "Reset" , { "class" : "btn btn-danger", "onclick" : "fnSelFormat()", "style" : "width:77px;margin:3px auto;margin-right:6px;display:inline-block;"});
var btSelSave = createnode("BUTTON" , "Save" , { "class" : "btn btn-success", "onclick" : "" , "data-toggle" : "modal" , "data-target" : "#myModal", "style" : "width:77px;margin:3px auto;display:inline-block;"});
var btSelGuide = createnode("BUTTON" , "Guide" , { "class" : "btn btn-warning", "onclick" : "" , "data-toggle" : "modal" , "data-target" : "#guideModal", "style" : "width:77px;margin:3px auto;margin-right:6px;display:inline-block;"});
var btSelEnd = createnode("BUTTON" , "Preview" , { "class" : "btn btn-success", "onclick" : "fnSelPreview()", "style" : "width:77px;margin:3px auto;display:inline-block;"});
divSelEnd = createnode("DIV" , [btSelFormat, btSelSave, btSelGuide, btSelEnd] , { "class" : "" , "style" : "width:160px;height:80px;margin:5px;text-align:center;float:left;" });
select_qid_div.appendChild(divSelEnd);
var variable_list = [];
variable_list[0] = createnode("div", "" , { "class" : "form-control quota-list", "id" : "sel_col_0", "ondrop" : "drop(event)", "ondragover" : "allowDrop(event)", "style" : "width:370px;height:100px;margin:5px;display:inline-block;float:left;line-height:45px;"}, "");
variable_list[1] = createnode("div", "" , { "class" : "form-control quota-list", "id" : "sel_col_1", "ondrop" : "drop(event)", "ondragover" : "allowDrop(event)", "style" : "width:370px;height:100px;margin:5px;display:inline-block;float:left;line-height:45px;"}, "");
variable_list[2] = createnode("div", "" , { "class" : "form-control quota-list", "id" : "sel_col_2", "ondrop" : "drop(event)", "ondragover" : "allowDrop(event)", "style" : "width:370px;height:100px;margin:5px;display:inline-block;float:left;line-height:45px;"}, "");
variable_list[3] = createnode("div", "" , { "class" : "form-control quota-list", "id" : "sel_row_0", "ondrop" : "drop(event)", "ondragover" : "allowDrop(event)", "style" : "width:160px;height:650px;margin:5px;display:inline-block;float:left;line-height:45px;"}, "");
var variable_label = [];
variable_label[0] = createnode("div", "Column" , { "class" : "form-control btn-secondary", "title" : "우측 영역에 열 변수를 설정하세요." , "style" : "cursor:help;width:75px;height:100px;margin:5px;display:inline-block;float:left;line-height:70px;"}, "");
variable_label[1] = createnode("div", "Row" , { "class" : "form-control btn-secondary", "title" : "하단 영역에 행 변수를 설정하세요." , "style" : "cursor:help;width:160px;height:40px;margin:5px;margin-top:10px;display:inline-block;float:left;text-align:center;"}, "");
var resultList = make_RESULT_QUOTA()
var resultLabel = [];
resultLabel[0] = createnode("p", "ONGOING : " + resultList[0].CNT , {"class" : "h-25 p-0 m-0 ml-5" , "style" : "font-weight:bold;"})
resultLabel[1] = createnode("p", "COMPLETE : " + resultList[1].CNT , {"class" : "h-25 p-0 m-0 ml-5" , "style" : "font-weight:bold;"})
resultLabel[2] = createnode("p", "QUOTA : " + resultList[2].CNT , {"class" : "h-25 p-0 m-0 ml-5" , "style" : "font-weight:bold;"})
resultLabel[3] = createnode("p", "SCREEN : " + resultList[3].CNT , {"class" : "h-25 p-0 m-0 ml-5" , "style" : "font-weight:bold;"})
var variable_div = [];
variable_div[0] = createnode("div", [variable_label[0], variable_list[0], variable_list[1],variable_list[2], resultLabel[0], resultLabel[1], resultLabel[2], resultLabel[3] ] , {"style" : "width:1350px;height:100px;display:inline-block;float:left;line-height:30px;"} )
variable_div[1] = createnode("div", [variable_label[1], variable_list[3] ] , {"style" : "width:160px;height:750px;display:inline-block;float:left;line-height:45px;"} )
appendChild_m(select_qid_div, variable_div);
}
/* 선택 문항 클릭 삭제 */
function fnVarDel(e){
$(e).remove();
}
/* 선택 문항 전체 삭제 */
function fnSelFormat(){
$(".quota-list").children("button").remove()
var data_table = document.getElementById("quotaTableDiv");
$(data_table).remove()
$("#first")[0].innerHTML = ""
$("#second")[0].innerHTML = ""
$("#third")[0].innerHTML = ""
}
// 함수 정의
function fnSelPreview(){
$("#quotaTableDiv").remove()
$('#Progress_Loading').show(function(){
fnSelEnd();
});
}
function fnVarSave(){
var qidx
var sel_quotaView = $("#sel_quotaView option:selected").val();
var variable_c_1 = document.getElementById("sel_col_0")
var variable_c_2 = document.getElementById("sel_col_1")
var variable_c_3 = document.getElementById("sel_col_2")
var variable_r_1 = document.getElementById("sel_row_0")
var Array_c_1 = []
var Array_c_2 = []
var Array_c_3 = []
var Array_r_1 = []
$(variable_c_1).children("button").each( function(i, o){ Array_c_1.push(o.dataset["value"]); });
$(variable_c_2).children("button").each( function(i, o){ Array_c_2.push(o.dataset["value"]); });
$(variable_c_3).children("button").each( function(i, o){ Array_c_3.push(o.dataset["value"]); });
$(variable_r_1).children("button").each( function(i, o){ Array_r_1.push(o.dataset["value"]); });
if (Array_c_1.length == 0 && Array_c_2.length == 0 && Array_c_3.length == 0 && Array_r_1.length == 0 ) {
$("#myModal button[data-dismiss=modal]").click()
tAlert("설정 된 문항이 없습니다.", "error")
return false;
};
QID = "{\"COL_1\":[";
$(Array_c_1).each(function(i, o){
if(i!=0) QID = QID + ","
QID = QID + "\"" + o + "\"";
});
QID = QID + "],\"COL_2\":[";
$(Array_c_2).each(function(i, o){
if(i!=0) QID = QID + ","
QID = QID + "\"" + o + "\"";
});
QID = QID + "],\"COL_3\":[";
$(Array_c_3).each(function(i, o){
if(i!=0) QID = QID + ","
QID = QID + "\"" + o + "\"";
});
QID = QID + "],\"ROW_1\":[";
$(Array_r_1).each(function(i, o){
if(i!=0) QID = QID + ","
QID = QID + "\"" + o + "\"";
});
QID = QID + "]}";
var param = { "COMMAND" : "INSERT_QUOTATABLE",
"QID" : QID,
"pkey" : Code,
"QIDX" : sel_quotaView
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(response) {
tAlert(response, "info");
$("#myModal button[data-dismiss=modal]").click()
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
}
// 미리보기
function fnSelEnd(){
var data_table = document.getElementById("quotaTableDiv");
$(data_table).remove()
$("#first")[0].innerHTML = ""
$("#second")[0].innerHTML = ""
$("#third")[0].innerHTML = ""
// 열변수 3그룹 , 행변수 1그룹 까지만 가능
var variable_c_1 = document.getElementById("sel_col_0")
var variable_c_2 = document.getElementById("sel_col_1")
var variable_c_3 = document.getElementById("sel_col_2")
var variable_r_1 = document.getElementById("sel_row_0")
var Array_c_1 = []
var Array_c_2 = []
var Array_c_3 = []
var Array_r_1 = []
$(variable_c_1).children("button").each( function(i, o){ Array_c_1.push(o.dataset["value"]); });
$(variable_c_2).children("button").each( function(i, o){ Array_c_2.push(o.dataset["value"]); });
$(variable_c_3).children("button").each( function(i, o){ Array_c_3.push(o.dataset["value"]); });
$(variable_r_1).children("button").each( function(i, o){ Array_r_1.push(o.dataset["value"]); });
if (Array_c_1.length == 0 && Array_c_2.length == 0 && Array_c_3.length == 0 && Array_r_1.length == 0 ) {
tAlert("설정 된 문항이 없습니다.", "error")
$('#Progress_Loading').hide();
return false;
};
var columnList = []
var rowList = []
columnList.push(Array_c_1)
columnList.push(Array_c_2)
columnList.push(Array_c_3)
rowList.push(Array_r_1)
var tableDiv = createnode("DIV", "" , {"class" : "table-responsive" , "id" : "quotaTableDiv", "style" : "width:86%;height:700px;float:right;margin:15px;overflow:auto;padding:20px;"});
var select_qid_div = document.getElementById("select_qid_div");
select_qid_div.appendChild(tableDiv);
var qid
var colQid
var rowQid
var forIdx
var tableIdx = 0
$.each(columnList , function(i, p){
if(columnList[i].length > 0){
qid = ""
colQid = ""
rowQid = ""
columnList[i].forEach(function(o, i){
qid = qid + o + ",";
colQid = colQid + o + ",";
});
rowList[0].forEach(function(o, i){
qid = qid + o + ",";
rowQid = rowQid + o + ",";
});
colQid = colQid.substring(0, colQid.length - 1);
rowQid = rowQid.substring(0, rowQid.length - 1);
qid = qid.substring(0, qid.length - 1);
var colJsonData = []
var rowJsonData = []
if(colQid.length > 0) colJsonData = make_PREVIEW_JSON(colQid, "col")
if(rowQid.length > 0) rowJsonData = make_PREVIEW_JSON(rowQid, "row")
var jsonData = colJsonData.concat(rowJsonData)
var tableData = make_TABLE_DATA(jsonData, columnList[i], rowList[0])
/* 중요 : 아래 데이터로 쿼터테이블 만들기 */
var colIdx = "" //열변수 순서 order by
var rowIdx = "" //행변수 순서 order by
var qIndex = ""
var qidLength = 0
columnList[i].forEach(function(o, i){
colIdx = colIdx + qidLength + ","
qidLength = qidLength + 1
});
rowList[0].forEach(function(o, i){
rowIdx = rowIdx + qidLength + ","
qidLength = qidLength + 1
});
qIndex = rowIdx + colIdx
qIndex = qIndex.substring(0, qIndex.length - 1)
/* 기존 소스
var tableSQL = make_TABLE_SQL(jsonData)
var previewData = make_PREVIEW_DATA(tableData, tableSQL, qid, qIndex);
fnNewDrawTable(previewData, tableData, i);
*/
var rtVal = fnNewDrawTable(jsonData, tableData, colQid, rowQid, qIndex, tableIdx, "quotaTableDiv");
tableIdx = rtVal + 1
}
});
$('#Progress_Loading').hide();
}
// function fnNewDrawTable(jsonDataX, tableData, tableIndex){ 기존 매개변수
function fnNewDrawTable(jsonData, tableData, colQid, rowQid, qIndex, tableIndex, divId){
var rowVarCount = rowQid.split(',')
var newJsonData
var newTableSQL = ""
var groupVariable = ""
var returnValue
rowVarCount.forEach(function(v, i){
newJsonData = []
jsonData.forEach(function(o, j){
if(o.flag == "row"){
if(v == o.QID) newJsonData.push({"QID" : o.QID , "flag" : o.flag , "json" : o.json, "variable" : o.variable})
}else{
newJsonData.push({"QID" : o.QID , "flag" : o.flag , "json" : o.json, "variable" : o.variable})
}
})
//console.log(newJsonData)
newJsonData.forEach(function(o, j){
groupVariable = groupVariable + o.QID + ","
})
groupVariable = groupVariable.substring(0, groupVariable.length - 1);
groupVariable = groupVariable + "|"
newTableSQL = newTableSQL + make_TABLE_SQL(newJsonData) + "|"
})
groupVariable = groupVariable.substring(0, groupVariable.length - 1);
newTableSQL = newTableSQL.substring(0, newTableSQL.length - 1);
var qid = colQid + "," + rowQid
if(qid.substring(qid.length - 1, qid.length) == ",") qid = qid.substring(0, qid.length - 1);
var qidLength = 0
var colIdx = ""
var rowIdx = ""
var qIndex = ""
colQid.split(",").forEach(function(v, i){
colIdx = colIdx + qidLength + ","
qidLength = qidLength + 1
})
if(rowQid.length != 0) rowIdx = qidLength + ","
qIndex = rowIdx + colIdx
qIndex = qIndex.substring(0, qIndex.length - 1)
/*
tableData 변수의 보기와 VALUE 구분값
qid 선택한 변수 목록 예시) Q1, Q2, Q3
groupVariable
newTableSQL make_PREVIEW_DATA group By 에 필요한 SQL문
qIndex order By 예시 ) 2, 0, 1 *행변수가 뒤에오므로 순서가 뒤바뀐다
*/
var previewData = make_PREVIEW_DATA(tableData, newTableSQL, qid, groupVariable, qIndex);
var jsonDataX
var forIdx // 행 변수 개수
var tableDataGroupBy = groupBySum( $.grep(tableData, function(o, i){ return o.gubun == "row"; }), ["QID"])
tableDataGroupBy.length > 0 ? forIdx = tableDataGroupBy.length : forIdx = 1
for(var idx = 0 ; idx < forIdx ; idx ++ ){
jsonDataX = $.grep(previewData, function(o, i){ return o.id == (idx + 1); }) // 실제 DATA
tableData
var table = createnode("table", "", { "class": "table shadow-sm table-bordered data-table text-center", "name" : "data-table", "id" : "data-table-" + (tableIndex + idx) }); //, "style": "min-width:1080px;margin:auto;word-break:break-all;font-size:12px;margin-bottom:20px;white-space:nowrap;"
var tableDiv = document.getElementById(divId)
tableDiv.appendChild(table)
var dataTable = document.getElementById("data-table-" + (tableIndex + idx));
var vColCnt = uniq($.grep(tableData, function(o, i){ return o.gubun == "col"}) , ["idx"]).length; //열 변수 카운트
var vRowCnt = uniq($.grep(tableData, function(o, i){ return o.gubun == "row"}) , ["idx"]).length; //행 변수 카운트
var colArr = [];
var rowArr = [];
var tr
var variableData = $.unique($.map(tableData,function(o){ return o.variable}))
var caption
caption = "Column Variable : [ "
$.each(groupBySum($.grep(tableData, function(o , id ){ return o.gubun == "col"; }), ["QID"]), function(id, o){
id == 0 ? caption = caption + o.QID : caption = caption + "," + o.QID
})
caption = caption + " ]"
caption = caption + " / Row Variable : [ "
$.each(groupBySum($.grep(tableData, function(o , id ){ return o.gubun == "row" && o.length == idx; }), ["QID"]), function(id, o){
id == 0 ? caption = caption + o.QID : caption = caption + "," + o.QID
})
caption = caption + " ]"
dataTable.appendChild(createnode("caption" , caption, {"class" : "table" ,"style" : "caption-side:top;text-align:left;font-size:15px;font-weight:bold;background-color:#455e89;border:1px solid #455e89;margin-bottom:0;color:#ffffff;padding-left:15px;"} ))
$.each(groupBySum($.grep(tableData, function(o, i){ return o.gubun == "col"; }), ["QID"]), function(i, o){ colArr.push(o.groupByCount); }) //열 변수 보기 개수 배열
$.each(groupBySum($.grep(tableData, function(o, i){ return o.gubun == "row"; }), ["QID"]), function(i, o){ rowArr.push(o.groupByCount); }) //행 변수 보기 개수 배열
var colCount
var rowCount
colArr.length > 0 ? colCount = colArr.reduce(function(acc, cur, i){ return acc * cur; }, 1) : colCount = 0
rowArr.length > 0 ? rowCount = rowArr.reduce(function(acc, cur, i){ return acc + cur; }) : rowCount = 0
var HeaderColSpan
var colMulti = 1;
for(var i = 0 ; i < vColCnt ; i ++){ // 쿼터표 헤더
tr = createnode("TR", "")
if( i == 0 && (vRowCnt != 0 && vColCnt != 0 )) tr.appendChild(createnode("TH" , " 구분" , {"rowspan" : vColCnt})); //구분
HeaderColSpan = colArr.reduce(function(acc, cur, step){ //해당 열 변수의 ColSpan
step > i ? acc = acc * cur : acc = 1;
return acc;
}, 1);
if(i > 0){
colMulti = colMulti * colArr[i - 1]; //열 변수의 보기 개수당 다음 변수의 보기개수가 달라짐
for(var j = 0 ; j < colMulti ; j++){
$.each($.grep(tableData,function(object , index){ return object.gubun == "col" && object.idx == i ;}) , function(idx , obj){
tr.appendChild(createnode("TH" , obj.label , {"colspan" : HeaderColSpan }));
});
}
}else{
$.each($.grep(tableData,function(object , index){ return object.gubun == "col" && object.idx == i ;}) , function(idx , obj){
tr.appendChild(createnode("TH" , obj.label , {"colspan" : HeaderColSpan }));
});
}
if( i == 0 && vColCnt != 0 ) tr.appendChild(createnode("TH" , "합계" , {"class" : "table-active" , "rowspan" : vColCnt} )); //합계
dataTable.appendChild(tr);
}
var rowCell
var rowSpan
var tmpIdx = 0
rowCell = $.grep(tableData, function(obj, index){ return obj.gubun == "row" && obj.idx == parseInt(vColCnt + idx); });
if(rowCount == 0){
tr = createnode("TR", "")
for(var k = 0 ; k < colCount ; k ++ ){
tr.appendChild(createnode("TD" , jsonDataX[k].qcnt));
}
if(vColCnt != 0) tr.appendChild(createnode("TD", "", {"class" : "table-active"} ));
dataTable.appendChild(tr);
}else{
//for(var i = 0; i < rowCount ; i++){
for(var i = 0; i < Number(tableDataGroupBy[idx].groupByCount) ; i++){
tr = createnode("TR", "")
tr.appendChild(createnode("TH" , rowCell[i].label));
for(var k = i * colCount ; k < (i * colCount) + colCount ; k ++ ){
tr.appendChild(createnode("TD" , jsonDataX[k].qcnt));
}
if(vColCnt != 0) tr.appendChild(createnode("TD", "", {"class" : "table-active"} ));
dataTable.appendChild(tr);
}
}
if( vRowCnt != 0 ) tr = createnode("TR", "")
if( vRowCnt != 0 ) tr.appendChild(createnode("TH" , "합계" , {"class" : "table-active" } ));
if( vRowCnt != 0 && vColCnt != 0 ) for(var j = 0; j < colCount + 1; j ++ ) tr.appendChild(createnode("TD" , "", {"class" : "table-active"} )); //합계 셀 , colCount + 1 은 총 합계 셀
else if( vRowCnt != 0 && vColCnt == 0 ) for(var j = 0; j < colCount; j ++ ) tr.appendChild(createnode("TD" , "", {"class" : "table-active"} )); //합계 셀 , colCount + 1 은 총 합계 셀
dataTable.appendChild(tr);
var trList = $(dataTable).children("tr")
var trArr = [];
var sumVal = 0;
var posi = 0;
$.each(trList, function(idx, obj){
trArr = $(obj).find("TD")
sumVal = 0
$.each(trArr , function(i , o){
if( !isNaN(o.innerHTML) ) sumVal += Number(o.innerHTML)
posi = i
})
if(idx >= vColCnt) obj.lastChild.innerHTML = sumVal
})
for(var i = 0; i < trList[vColCnt].getElementsByTagName("td").length; i++ ){
sumVal = 0
for(var j = vColCnt; j < trList.length; j++){
if(!isNaN(trList[j].getElementsByTagName("td")[i].innerHTML)){
sumVal = sumVal + Number(trList[j].getElementsByTagName("td")[i].innerHTML);
}
posi = j
}
trList[posi].getElementsByTagName("td")[i].innerHTML = sumVal;
}
returnValue = (tableIndex + idx)
}
return returnValue
/*
-- 기존 크로스 쿼리 수정 X
console.log(tableData)
var vColCnt = uniq($.grep(tableData, function(o, i){ return o.gubun == "col"}) , ["idx"]).length; //열 변수 카운트
var vRowCnt = uniq($.grep(tableData, function(o, i){ return o.gubun == "row"}) , ["idx"]).length; //행 변수 카운트
var colArr = [];
var rowArr = [];
var tr
var variableData = $.unique($.map(tableData,function(o){ return o.QID}))
var caption = ""
$.each(variableData,function(i, o){
if(i == 0) caption = caption + o
else caption = caption + ", " + o
});
dataTable.appendChild(createnode("caption" , caption, {"class" : "table-info" ,"style" : "caption-side:top;text-align:center;font-size:13px;border:1px solid #dee2e6;border-bottom:none;"} ))
$.each(groupBySum($.grep(tableData, function(o, i){ return o.gubun == "col"; }), ["QID"]), function(i, o){ colArr.push(o.groupByCount); }) //열 변수 보기 개수 배열
$.each(groupBySum($.grep(tableData, function(o, i){ return o.gubun == "row"; }), ["QID"]), function(i, o){ rowArr.push(o.groupByCount); }) //행 변수 보기 개수 배열
var colCount = colArr.reduce((acc, cur, i) => { return acc * cur; }, 1);
var rowCount = rowArr.reduce((acc, cur, i) => { return acc * cur; }, 1);
var HeaderColSpan
var colMulti = 1;
for(var i = 0 ; i < vColCnt ; i ++){ // 쿼터표 헤더
tr = createnode("TR", "")
if( i == 0 && (vRowCnt != 0 && vColCnt != 0 ) ) tr.appendChild(createnode("TH" , " 구분" , {"class" : "" , "rowspan" : vColCnt , "colspan" : vRowCnt})); //구분
HeaderColSpan = colArr.reduce((acc, cur, step) => { //해당 열 변수의 ColSpan
if(step > i) acc = acc * cur;
else acc = 1;
return acc;
}, 1);
if(i > 0){
colMulti = colMulti * colArr[i - 1]; //열 변수의 보기 개수당 다음 변수의 보기개수가 달라짐
for(var j = 0 ; j < colMulti ; j++){
$.each( $.grep(tableData,function(object , index){ return object.gubun == "col" && object.idx == i ;}) , function(idx , obj){
tr.appendChild(createnode("TH" , obj.label , {"class" : "" , "colspan" : HeaderColSpan })); });
}
}else{
$.each( $.grep(tableData,function(object , index){ return object.gubun == "col" && object.idx == i ;}) , function(idx , obj){
tr.appendChild(createnode("TH" , obj.label , {"class" : "" , "colspan" : HeaderColSpan })); });
}
if( i == 0 && vColCnt != 0 ) tr.appendChild(createnode("TH" , "합계" , {"class" : "table-active" , "rowspan" : vColCnt} )); //합계
dataTable.appendChild(tr);
}
var rowCell
var rowSpan
var tmpIdx = 0
for(var i = 0; i < rowCount ; i++){
tr = createnode("TR", "")
for(var j = 0; j < vRowCnt; j++){
rowSpan = rowArr.reduce((acc, cur, step) => {
if(step > j) acc = acc * cur;
else acc = 1;
return acc
}, 1);
rowCell = $.grep(tableData, function(obj, idx){ return obj.gubun == "row" && obj.idx == (j + vColCnt); });
if( i % rowSpan == 0){ //라벨이 들어가는 열 일때
if (i == vRowCnt) tr.appendChild(createnode("TH" , rowCell[i % Object.keys(rowCell).length].label , {"class" : "" , "rowspan" : rowSpan} ));
else tr.appendChild(createnode("TH" , rowCell[(i / rowSpan) % Object.keys(rowCell).length].label , {"class" : "" , "rowspan" : rowSpan} ));
}
}
for(var k = i * colCount ; k < (i * colCount) + colCount ; k ++ ){
tr.appendChild(createnode("TD" , jsonDataX[k].qcnt)); //Row별 셀
}
if(vColCnt != 0) tr.appendChild(createnode("TD" , "", {"class" : "table-active"} )); //Row별 합계 셀
dataTable.appendChild(tr);
}
if( vRowCnt != 0 ) tr = createnode("TR", "")
if( vRowCnt != 0 ) tr.appendChild(createnode("TH" , "합계" , {"class" : "table-active" , "colspan" : vRowCnt} ));
if( vRowCnt != 0 && vColCnt != 0 ) for(var j = 0; j < colCount + 1; j ++ ) tr.appendChild(createnode("TD" , "", {"class" : "table-active"} )); //합계 셀 , colCount + 1 은 총 합계 셀
else if( vRowCnt != 0 && vColCnt == 0 ) for(var j = 0; j < colCount; j ++ ) tr.appendChild(createnode("TD" , "", {"class" : "table-active"} )); //합계 셀 , colCount + 1 은 총 합계 셀
dataTable.appendChild(tr);
var trList = $(dataTable).children("tr")
var trArr = [];
var sumVal = 0;
var posi = 0;
$.each(trList, function(idx, obj){
trArr = $(obj).find("TD")
sumVal = 0
$.each(trArr , function(i , o){
if( !isNaN(o.innerHTML) ) sumVal += Number(o.innerHTML)
posi = i
})
if(idx >= vColCnt) obj.lastChild.innerHTML = sumVal
})
for(var i = 0; i < trList[vColCnt].getElementsByTagName("td").length; i++ ){
sumVal = 0
for(var j = vColCnt; j < trList.length; j++){
if(!isNaN(trList[j].getElementsByTagName("td")[i].innerHTML)){
sumVal = sumVal + Number(trList[j].getElementsByTagName("td")[i].innerHTML);
}
posi = j
}
trList[posi].getElementsByTagName("td")[i].innerHTML = sumVal;
}
k1.setTable(document.getElementById("data-table-" + tableIndex))
*/
}
function selQuotaTable(qidx){
var jsonData = [];
var param = {
"COMMAND" : "SEL_QUOTATABLE",
"qidx" : qidx,
"pkey" : Code
};
$.ajax({
url: "./viewpage_ajax.asp",
data: param,
method: "POST",
datatype: "json",
async: false,
success: function(json) {
jsonData = json
},
error: function(xhr, option, error) {
console.log(xhr);
}
});
return jsonData
}
function showQuotaTable(qidx, tableId){
fnSelFormat()
var success_cnt = make_SUCCESS_CNT()
var jsonData = selQuotaTable(qidx)
if(jsonData.length == 0){
$('#Progress_Loading').hide();
tAlert("등록되지 않았습니다");
return false;
}
var success_value = createnode("P", [createnode("INPUT" , "" , {"class" : "form-control", "type" : "text" , "value" : success_cnt, "readonly" : "readonly", "style" : "display:inline-block;width:150px;margin-left:5px;" } )] , {} , "COMPLETE : ")
$("#"+ tableId).append(success_value)
var Array_c_1 = [];
var Array_c_2 = [];
var Array_c_3 = [];
var Array_r_1 = [];
$.each( $.grep(jsonData, function(o, i){ return o.gubun == "col" && o.TYPE == "1" }), function(i, o){ Array_c_1.push(o.value) });
$.each( $.grep(jsonData, function(o, i){ return o.gubun == "col" && o.TYPE == "2" }), function(i, o){ Array_c_2.push(o.value) });
$.each( $.grep(jsonData, function(o, i){ return o.gubun == "col" && o.TYPE == "3" }), function(i, o){ Array_c_3.push(o.value) });
$.each( $.grep(jsonData, function(o, i){ return o.gubun == "row" && o.TYPE == "1" }), function(i, o){ Array_r_1.push(o.value) });
var columnList = []
var rowList = []
columnList.push(Array_c_1)
columnList.push(Array_c_2)
columnList.push(Array_c_3)
rowList.push(Array_r_1)
var qid
var colQid
var rowQid
var forIdx
var tableIdx = 0
var jsonData = []
var tableData = []
$.each(columnList , function(i, p){
if(columnList[i].length > 0){
qid = ""
colQid = ""
rowQid = ""
columnList[i].forEach(function(o, i){
qid = qid + o + ",";
colQid = colQid + o + ",";
});
rowList[0].forEach(function(o, i){
qid = qid + o + ",";
rowQid = rowQid + o + ",";
});
colQid = colQid.substring(0, colQid.length - 1);
rowQid = rowQid.substring(0, rowQid.length - 1);
qid = qid.substring(0, qid.length - 1);
var colJsonData = []
var rowJsonData = []
if(colQid.length > 0) colJsonData = make_PREVIEW_JSON(colQid, "col")
if(rowQid.length > 0) rowJsonData = make_PREVIEW_JSON(rowQid, "row")
jsonData = colJsonData.concat(rowJsonData)
tableData = make_TABLE_DATA(jsonData, columnList[i], rowList[0])
/* 중요 : 아래 데이터로 쿼터테이블 만들기 */
var colIdx = "" //열변수 순서 order by
var rowIdx = "" //행변수 순서 order by
var qIndex = ""
var qidLength = 0
columnList[i].forEach(function(o, i){
colIdx = colIdx + qidLength + ","
qidLength = qidLength + 1
});
rowList[0].forEach(function(o, i){
rowIdx = rowIdx + qidLength + ","
qidLength = qidLength + 1
});
qIndex = rowIdx + colIdx
qIndex = qIndex.substring(0, qIndex.length - 1)
/* 기존 소스
var tableSQL = make_TABLE_SQL(jsonData)
var previewData = make_PREVIEW_DATA(tableData, tableSQL, qid, qIndex);
fnNewDrawTable(previewData, tableData, i);
*/
var rtVal = fnNewDrawTable(jsonData, tableData, colQid, rowQid, qIndex, tableIdx, tableId);
tableIdx = rtVal + 1
}
});
$('#Progress_Loading').hide();
}
function uniq(arr, item){
var retArr = [];
if(Array.isArray(item) == true){
retArr = $.unique($.map(arr, function(obj){
var tmpArr = [];
for(var i=0; i<item.length; i++){
tmpArr.push(obj[item[i]]);
}
return tmpArr.join("|");
}));
retArr = $.map(retArr, function(obj){
var tmpObj = {};
var tmpVal = obj.split("|");
for(var i=0; i<item.length; i++){
tmpObj[item[i]] = tmpVal[i];
}
return tmpObj;
});
return retArr;
}else{
retArr = $.unique($.map(arr, function(obj){ return obj[item]; }).sort());
}
return retArr;
}
function groupBySum(jsonArr, groupArr, sumArr_opt){
var sumArr = sumArr_opt || [];
var newJsonArr = uniq(jsonArr, groupArr);
$.each(newJsonArr, function(i, obj){
$.each(sumArr, function(idx, sumCol){
obj[sumCol] = 0;
});
obj["groupByCount"] = 0;
});
$.each(newJsonArr, function(idx, obj){
$.each($.grep(jsonArr, function(o, i){
var nStr = "";
var pStr = "";
$.each(groupArr, function(ix, groupCol){
nStr += obj[groupCol] + "|";
pStr += o[groupCol] + "|";
});
return nStr == pStr;
}), function(i, o){
$.each(sumArr, function(ix, sumCol){
obj[sumCol] += +o[sumCol];
});
obj["groupByCount"]++;
});
});
return newJsonArr;
}
</script>
<style>
#content{
width:1400px;
margin:0 0 0 30px;
}
.data-table {
font-family: 'NanumBarunGothic', sans-serif;
color:#646464;
margin-top:20px;
margin-bottom:20px;
font-size:11px;
}
.data-table th{
font-weight:600;
vertical-align:middle;
width:50px;
padding:1px !important;
}
.data-table td{
vertical-align:middle;
width:50px;
padding:1px !important;
}
.var-list{
background-color: #42484f;
color:white;
border:1px solid #42484f;
text-align:center;
}
.tabMenu {
width: 390px;
height: 80px;
margin: 0 auto;
list-style: none;
overflow: hidden;
padding: 0;
}
.tabMenu li{
padding:0;
}
.tabMenu li a {
background-color: #343a40;
text-align:center;
width:25%;
height:55px;
float:left;
position: relative;
display: block;
margin-top: 35px;
padding: 10px 0 0 0;
font-family: 'Open Sans', sans-serif;
font-size: 15px;
text-align: center;
text-decoration: none;
color: #ffffff;
-webkit-box-shadow: 8px 12px 25px 2px rgba(0,0,0,0.4);
-moz-box-shadow: 8px 12px 25px 2px rgba(0,0,0,0.4);
box-shadow: 8px 12px 25px 2px rgba(0,0,0,0.4);
border: 0px solid #000000;
-webkit-transition: padding 0.2s ease, margin 0.2s ease;
-moz-transition: padding 0.2s ease, margin 0.2s ease;
-o-transition: padding 0.2s ease, margin 0.2s ease;
-ms-transition: padding 0.2s ease, margin 0.2s ease;
transition: padding 0.2s ease, margin 0.2s ease;
}
.tabMenu li:first-child a {
z-index: 3;
-webkit-border-top-left-radius: 8px;
-moz-border-radius-topleft: 8px;
border-top-left-radius: 8px;
}
.tabMenu li:nth-child(2) a {
z-index: 2;
}
.tabMenu li:last-child a {
z-index: 1;
-webkit-box-shadow: 2px 8px 25px -2px rgba(0,0,0,0.3);
-moz-box-shadow: 2px 8px 25px -2px rgba(0,0,0,0.3);
box-shadow: 2px 8px 25px -2px rgba(0,0,0,0.3);
-webkit-border-top-right-radius: 8px;
-moz-border-radius-topright: 8px;
border-top-right-radius: 8px;
}
.tabMenu li a:hover {
margin: 30px 0 0 0;
padding: 10px 0 10px 0;
color:#ffffff;
}
.tabMenu li a.active {
margin: 25px 0 0 0;
padding: 10px 0 10px 0;
background: #0350a3;
color: #ffffff;
z-index: 4;
outline: none;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background-color: grey;
box-shadow: inset 0px 0px 5px white;
}
::-webkit-scrollbar-thumb {
background-color: #343a40;
border-radius: 5px;
background-clip: padding-box;
border: 1px solid transparent;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
width:16px;
height:16px;
border-radius: 2px;
background:#343a40;
}
.data-table{
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>
</html>