function FullGcoop() { this.ArrayDeEnter = new Array(); this.ArrayDeEnterCount = 0; this.ProgressUrl = ""; this.ProgressName = ""; this.ExtraFunction = null; this.DisplayProgressCloseButton = false; this.Application = ""; this.Url = ""; this.CurrentPage = ""; this.IsSheetWebDataInFolder = false; this.AddDisEnter = function (column) { this.ArrayDeEnter[this.ArrayDeEnterCount] = column; this.ArrayDeEnterCount++; } this.CheckDw = function (sender, row, column, columnName, checkValue, uncheckValue) { } this.Explode = function (bitVar, fullVar) { var v = new Array(); var sss; var a = 0; var i = 0; var ii = 0; var lengthIndex = bitVar.length; sss = fullVar.replace(/^\s+|\s+$/g, ''); // trim(); while (true) { if (ii > 0) { i = ii + (lengthIndex - 1); } ii = sss.indexOf(bitVar, ii); if (ii < 0) { v[a] = sss.substr(i); } else { v[a] = sss.substring(i, ii); } if (ii < 0) { ii = -1; } else { ii++; } if (ii < 0) { break; } a++; } return v; } this.EncodeUtf8 = function (s) { return unescape(encodeURIComponent(s)); } this.DecodeUtf8 = function (s) { return decodeURIComponent(escape(s)); } this.Focus = function (elName) { var realElementName = (elName == null || elName == undefined) ? this.GetLastFocus() : elName; document.forms["aspnetForm"].elements[realElementName].focus(); } this.GetApplication = function () { return this.Application; } this.GetBrowser = function () { if ("Netscape" != navigator.appName) { return navigator.appName.indexOf("Explorer") > 0 ? "Internet Explorer" : navigator.appName; } if (navigator.userAgent.indexOf("Chrome") > 0) { return "Chrome"; } else if (navigator.userAgent.indexOf("Safari") > 0) { return "Safari"; } else if (navigator.userAgent.indexOf("Firefox") > 0) { return "Firefox"; } else if (navigator.userAgent.indexOf("BrowserNG") > 0) { return "Nokia5800-BrowserNG"; } else { return navigator.appName; } } this.GetEl = function (id) { var webPageType = ""; try { webPageType = document.getElementById("webPageType").value; } catch (Err) { } if (webPageType == "w_dlg_xx_xxxxxx") { return document.getElementById(id); } else { try { var resultElement = document.getElementById("ctl00_ContentPlace_" + id); if (resultElement == null) { resultElement = document.getElementById(id); } if (resultElement == null) { return null; } return resultElement; } catch (err) { return null; } } } this.GetElForm = function (name) { return document.aspnetForm.elements[name]; } this.GetLastFocus = function () { return this.GetEl("tempLastFocus").value; } this.GetCurrentPage = function () { return this.CurrentPage; } this.GetObjectPosition = function (obj) { var position = $(obj).offset(); return [Math.round(position.top), Math.round(position.left)]; } this.GetUrl = function () { return this.Url; } this.IsCheckSupport = function () { return this.GetBrowser() == "Internet Explorer" || this.GetBrowser() == "Firefox"; } this.IsNum = function (number) { var num; try { number = number + ""; if (number.substring(0, 1) == "-") { num = number.substr(1); } else { num = number; } var ch = num; var len, digit; if (ch == " ") { return false; len = 0; } else { len = ch.length; } for (var i = 0; i < len; i++) { digit = ch.charAt(i) if (digit >= "0" && digit <= "9") { // } else { return false; } } return true; } catch (Err) { return false; } } this.IsValid = function (text) { try { if (text != "undefined" && text != null && text != "") { return true; } else { return false; } } catch (err) { return false; } } this.NumberFormat = function (text) { var nStr = text + ""; nStr = nStr.replace(/,/g, ''); var numWhile = 0; while (nStr.substr(0, 1) == "0" && nStr.length > 1) { nStr = nStr.substr(1); numWhile++; if (numWhile > 1000) break; } if (nStr == undefined || nStr == null || nStr == "") { return ""; } nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } // เปิด dialog ที่ Applications/appname/dlg/<> this.OpenDlg = function (width, height, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSaving + "Applications/" + winParameter + "/dlg/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog (WebData) ที่ Applications/appname/dlg/w_dlg_xxxx_ctrl/<> this.OpenDlg2 = function (width, height, pageName, queryString) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSaving + "Applications/" + winParameter + "/dlg/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog สำหรับ webdata ที่ Applications/appname/w_sheet_xxx_ctrl/w_dlg_xxx_ctrl/<> this.OpenDlg3 = function (width, height, pageName, queryString) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var sheet = currentPage.replace(".aspx", ""); var dlgUrlFull = urlSaving + "Applications/" + winParameter + "/" + sheet + "_ctrl/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog จาก dialog ที่ Applications/appname/w_sheet_xxx_ctrl/dlg/ this.OpenDlgIn = function (width, height, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSaving + "Applications/" + winParameter + "/dlg/" + pageName + queryString; console.log("opening applet : " + dlgUrlFull); window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog จาก dialog ที่ Applications/appname/w_sheet_xxx_ctrl/dlg/ this.OpenDlgInExtend = function (width, height, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSavingExtend + "Applications/" + winParameter + "/dlg/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog ที่ Applications/appname/dlg/<> this.OpenDlgExtend = function (width, height, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSavingExtend + "Applications/" + winParameter + "/dlg/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog (WebData) ที่ Applications/appname/dlg/w_dlg_xxxx_ctrl/<> this.OpenDlg2Extend = function (width, height, pageName, queryString) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var dlgUrlFull = urlSavingExtend + "Applications/" + winParameter + "/dlg/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog สำหรับ webdata ที่ Applications/appname/w_sheet_xxx_ctrl/w_dlg_xxx_ctrl/<> this.OpenDlg3Extend = function (width, height, pageName, queryString) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var sheet = currentPage.replace(".aspx", ""); var dlgUrlFull = urlSavingExtend + "Applications/" + winParameter + "/" + sheet + "_ctrl/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } // เปิด dialog สำหรับ webdata ที่ Applications/appname/w_sheet_xxx_ctrl/<> this.OpenDlg4Extend = function (width, height, pageName, queryString) { // pageName = pageName.replace(".aspx", ""); // pageName = pageName + "_ctrl/" + pageName + ".aspx"; var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; queryString = queryString == null ? "" : queryString; var sheet = currentPage.replace(".aspx", ""); var dlgUrlFull = urlSavingExtend + "Applications/" + winParameter + "/" + sheet + "_ctrl/" + pageName + queryString; window.open(dlgUrlFull, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } this.OpenDlgFixPath = function (width, height, appPath, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; var getUrl = this.GetUrl(); if (getUrl == null) { alert("PageLoad not ready complete"); } else { queryString = queryString == null ? "" : queryString; var dlgurl = urlSaving + "Applications/" + appPath + "/dlg/" + pageName + queryString; window.open(dlgurl, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } } this.OpenDlgFixPathExtend = function (width, height, appPath, pageName, queryString) { var left = (screen.width / 2) - (width / 2); var top = (screen.height / 2) - (height / 2); top = (top - 40) < 0 ? top : top - 40; var getUrl = this.GetUrl(); if (getUrl == null) { alert("PageLoad not ready complete"); } else { queryString = queryString == null ? "" : queryString; var dlgurl = urlSavingExtend + "Applications/" + appPath + "/dlg/" + pageName + queryString; window.open(dlgurl, null, "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",status=0,toolbar=0,menubar=0,location=0,resizable=0"); } } this.OpenGlobalIFrame = function (width, height, pageName, queryString) { var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; newUrl = urlSaving + "Applications/_global/" + pageName + queryString; var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } this.OpenGlobalIFrameExtend = function (width, height, pageName, queryString) { var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; newUrl = urlSavingExtend + "Applications/_global/" + pageName + queryString; var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame ที่ Applications/appname/dlg/<> this.OpenIFrame = function (width, height, pageName, queryString, extraUrl) { var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var ifInFolder = this.IsSheetWebDataInFolder ? "./." : ""; newUrl = urlSaving + "Applications/" + winParameter + "/dlg/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; console.log(newUrl); elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame ที่ Applications/appname/dlg/<> this.OpenIFrameExtend = function (width, height, pageName, queryString, extraUrl) { var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var ifInFolder = this.IsSheetWebDataInFolder ? "./." : ""; newUrl = urlSavingExtend + "Applications/" + winParameter + "/dlg/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; console.log(newUrl); elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame (WebData) ที่ Applications/appname/dlg/w_dlg_xxxx_ctrl/<> this.OpenIFrame2 = function (width, height, pageName, queryString, extraUrl) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var ifInFolder = this.IsSheetWebDataInFolder ? "./." : ""; newUrl = urlSaving + "Applications/" + winParameter + "/dlg/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame (WebData) ที่ Applications/appname/dlg/w_dlg_xxxx_ctrl/<> this.OpenIFrame2Extend = function (width, height, pageName, queryString, extraUrl) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var ifInFolder = this.IsSheetWebDataInFolder ? "./." : ""; newUrl = urlSavingExtend + "Applications/" + winParameter + "/dlg/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame สำหรับ webdata ที่ Applications/appname/w_sheet_xxx_ctrl/w_dlg_xxx_ctrl/<> this.OpenIFrame3 = function (width, height, pageName, queryString, extraUrl) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var sheet = currentPage.replace(".aspx", ""); newUrl = urlSaving + "Applications/" + winParameter + "/" + sheet + "_ctrl/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } // เปิด iFrame สำหรับ webdata ที่ Applications/appname/w_sheet_xxx_ctrl/w_dlg_xxx_ctrl/<> this.OpenIFrame3Extend = function (width, height, pageName, queryString, extraUrl) { pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; if (extraUrl != null && extraUrl != undefined) { newUrl = extraUrl; } else { var sheet = currentPage.replace(".aspx", ""); newUrl = urlSavingExtend + "Applications/" + winParameter + "/" + sheet + "_ctrl/" + pageName + queryString; } var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } this.OpenIFrameFixPath = function (int_width, int_height, application, string_pageName, string_queryString) { var newUrl = urlSaving + "Applications/" + application + "/dlg/" + string_pageName + "" + string_queryString; this.OpenIFrame(int_width, int_height, "", "", newUrl); } this.OpenGlobalIFrameExtend = function (width, height, pageName, queryString) { var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); queryString = queryString == null || queryString == undefined ? "" : this.Trim(queryString); var newUrl = ""; pageName = pageName.replace(".aspx", ""); pageName = pageName + "_ctrl/" + pageName + ".aspx"; newUrl = urlSavingExtend + "Applications/_global/" + pageName + queryString; var currTop = document.documentElement.scrollTop; elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url(" + urlSaving + "Image/tranparent.png)"; elNew.innerHTML = "
x ปิดหน้าจอ
"; } this.OpenIFrameFixPathExtend = function (int_width, int_height, application, string_pageName, string_queryString) { var newUrl = urlSavingExtend + "Applications/" + application + "/dlg/" + string_pageName + "" + string_queryString; this.OpenIFrame(int_width, int_height, "", "", newUrl); } this.OpenPopup = function (url) { window.open(url); } this.OpenProgressBar = function (progressName, warnning, showCloseButton, extraFunction, extraWinId) { this.ProgressName = progressName; this.DisplayProgressCloseButton = showCloseButton; try { this.ExtraFunction = extraFunction == null || extraFunction == undefined ? null : extraFunction; } catch (err) { this.ExtraFunction = null; } var currDate = new Date(); var isWarnning = warnning ? "&warn=true" : ""; var w_sheet_id = extraWinId == null || extraWinId == undefined ? "&w_sheet_id=" + this.GetCurrentPage() : "&w_sheet_id=" + extraWinId; var appProcess = "&application=" + this.GetApplication(); var newUrl = urlSaving + "Applications/keeping/dlg/w_dlg_running_progressbar.aspx?t=" + currDate.getMinutes() + currDate.getSeconds() + isWarnning + appProcess + w_sheet_id; this.OpenIFrame(450, 250, "w_dlg_running_progressbar.aspx", "", newUrl); } this.OpenSearchMemberNo = function (queryString) { try { if (queryString == undefined || queryString == null) { queryString = ""; } } catch (err) { queryString = ""; } this.OpenGlobalIFrame(580, 580, "w_dlg_mb_member_search_lite.aspx", queryString); } this.OpenSearchCollmastNo = function (queryString) { try { if (queryString == undefined || queryString == null) { queryString = ""; } } catch (err) { queryString = ""; } this.OpenGlobalIFrame(724, 450, "w_dlg_ln_collmaster_search.aspx", queryString); } this.OpenSearchLoanRequestNo = function (queryString) { try { if (queryString == undefined || queryString == null) { queryString = ""; } } catch (err) { queryString = ""; } this.OpenGlobalIFrame(720, 550, "w_dlg_ln_loanrequest_search.aspx", queryString); } this.ParseFloat = function (text) { return parseFloat(text); } this.ParseInt = function (text) { if (text == "08") { return 8; } else if (text == "8") { return 8; } else if (text == "09") { return 9; } else if (text == "9") { return 9; } else { return parseInt(text); } } this.RemoveIFrame = function () { try { var ni = document.getElementById('iFrameMaster'); var elNew = document.getElementById('iFrameChild'); ni.removeChild(elNew); } catch (err) { } } this.SetLastFocus = function (elementName) { this.GetEl("tempLastFocus").value = elementName; } this.StringFormat = function (str, formats) { if (!this.IsNum(str)) { alert("ไม่สามารถแปลงค่าจากตัวอักษรเป็นตัวเลขได้"); return str; } str = str + ""; var formatted; var strformat = formats; var strformatlength = strformat.length; var strlength = str.length; if (strlength <= strformatlength) { formatted = strformat.substring(0, strformatlength - strlength) + str; } return formatted; } this.ToEngDate = function (tDate) { try { return (this.ParseInt(tDate.substring(4, 8)) - 543) + "-" + tDate.substring(2, 4) + "-" + tDate.substring(0, 2); } catch (err) { alert("รูปแบบวันที่ผิด"); return ""; } } this.Trim = function (text) { return text.replace(/^\s+|\s+$/g, ''); } } //------------------------------------------------------------------------------------------------------------------------------------------------------------- var Gcoop = new FullGcoop(); var isForceLoadSubmit = true; function Page_LoadComplete() { Gcoop.Application = currentApp; Gcoop.Url = urlSaving; Gcoop.CurrentPage = currentPage; var webPageType = ""; try { webPageType = document.getElementById("webPageType").value; } catch (Err) { } if (webPageType == "w_dlg_xx_xxxxxx") { } //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- try { SetThDateJavaScript01(); } catch (Err) { } if (webPageType != "w_dlg_xx_xxxxxx" && isForceLoadSubmit) { this.__doPostBack = function (eventTarget, eventArgument) { AddIFrameOnPost(); if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } } else { } // กลับไป Focus ที่เดิมเมื่อกด Enter แล้ว postBack // Firefox, Chrome, Safari try { var requireClientIdFocus = ""; try { if (this.clientIdFocusCodeBehind != undefined && this.clientIdFocusCodeBehind != null && this.clientIdFocusCodeBehind != "") { requireClientIdFocus = this.clientIdFocusCodeBehind; } else { requireClientIdFocus = ""; } } catch (err0) { requireClientIdFocus = ""; } if (requireClientIdFocus != "") { document.getElementById(requireClientIdFocus).focus(); } else { var elLastFocusName = Gcoop.GetEl("tempLastFocus").value; var elFocus = document.aspnetForm.elements[elLastFocusName]; elFocus.focus(); } } catch (err) { } // เรียกใช้ SheetLoadComplete() ของไฟล์ w_sheet_xxxxxxxx.aspx try { if (webPageType == "w_dlg_xx_xxxxxx") { DialogLoadComplete(); } else { SheetLoadComplete(); } } catch (err) { } try { document.addEventListener("keyup", HandleOnKeyUp, true); } catch (err) { } //FullScreen(); try { OnLoadedScript(); } catch (err) { } try { if (iReportProgress == true) { OpenReportProcessing(); } } catch (err) { } } function AddIFrameOnPost() { try { Gcoop.RemoveIFrame(); var ni = document.getElementById('iFrameMaster'); var newdiv = document.createElement('div'); var divIdName = 'iFrameChild'; newdiv.setAttribute('id', divIdName); ni.appendChild(newdiv); var elNew = document.getElementById(divIdName); elNew.style.top = 0; elNew.style.left = 0; elNew.style.width = (screen.width - 20) + "px"; elNew.style.height = "2500px"; elNew.style.zIndex = 999; elNew.style.position = "absolute"; elNew.style.backgroundImage = "url('" + Gcoop.GetUrl() + "Image/tranparent.png')"; elNew.innerHTML = "







......
"; window.document.getElementById("tempElementEnter").focus(); } catch (error) { } } function GetApplicationFromMenu(appName) { Gcoop.RemoveIFrame(); window.location = urlSaving + "Default.aspx"; } function GoApps() { var extraUrl = urlSaving + "ApplicationSelection.aspx"; Gcoop.OpenIFrame(900, 700, "", "", extraUrl); } function GoShowSetting() { tooltip.pop(this, '#setting'); } function GoLogOff() { if (confirm("ยืนยันการออกจากระบบ")) { var loginurl = urlSavingCurrent + "Logout.aspx"; window.location = loginurl; } } function ClickMenuGroup() { var divX = document.getElementById(divMenuGroupId); //currTabElem.setAttribute("className", "some_class_name"); if (isMenuGroupOpen) { divX.setAttribute("class", "menubarGroupClose"); divX.setAttribute("className", "menubarGroupClose"); } else { divX.setAttribute("class", "menubarGroupOpen"); divX.setAttribute("className", "menubarGroupOpen"); } isMenuGroupOpen = !isMenuGroupOpen; } function RemoveIFrame() { Gcoop.RemoveIFrame(); } function Open_Toolbar() { try { MenubarOpen(); } catch (err) { alert("ไม่สามารถใช้ปุ่ม Open ได้"); return false; } } function Save_Toolbar() { try { MenubarSave(); } catch (err) { alert("ไม่สามารถใช้ปุ่ม Save ได้"); return false; } } function New_Toolbar() { var isGo = true; if (isConfirmOnNew == "true") { isGo = confirm("ยืนยันการล้างหน้าจอ!"); } if (isGo) { window.location = absoluteFullPath; } } function loadUniquePage(page) { if (opener && !opener.closed) { opener.focus(); } else { var myWin = window.open(page); opener = myWin; } } function GetDwThColumnDateName(tDwName) { var ext = new Array(); ext = tDwName.split('_'); return tDwName.substring(0, tDwName.length - (ext[ext.length - 1].length + 1)); } function GetDwThColumnDateRow(tDwName) { var ext = new Array(); //tDwName.split('_'); ext = tDwName.split('_'); return parseInt(ext[ext.length - 1]) + 1; } //get ค่าที่ส่งมาทาง url function GetUrlValue(VarSearch) { var SearchString = window.location.search.substring(1); var VariableArray = SearchString.split('&'); for (var i = 0; i < VariableArray.length; i++) { var KeyValuePair = VariableArray[i].split('='); if (KeyValuePair[0] == VarSearch) { return KeyValuePair[1]; } } } //set สีให้ element ที่ต้องการ function SetBGColor(VarElement, VarColor) { return $(VarElement).css('background-color', VarColor); } //set สีให้ element สีตัวอักษร function SetColorEL(VarElement, VarColor) { return $(VarElement).css('color', VarColor); } //แปลงวันที่ EN เป็น TH function SQLDate2ThaiDate(mdy) { var ss = mdy.split('/'); return ss[0] + '/' + ss[1] + '/' + (543 + parseInt(ss[2])); } //แปลงวันที่ TH เป็น EN function ThaiDate2SQLDate(mdy) { var ss = mdy.split('/'); return ss[0] + '/' + ss[1] + '/' + (parseInt(ss[2]) - 543); } //auto / เวลาป้อนวันที่ function AutoSlash(VarElement) { $(VarElement).keyup(function () { ActiveChangeFormatDate(VarElement); }) } function Countslash(str) { var tmp = 0; for (var i = 0; i < str.length; i++) { var chr = str.charAt(i); if (chr == "/") { tmp += 1; } } return tmp; } function ActiveChangeFormatDate(strtag) { var tmp = $(strtag).val(); var count = Countslash(tmp); if (count != 2) { var text = ''; for (var i = 0; i < tmp.length; i++) { var chr = tmp.charAt(i); if ((i == 2 || i == 5) && chr != '/') { text += '/'; } text += tmp.charAt(i); } $(strtag).val(text); } } //set ค่า disable ให้กับ Element function SetDisable(VarElement, VarTypeBool) { $(VarElement).prop('disabled', VarTypeBool); } //set สีให้กับ Element function SetCSSBGColor(VarElement, VarColor) { $(VarElement).css('background-color', VarColor); } function HandleOnKeyUp(e) { try { OnKeyUpBegin(e, e.target); } catch (err) { } try { var isAcceptText = false; if (e.keyCode == '13') { var cName = ""; var cEnName = ""; var cRow = ""; var element = e.target; var valueIs = element.value; for (i = 0; i < dwColumnNameArrayCount; i++) { if (element.name == thDwColumnNameArray[i]) { var ii = 0; cName = GetDwThColumnDateName(thDwColumnNameArray[i]); cEnName = GetDwThColumnDateName(enDwColumnNameArray[i]); cRow = GetDwThColumnDateRow(thDwColumnNameArray[i]); valueIs = Gcoop.Trim(valueIs); while (valueIs.indexOf("/") >= 0) { valueIs = valueIs.replace("/", ""); ii++; if (ii > 10000) break; } //dwObjectJavaScriptArray[i].SetItem(cRow, cName, valueIs); //dwObjectJavaScriptArray[i].AcceptText(); var dd = valueIs.substring(0, 2); var mm = valueIs.substring(2, 4); var yyyy = valueIs.substring(4); try { if (!Gcoop.IsNum(dd)) throw "dd"; if (!Gcoop.IsNum(mm)) throw "mm"; if (!Gcoop.IsNum(yyyy)) throw "yyyy"; } catch (err) { alert(err); return; } valueIs = (parseInt(yyyy + "") - 543) + "-" + mm + "-" + dd; element.value = dd + "/" + mm + "/" + yyyy isAcceptText = true; break; } } var isDisEnter = false; for (i = 0; i < Gcoop.ArrayDeEnterCount; i++) { if (Gcoop.ArrayDeEnter[i] == element.name) { isDisEnter = true; break; } } if (!isDisEnter) { Gcoop.GetEl("tempLastFocus").value = element.name; Gcoop.GetEl("tempElementEnter").focus(); if (isAcceptText) { dwObjectJavaScriptArray[i].SetItem(cRow, cEnName, valueIs); dwObjectJavaScriptArray[i].AcceptText(); } element.focus(); element.select(); } } } catch (err) { } try { OnKeyUpEnd(e, e.target); } catch (err) { } try { if (e.keyCode == "123") { alert(Gcoop.GetLastFocus()); } else if (e.keyCode == "120") { MenubarSave(); } else if (e.keyCode == "113") { New_Toolbar(); // MenubarNew(); } else if (e.keyCode == "119") { MenubarOpen(); } } catch (err) { } } function NumberRound(val, fixed) { try { var tmp = parseFloat(val); var tmp2 = fncToFixed(tmp, fixed); val = parseFloat(tmp2); } catch (Error) { val = 0; } return val; } function fncToFixed(num, decimals) { var power = Math.pow(10, decimals); var num2 = Math.round(num * power) / power //num = (Math.round(num, decimals) + (((num - Math.round(num, decimals)) >= 0.4) ? 1 : 0)) / Math.pow(10, decimals); return num2; // num.toFixed(decimals); } function addCommas(nStr, fixed) { nStr = parseFloat(nStr); nStr = fncToFixed(nStr, fixed); nStr = nStr.toString(); nStr += ''; x = nStr.split('.'); x1 = x[0]; if (x.length > 1) { x2 = x[1]; } else { var tmpdata = ''; for (var i = 0; i < fixed; i++) { tmpdata += '0'; } x2 = tmpdata; } var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + "." + x2; } // function เพิ่ม สำหรับลดการ postback function getObjInt(s, r, c) { var val; try { val = parseInt(s.GetItem(r, c)); if (val == null || typeof (val) == "undefined" || isNaN(val)) { val = 0; } } catch (Error) { val = 0; } return val; } function getObjFloat(s, r, c) { var val; try { val = parseFloat(s.GetItem(r, c)); if (val == null || typeof (val) == "undefined" || isNaN(val)) { val = 0.00; } } catch (Error) { val = 0.00; } return val; } function getObjString(s, r, c) { var val; try { val = s.GetItem(r, c); if (val == null || typeof (val) == "undefined") { val = ""; } } catch (Error) { val = ""; } return val; }