//숫자에 콤마 박기 function setNumberComma(val) { if(val == null || val.trim() == ""){ return val; } else { var temp = null; var strVal = val.replace(/\,/g, ""); var arrVal = strVal.split("."); temp = arrVal[0].split(""); temp = temp.reverse(); arrVal[0] = temp.join(""); arrVal[0] = arrVal[0].match(/([0-9]{3}|[0-9]{0,2})/g); arrVal[0] = arrVal[0].join(","); arrVal[0] = arrVal[0].replace(/,$/g, ""); temp = arrVal[0].split(""); temp = temp.reverse(); arrVal[0] = temp.join(""); if(arrVal.length > 1) { arrVal[0] = arrVal[0] + "." + arrVal[1]; } return arrVal[0]; } }; function prefixComma(val, prefix) { if(val != null && val.trim() != "" && prefix != "") { val = ", " + val; } return val; } function filterNumber(val, flag, prefix) { var temp = val; if(val != null) { if(flag == 1) { val = val.replace(/[^0-9]/g, ""); if(val.length >= 11) { temp = ""; temp += val.substr(0, 3) + "-"; temp += val.substr(3, 4) + "-"; temp += val.substr(7, 4); } else if(val.length == 10) { temp = ""; temp += val.substr(0, 3) + "-"; temp += val.substr(3, 3) + "-"; temp += val.substr(6, 4); } } else if(flag == 2) { if(temp != "" && temp.length <= 4) { temp = "031-888-" + temp + ""; } } temp = prefixComma(temp, prefix); } else { temp = ""; } return temp; } getRealOffsetLeft = function(o) { return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0; } getRealOffsetTop = function(o) { return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0; } function saveCookie(obj, cookieId, objName) { if(obj.checked == true) { $.cookie("dss_" + cookieId, $("input[name=" + objName + "]").val(), { expires : 365 }); } else { $.cookie("dss_" + cookieId, "", { expires : 365 }); } } function setCookie(name, value, expiredays) { $.cookie(name, value, expiredays); //JQuery } function getCommonOrgCode() { $.ajax({ "type" : "POST", "url" : "../../include/php/dataset/groupware/getOrglist.php", "data" : { "keyword" : $("input[name=org_key]:eq(1)").val() }, "success" : function(dataSet) { try { var dataSet = eval("(" + dataSet + ")"); var tObj = $("#tbodyOrglist2 tbody")[0]; $(tObj).empty(); for(var i = 0 ; i < dataSet.length ; i++) { var rObj = tObj.insertRow(-1); var cObj1 = rObj.insertCell(-1); var cObj2 = rObj.insertCell(-1); var cObj3 = rObj.insertCell(-1); if(i != dataSet.length - 1) { cObj1.style.borderBottom = "1px solid #EEE"; cObj2.style.borderBottom = "1px solid #EEE"; cObj3.style.borderBottom = "1px solid #EEE"; } cObj1.style.padding = "5px 12px"; cObj1.style.width = "10%"; cObj2.style.padding = "5px 7px"; cObj2.style.width = "80%"; cObj3.style.padding = "5px 0px 5px 0px"; cObj3.style.width = "10%"; cObj1.innerHTML = dataSet[i].code; cObj2.innerHTML = dataSet[i].org_name; cObj3.innerHTML = "선택"; $(rObj).on("mouseover", function() { $(this).css("background-color", "#EEE"); }); $(rObj).on("mouseout", function() { $(this).css("background-color", ""); }); } /* var html = ""; $("#sssss2").append(html); $('#sssss2').jstree(); //https://www.javascripting.com/view/jstree#populating-a-tree-using-html */ } catch(e) { alert(e.message); } }, "error" : function() { alert("err"); }, "dataType" : "text" //json, xml, html, text }); } function getCommonUserCode() { $.ajax({ "type" : "POST", "url" : "../../include/php/dataset/groupware/getUserlist.php", "data" : { "keyword" : $("input[name=user_key]:eq(1)").val() }, "success" : function(dataSet) { try { var dataSet = eval("(" + dataSet + ")"); var tObj = $("#tbodyUserlist2 tbody")[0]; $(tObj).empty(); for(var i = 0 ; i < dataSet.length ; i++) { var rObj = tObj.insertRow(-1); var cObj1 = rObj.insertCell(-1); var cObj2 = rObj.insertCell(-1); var cObj3 = rObj.insertCell(-1); var cObj4 = rObj.insertCell(-1); if(i != dataSet.length - 1) { cObj1.style.borderBottom = "1px solid #EEE"; cObj2.style.borderBottom = "1px solid #EEE"; cObj3.style.borderBottom = "1px solid #EEE"; cObj4.style.borderBottom = "1px solid #EEE"; } cObj1.style.padding = "5px 12px"; cObj1.style.display = "none"; cObj2.style.padding = "5px 7px"; cObj2.style.width = "10%"; cObj3.style.padding = "5px 7px"; cObj3.style.width = "80%"; cObj4.style.padding = "5px 0px 5px 0px"; cObj4.style.width = "10%"; cObj1.innerHTML = dataSet[i].usr_no; cObj2.innerHTML = dataSet[i].name; cObj3.innerHTML = dataSet[i].org_name; cObj4.innerHTML = "선택"; $(rObj).on("mouseover", function() { $(this).css("background-color", "#EEE"); }); $(rObj).on("mouseout", function() { $(this).css("background-color", ""); }); } } catch(e) { alert(e.message); } }, "error" : function() { alert("err"); }, "dataType" : "text" //json, xml, html, text }); } //전화 및 휴대폰 번호 중간 하이픈 기준 배열화 function getNullReplaceArry3(val) { if(val == "") { val = new Array("", "", ""); } else { val = val.split("-"); } return val; } function commonAlert(title, msg) { $.niftyNoty({ type: "warning", container: "floating", html: '

' + title + '

' + msg + '

', closeBtn: true, floating: { position: "center-center", animationIn: "jellyIn", animationOut: "fadeOutRight" }, focus: true, timer: 1000 * 3 //3초 뒤에 모달창 자동 닫힘 }); }