String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } /** Added by Amelia for calendar end date 2003-12-05 The function is to get the end date based on the start date and delay days. The return value is sent to the function whose name is what you input(sJsFuncName). */ function SYS_CalEndWorkingDate(strCntyCodeValue, strStartDateValue, strDaysValue, strJsFuncName, strBeforeOrAfter, strIfCheckHol, strIfJumpHol) { try { if (strCntyCodeValue == null || strCntyCodeValue == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90042); _SYS_Display_WARN(msg); //alert("[SYS_CalEndWorkingDate] The value of country code field is empty !Pls input it!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } //check if start date is null if (strStartDateValue == null || strStartDateValue == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90044); _SYS_Display_WARN(msg); // alert("[SYS_CalEndWorkingDate] The value of start date field is empty !Pls input it!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } //check if the value of days is integer if (isNaN(parseInt(strDaysValue))) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90046); _SYS_Display_WARN(msg); // alert("[SYS_CalEndWorkingDate] The value of days isn't valid !Pls check it!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } //check if the function name field is null if (strJsFuncName == null | strJsFuncName == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90047); _SYS_Display_ERROR(msg); //alert("[SYS_CalEndWorkingDate] Cannot find the function accepting return value!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var arrParam = new Array("CALENDWORKINGDATE", strCntyCodeValue, strStartDateValue, strDaysValue, strJsFuncName, strBeforeOrAfter, strIfCheckHol, strIfJumpHol); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia 2003.06.09 sJspFieldName : we search if its value exist in the tables. */ function SYS_GetSwiftBicCode(sJspFieldName) { try { var jspFieldValue = ""; //the value of the element named jspFieldName var fieldsList = "SWIFT_ADD_HO" + "+" + "SWIFT_ADD_CB"; var tablesList = "BANK_MASTER" + "+" + "BANK_EVENT"; if (document.MAINFORM.elements[sJspFieldName] != null) { jspFieldValue = document.MAINFORM.elements[sJspFieldName].value; } if (jspFieldValue != "") { //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_GET_SBC&SBC_FIELDS_LIST="; actionUrl+=fieldsList + "&SBC_TABLES_LIST=" + tablesList + "&SBC_JSPFIELDVALUE=" + jspFieldValue; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_GET_SBC&SBC_FIELDS_LIST=" + fieldsList + //"&SBC_TABLES_LIST=" + tablesList + "&SBC_JSPFIELDVALUE=" + jspFieldValue; // window.open(url,"",wStyles); openIframe(actionUrl); SYS_SetTimeOutOfAutoSave(); } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia 2003-12-29 when getting cubk is ok, it calls TrueJsFuncName function and if defeated it calls FalseJsFuncName mandatory: sCUBKMappingName, sfKeyFldName optional: sSucJsFuncName, sFailJsFuncName */ var SYS_INQ_CUBK_FLDS = ""; var SYS_LAST_CUBK = ""; function SYS_GetCUBK(sCUBKMappingName, sfKeyFldName, sSucJsFuncName, sFailJsFuncName) { try { return getCUBK_ajax(true, sCUBKMappingName, sfKeyFldName, sSucJsFuncName, sFailJsFuncName); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetCUBK_S(sCUBKMappingName, sfKeyFldName, sSucJsFuncName, sFailJsFuncName) { try { return getCUBK_ajax(false, sCUBKMappingName, sfKeyFldName, sSucJsFuncName, sFailJsFuncName); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } //CEV2-0268 added by maliryn for ext temp test 2008.05.22 s function SYS_InqCUBK(sCUBKMappingName, sfKeyFldName) { try { if (typeof(Ext_InqCUBK) == "function") { Ext_InqCUBK(sCUBKMappingName, sfKeyFldName); } else { _SYS_InqCUBK(sCUBKMappingName, sfKeyFldName); } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function _SYS_InqCUBK(sCUBKMappingName, sfKeyFldName) { try { //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME="; actionUrl+=sCUBKMappingName; //Frank modify End //var openUrl = "../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME=" + sCUBKMappingName; if (sfKeyFldName != null || sfKeyFldName != "") { var objField = document.MAINFORM.elements[sfKeyFldName]; if (objField != null && objField.value != "") { actionUrl += "&SEARCH_FIELD_VALUE=" + objField.value; } } //CEV2-02-17-07 wayne add 2015-09-02 e //CEV2-02-17-09 wayne modify 2016-03-22 s var cubkActionUrl = collectCUBKValue(sCUBKMappingName, false); if(cubkActionUrl.length > 0){ actionUrl += "&" + cubkActionUrl; } //CEV2-02-17-09 wayne modify 2016-03-22 s //CEV2-02-17-07 wayne add 2015-09-02 e var style = _SYS_InqCUBK.arguments[2]; if(typeof(style) == "undefined"){ var swidth = screen.width; var sheight = screen.height; var width = swidth >= 1024? 1024 : 800; var height = sheight >= 768? 768 : 600; var left = (swidth - width) / 2; var top = (sheight - height) / 2; style = new OpenWinStyle(); style.setWidth(width); style.setHeight(height); style.setTop(top); style.setLeft(left); //var wStyle = "width=" + swidth + ",height=" + sheight + ",left=0,top=0,scrollbars=no,status=no,resizable=no"; } actionUrl = encodeUrl(actionUrl); //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify openWin(actionUrl, "", style); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } //CEV2-0268 added by maliryn for ext temp test 2008.05.22 e function SYS_InqAssignCUBK(sCUBKMappingName, sfKeyFldName, assginKeyFld, assignRootFld, assignSubFld) { try { var swidth = screen.width - 10; var sheight = screen.height - 50; //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME="; actionUrl+=sCUBKMappingName; //Frank modify End //var openUrl = "../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME=" + sCUBKMappingName; if (sfKeyFldName != null && sfKeyFldName != "") { var objField = document.MAINFORM.elements[sfKeyFldName]; if (objField != null && objField.value != "") { actionUrl += "&SEARCH_FIELD_VALUE=" + objField.value; } } if (assignRootFld != null && assignRootFld != "") { actionUrl += "&_ASGN_ROOT_FLD=" + assignRootFld; var lower = assignRootFld.toLowerCase().substring(0, 3); if (lower != "sys") { actionUrl += "&" + assignRootFld + "=" + document.getElementsByName(assignRootFld)[0].value; } } else { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90073); _SYS_Display_ERROR(msg); // alert("JS Error:[ASGN_ROOT_Fld]The key field is null.Pls check it and input again!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (assginKeyFld != null && assginKeyFld != "") { actionUrl += "&_ASGN_KEY_FLD=" + assginKeyFld; } if ((assignRootFld != null && assignRootFld != "") && (assignSubFld != null && assignSubFld != "")) { actionUrl += "&_ASGN_SUB_FLD=" + assignSubFld; var lower = assignRootFld.toLowerCase().substring(0, 3); if (lower != "sys") { actionUrl += "&" + assignSubFld + "=" + document.getElementsByName(assignSubFld)[0].value; } } var style = SYS_InqAssignCUBK.arguments[5]; if(typeof(style) == "undefined"){ style = new OpenWinStyle(); style.setWidth(swidth); style.setHeight(sheight); //var wStyle = "width=" + swidth + ",height=" + sheight + ",left=0,top=0,scrollbars=no,status=no,resizable=no"; } actionUrl = encodeUrl(actionUrl); //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify openWin(actionUrl, "", style); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia for InqCUBK with sql 2003.06.16 */ //CEV2-0268 added by maliryn for ext temp test 2008.05.22 s function SYS_InqCUBK_Sql(sCUBKMappingName, sWhereSql) { try { if (typeof(Ext_InqCUBK_Sql) == "function") { Ext_InqCUBK_Sql(sCUBKMappingName, sWhereSql); } else { _SYS_InqCUBK_Sql(sCUBKMappingName, sWhereSql); } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function _SYS_InqCUBK_Sql(sCUBKMappingName, sWhereSql) { try { //sWhereSql is the sql condition like "F1='<--FA-->' AND F2=<--FB-->..." var swidth = screen.width - 10; var sheight = screen.height - 50; var sqlCondition = reGetSql(sWhereSql); //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME="; actionUrl+=sCUBKMappingName +"&HAVE_SQL_CONDITION=" + sqlCondition; //Frank modify End //var url = '../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_CUBK&CUBK_MAPPING_NAME=' + sCUBKMappingName + //'&HAVE_SQL_CONDITION=' + sqlCondition; var style = _SYS_InqCUBK_Sql.arguments[2]; if(typeof(style) == "undefined"){ style = new OpenWinStyle(); style.setScrollbars(true); style.setWidth(swidth); style.setHeight(sheight); } //var wStyle = "width=" + swidth + ",height=" + sheight + ",left=0,top=0,scrollbars=yes,status=no,resizable=no"; actionUrl = encodeUrl(actionUrl); openWin(actionUrl, "", style); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } //CEV2-0268 added by maliryn for ext temp test 2008.05.22 e function SYS_InsertClause(sfInsertClauseIntoFieldName, windowWidth, windowHeight) { try { if (sfInsertClauseIntoFieldName == null || document.MAINFORM.elements[sfInsertClauseIntoFieldName] == null) { // alert("[SYS_InsertClause] Cannot find the field which will be inserted clause value into!"); var msg = _getClientMessage(90074); _SYS_Display_ERROR(msg); return false; } var clauseTextArea = document.MAINFORM.elements[sfInsertClauseIntoFieldName]; //CEV2-0146 john.zhong S var clauseFieldValue = clauseTextArea.getAttribute("CLAUSE_FIELD"); //CEV2-0146 john.zhong E var actionUrl; //CEV2-0146 john.zhong S if (typeof(clauseFieldValue) == "undefined"||clauseFieldValue == null) { //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_INSERT_CLAUSE&Clause_CurrentFormName=MAINFORM"; actionUrl+="&Clause_InsertClauseFieldName=" + sfInsertClauseIntoFieldName; //Frank modify End //url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_INSERT_CLAUSE&Clause_CurrentFormName=MAINFORM" + //"&Clause_InsertClauseFieldName=" + sfInsertClauseIntoFieldName; } else { //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_INSERT_CLAUSE&Clause_CurrentFormName=MAINFORM"; actionUrl+="&Clause_InsertClauseFieldName=" + clauseFieldValue + "&Clause_RealFieldName=" +sfInsertClauseIntoFieldName; //Frank modify End //url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_INSERT_CLAUSE&Clause_CurrentFormName=MAINFORM" + //"&Clause_InsertClauseFieldName=" + clauseFieldValue + "&Clause_RealFieldName=" + // sfInsertClauseIntoFieldName; } //CEV2-0146 john.zhong E var style = SYS_InsertClause.arguments[3]; if(typeof(style) == "undefined"){ style = new OpenWinStyle(); var w = windowWidth != null ? windowWidth : 800; style.setWidth(w); var h = windowHeight != null ? windowHeight : 320; style.setHeight(h); } // var wStyle = (windowWidth != null && windowHeight != null) ? ("width=" + windowWidth + ",height=" + //windowHeight + ",resizable=0"): "width=800,height=320,resizable=0"; actionUrl = encodeUrl(actionUrl); //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify var clauseWin = openWin(actionUrl, "clauseWin", style); clauseWin.focus(); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_InsertClauseDirect(sfInsertClauseIntoFieldName, sClauseName, strSendType, strJSFuncName, strClauseType) { try { if (sfInsertClauseIntoFieldName == null || document.MAINFORM.elements[sfInsertClauseIntoFieldName] == null) { // alert("[SYS_InsertClause] Cannot find the field which will be inserted clause value into!"); var msg = _getClientMessage(90074); _SYS_Display_ERROR(msg); return false; } if (sClauseName == null) { // alert("[SYS_InsertClause] Plz input the clause name!"); var msg = _getClientMessage(90058); _SYS_Display_WARN(msg); return false; } if (strClauseType == null || strClauseType == "undefined" || strClauseType.trim() == "") { strClauseType = "SYST"; } var arrParam = new Array("INSERTCLAUSETOFIELD", sfInsertClauseIntoFieldName, sClauseName, strSendType, strJSFuncName, strClauseType); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by johnny 2003-04-01 and latest modified by Amelia 2004.4.14 To get the Ref No The return value is trx ref no. which will be sent to a function named sFuncName's value. */ function SYS_GetRefNo(sRefName, sFuncName, sFuncNameSec, sRefType) { try { return GetRefNo_ajax(true, sRefName, sFuncName, sFuncNameSec, sRefType); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetRefNo_S(sRefName, sFuncName, sFuncNameSec, sRefType) { try { return GetRefNo_ajax(false, sRefName, sFuncName, sFuncNameSec, sRefType); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetCEBankRefNo(sFuncName, sFuncNameSec) { if (sFuncName == null || sFuncName.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90037); _SYS_Display_WARN(msg); // alert("[SYS_GetRefNo]: Pls input Ref. Name !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var arrParam = new Array("GETREFNO", "", sFuncName, sFuncNameSec, "CE_BANK_REF"); SetTimeOut(arrParam); return ; } function SYS_GetCECustRefNo(sFuncName, sFuncNameSec) { try { return GetRefNo_ajax(true, "", sFuncName, sFuncNameSec, ""); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetCECustRefNo_S(sFuncName, sFuncNameSec) { try { return GetRefNo_ajax(false, "", sFuncName, sFuncNameSec, ""); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } //CEV2-0413 john.zhong 2010-05-27 S function SYS_GetGlobalRefNo(sFuncName, sFuncNameSec) { try { return GetRefNo_ajax(true, "", sFuncName, sFuncNameSec, "",true); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetGlobalRefNo_S(sFuncName, sFuncNameSec) { try { return GetRefNo_ajax(false, "", sFuncName, sFuncNameSec, "",true); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } //CEV2-0413 john.zhong 2010-05-27 E /** Added by Amelia for getting single Exchange Rate */ /* Added by Pedro 16Nov2004 to check agains an array of rates if a specific rate has already been retrieved */ var CheckRateAgainstArray = false; var aScreenRateArray = new Array(); var AMTRate = 0; /* End add */ //Modified by Amelia for CE_Core_000658 2006.5.26 //sIgnoreFuncType: optional,"Y" or "N" or empty function SYS_GetExchangeRate(sFromCcy, sToCcy, sRateType, sFieldNameOrVarName, sJsFuncName, sMDFlagName, sIgnoreFuncType) { try { if (sIgnoreFuncType != "Y") { if (SYS_FUNCTION_TYPE == "RE" || SYS_FUNCTION_TYPE == "IQ") { return ; } if (SYS_FUNCTION_TYPE == "EC" && event && event.type == "load") { return ; } } if (sFromCcy == "" || sToCcy == "" || sRateType == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90061); _SYS_Display_WARN(msg); // alert("[GetExchangeRate] Some mandatory value is empty!Plz check it!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (sFieldNameOrVarName == null || sFieldNameOrVarName == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90062); _SYS_Display_WARN(msg); // alert("[GetExchangeRate] Plz input a valid value into sFieldNameOrVarName!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } /* Added by Pedro 16Nov2004 to check agains an array of rates if a specific rate has already been retrieved */ var found = false; var vRateValue = 0; var rateKey = sFromCcy + sToCcy + sRateType; if (aScreenRateArray.length > 0 && CheckRateAgainstArray) { for (var i = 0; i < aScreenRateArray.length; i++) { if (rateKey == aScreenRateArray[i][0]) { vRateValue = aScreenRateArray[i][1]; found = true; break; } } } /*Edited by alexwang*/ if (found) { if (document.MAINFORM.elements[sFieldNameOrVarName] != null) { document.MAINFORM.elements[sFieldNameOrVarName].value = vRateValue; } else { //if(typeof(AMTRate) != "undefined") AMTRate = parseFloat(vRateValue); } var sExecJsFuncName = sJsFuncName + "()"; eval(sExecJsFuncName); return ; } /* End add */ var arrParam = new Array("GETEXCHRATE", sFromCcy, sToCcy, sRateType, sFieldNameOrVarName, sJsFuncName, sMDFlagName); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia for batching Exchange Rates at one time It must be used with SYS_BATCH_GETDATA_COMMIT() */ function SYS_GetExchangeRate_Batch(sFromCcy, sToCcy, sRateType, sFieldNameOrVarName, sJsFuncName) { try { if (SYS_FUNCTION_TYPE == "RE" || SYS_FUNCTION_TYPE == "IQ") { return ; } if (SYS_FUNCTION_TYPE == "EC" && event && event.type == "load") { return ; } if (sFromCcy == "" || sToCcy == "" || sRateType == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90075); _SYS_Display_WARN(msg); // alert("[SYS_GetExchangeRate_Batch] Some mandatory value is empty!Plz check it!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (sFieldNameOrVarName == null || sFieldNameOrVarName == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90076); _SYS_Display_WARN(msg); // alert("[SYS_GetExchangeRate] Plz input a valid value into sFieldNameOrVarName!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var sendPara = "BGDT_EXRATE:" + sFromCcy + ":" + sToCcy + ":" + sRateType + ":" + sFieldNameOrVarName + ":" + sJsFuncName + ""; if (SYS_BGD_PARAS != "") { SYS_BGD_PARAS += ";" + sendPara; } else { SYS_BGD_PARAS += sendPara; } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_BATCH_GETDATA_COMMIT() { try { //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=BGDPARAS&BGDR_PARAS="; actionUrl+=SYS_BGD_PARAS; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../servlets/WSTrxManager?_TRX_STATUS=BGDPARAS&BGDR_PARAS=" + SYS_BGD_PARAS; // var batchGetDataWin = window.open(url,"",wStyles); openIframe(actionUrl); SYS_BGD_PARAS = ""; SYS_SetTimeOutOfAutoSave(); // return batchGetDataWin; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia for server side script 2004.7.20 sRuleName: is the js url sFldList: format is "F1;F2;.....FN" sJSFunc:after updating the fields to run the js function Mandatory:sRuleName,sFldList Optional:sJSFunc */ function SYS_GetDataBySSS(sRuleName, sFldList, sJSFuncName) { try { if (sRuleName == null || sFldList == null || sRuleName.trim() == "" || sFldList.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90063); _SYS_Display_WARN(msg); // alert("[SYS_GetDataBySSS Error] Plz input the correct parameters!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } //CEV2-0294 modify by martin s //var arrParam = new Array("SSSCRIPT", sRuleName, sFldList, sJSFuncName); //SetTimeOut(arrParam); SSSCRIPT_task(sRuleName, sFldList, sJSFuncName); //CEV2- 0294 martin modify e } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Kevin To get the date value from the string just like '2004-04-05' */ function SYS_GetDateByStr(sfDateFieldName) { //CEV2-0190 john.zhong 2007-11-05 S the old code is document.MAINFORM.elements(sfDateFieldName) //the old code doesn't cross browser if (document.MAINFORM.elements[sfDateFieldName] == null) { return null; } var dV = document.MAINFORM.elements[sfDateFieldName].value; //CEV2-0190 john.zhong 2007-11-05 E var dateObj = _SYS_GetDateObj(dV); return dateObj; /* //CEV2-0119 paul added and bound by maliryn for changing to system date format var dV = getSystem_Date_format(dV); //CEV2-0119 paul added end var ss; var len = dV.length; if (len == 0) { return null; } var ii1 = dV.indexOf("-", 0); var ii2; var yy, mm, dd; var sD; if (ii1 > 0) { yy = parseInt(dV.substr(0, ii1)); ii2 = dV.indexOf("-", ii1 + 1); if (ii1 < 4) { yy += 2000; } ss = dV.substr(ii1 + 1, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(ii2 + 1); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); } else if (len == 6) { ss = dV.substr(0, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } yy = parseInt(ss); ss = dV.substr(2, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(4, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); yy += 2000; } else if (len == 8) { yy = parseInt(dV.substr(0, 4)); ss = dV.substr(4, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(6, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); } else { return null; } var retDate = new Date(yy, mm, dd, 0, 0, 0, 0); return retDate;*/ } /** This function is to format the date field */ function SYS_FormatDate(sfDateFieldName) { //modify by Terry for formate date 2007-11-8 var o = document.MAINFORM.elements[sfDateFieldName]; if (o == null) { //CEV2-0063 modify by Terry start 2007-12-13 var errMsg = _getClientMessage(90077, sfDateFieldName); SYS_CheckError(o, errMsg); //alert("[SYS_FormatDate] Can't find the " + sfDateFieldName + " field in the jsp !"); //CEV2-0063 modify by Terry end 2007-12-13 return false; } var sName = ""; if (o.title.length > 0) { sName = o.title; } else { sName = o.name; } var dV = _SYS_GetDateStr(o.value); if(dV == null){ var errMsg = _getClientMessage(90031, sName); SYS_CheckError(o, errMsg); o.focus(); return false; } //edited by maliryn 2007.11.30 s //o.value = sD; o.value = dV; //edited by maliryn 2007.11.30 e return true; } /** * format date type from string to date object * @param strDate date with string type * @return date object */ function _SYS_GetDateObj(strDate){ var dV = getSystem_Date_format(strDate); var ss; var len = dV.length; if (len == 0) { return null; } var ii1 = dV.indexOf("-", 0); var ii2; var yy, mm, dd; var sD; if (ii1 > 0) { yy = parseInt(dV.substr(0, ii1)); ii2 = dV.indexOf("-", ii1 + 1); if (ii1 < 4) { yy += 2000; } ss = dV.substr(ii1 + 1, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(ii2 + 1); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); } else if (len == 6) { ss = dV.substr(0, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } yy = parseInt(ss); ss = dV.substr(2, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(4, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); yy += 2000; } else if (len == 8) { yy = parseInt(dV.substr(0, 4)); ss = dV.substr(4, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } mm = parseInt(ss) - 1; ss = dV.substr(6, 2); if (ss.substr(0, 1) == "0") { ss = ss.substr(1, 1); } dd = parseInt(ss); } else { return null; } var retDate = new Date(yy, mm, dd, 0, 0, 0, 0); return retDate; } /** * get date for string type like yyyy-mm-dd * @param strDate date with string type * @return string date */ function _SYS_GetDateStr(strDate){ var objDate = _SYS_GetDateObj(strDate); var sD; if(objDate != null) { var yy = objDate.getFullYear(); var mm = objDate.getMonth() + 1; if(parseInt(mm) < 10){ mm = "0" + mm; } var dd = objDate.getDate(); if(parseInt(dd) < 10){ dd = "0" + dd; } sD = yy + "-" + mm + "-" + dd; } else { return null; } return sD; } /** Added by Kevin To get the current time like "hour:minute:second" */ function SYS_GetSystemTime_String() { try { var thisday = new Date(); var hours = thisday.getHours(); var hours1; hours1 = hours < 10 ? "0" + hours.toString(): hours.toString(); var minutes = thisday.getMinutes(); var minutes1; minutes1 = minutes < 10 ? "0" + minutes.toString(): minutes.toString(); var seconds = thisday.getSeconds(); var seconds1; seconds1 = seconds < 10 ? "0" + seconds.toString(): seconds.toString(); var systemtime = hours1 + ":" + minutes1 + ":" + seconds1; return systemtime; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** To get the days between first date and second date */ function SYS_GetSubDays(sfFirstDayName, sfSecondDayName) { try { if (sfFirstDayName == null || document.MAINFORM.elements[sfFirstDayName] == null) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90078, sfFirstDayName); _SYS_Display_ERROR(msg); // alert("[SYS_GetSubDays] Cannot find the "+sfFirstDayName+" field(first day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (sfSecondDayName == null || document.MAINFORM.elements[sfSecondDayName] == null) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90079, sfSecondDayName); _SYS_Display_ERROR(msg); // alert("[SYS_GetSubDays] Cannot find the "+sfSecondDayName+" field(second day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var dFirstDay = SYS_GetDateByStr(sfFirstDayName); var dSecondDay = SYS_GetDateByStr(sfSecondDayName); var days; if (dFirstDay == null || dSecondDay == null) { return 0; } else { days = SYS_BeFloat((dSecondDay - dFirstDay) / SecondADay); } return days; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** To check whether the day1 is later than day2. Return true or false. It deponds on SYS_GetSubDays(). */ function SYS_Day1MustbeLaterThanDay2(sfFirstDayName, sfSecondDayName) { try { var oDay1 = document.MAINFORM.elements[sfSecondDayName]; if (oDay1 == null) { /** * @author ghyll @date 2004-12-25 */ //alert("[SYS_Day1MustbeLaterThanDay2] Cannot find the "+sfFirstDayName+" field(first day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90079, sfSecondDayName); _SYS_Display_ERROR(msg); // alert("[SYS_Day1MustbeLaterThanDay2] Cannot find the "+sfSecondDayName+" field(second day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var oDay2 = document.MAINFORM.elements[sfFirstDayName]; if (oDay2 == null) { //alert("[SYS_Day1MustbeLaterThanDay2] Cannot find the "+sfSecondDayName+" field(second day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90078, sfFirstDayName); _SYS_Display_ERROR(msg); // alert("[SYS_Day1MustbeLaterThanDay2] Cannot find the "+sfFirstDayName+" field(first day)!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e /******************Modified End********************************/ return false; } var days = SYS_GetSubDays(sfSecondDayName, sfFirstDayName); if (days > 0) { return true; } else { var d1Name = (oDay1.title == "" ? oDay1.name : oDay1.title); var d2Name = (oDay2.title == "" ? oDay2.name : oDay2.title); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90082, d2Name, d1Name); _SYS_Display_WARN(msg); // alert(d2Name+" must be later than "+d1Name+" !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /**==CE Add Start ,Added by alex,2005.12.12==*/ function Change_AMT_OnChange() { try { if (typeof(SYS_AMT_CCY) == "undefined") { return false; } var dec = 0; for (var i = 0; i < SYS_AMT_CCY.length; i++) { var ccyFieldName = SYS_AMT_CCY[i][0]; var oCCYField = document.MAINFORM.elements[ccyFieldName]; //ccy field if (oCCYField == null) { continue; } var ccyf = oCCYField.onchange; var myCcyF = null; if (ccyf == null) { myCcyF = new Function("Check_LCAMT_CHANGE()"); } else { myCcyF = new Function("eval(" + ccyf + "());Check_LCAMT_CHANGE()"); } oCCYField.onchange = myCcyF; for (var j = 1; j < SYS_AMT_CCY[i].length; j++) { var objAmt = document.MAINFORM.elements[SYS_AMT_CCY[i][j]]; if (objAmt == null) { continue; } var amtf = objAmt.onblur; var myAmtF = null; if (amtf == null) { myAmtF = new Function("Check_LCAMT_CHANGE()"); } else { myAmtF = new Function("eval(" + amtf + "());Check_LCAMT_CHANGE()"); } objAmt.onblur = myAmtF; } } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Reignson on 2003/01/14 To calculation the number of terms */ function SYS_CalcNumberOfTerms(dStartDate, dEndDate, nTermPeriod) { try { if (dStartDate == null) { return 0; } if (dEndDate == null) { return 0; } if (nTermPeriod == null || typeof(nTermPeriod) != 'number') { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90083); _SYS_Display_WARN(msg); // alert("[SYS_CalcNumberOfTerms] Plz input an number above zero for nTermPeriod!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var nStartDay = dStartDate.getDate(); var nStartMonth = dStartDate.getMonth(); var nStartYear = dStartDate.getYear(); var nEndDay = dEndDate.getDate(); var nEndMonth = dEndDate.getMonth(); var nEndYear = dEndDate.getYear(); var nNumberOfMonth = 0; var nNumberOfTerms = 0; var nTmp1 = 0; var nDayFlag; //for day compare, 0 for dEndDate equal to dStartDate, 1 for smaller, 2 for greater. //if dEndDate smaller than dStartDate, set to ture. if (dEndDate < dStartDate) { return nNumberOfMonth; } //if dEndDate smaller than dStartDate, return nNumberOfMonth to be 0; if (dEndDate == dStartDate) { return nNumberOfMonth; } //now dEndDate was sure greater than dStartDate, so start calculate Number of Terms. //because nEndYear was sure greater or equal to dStartYear. nNumberOfMonth = (nEndYear - nStartYear) * 12; /* if nEndMoth > nStartMonth the expression will be nNumberOfMonth + (nEndMonth - nStartMonth); if nEndMonth < nStartMonth the expression should be (nEndYear - nStartYear - 1) *12 + (12 - nStartMonth + nEndMonth), so combine two expression will be as: nNumberOfMonth = nNumberOfMonth + (nEndMonth - nStartMonth) */ nNumberOfMonth = nNumberOfMonth + (nEndMonth - nStartMonth); //if nEndDay greater than nStartDay, means enough to be one month, //nNumberOfMonth must plus 1. if (nEndDay > nStartDay) { nNumberOfMonth = nNumberOfMonth + 1; } //nTmp1 = nNumberOfMonth % nTermPeriod; //nNumberOfTerms = parseInt(nNumberOfMonth / nTermPeriod); //if (nTmp1 != 0) //{ nNumberOfTerms = nNumberOfTerms + 1; } nNumberOfTerms = Math.ceil(nNumberOfMonth / nTermPeriod); return nNumberOfTerms; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia 2003.07.08 It't to check whether the date(sfDateName's value) is the holiday Mandatory:sfCntyCodeName, sfDateName Optional:sfStateName, sfUnitCodeName */ function SYS_CheckHoliday(sfCntyCodeName, sfDateName, sfStateName, sfUnitCodeName) { try { var vCntyCode = null; var vDate = null; var vState = null; var vBuCode = null; //check if the country code field is null if (document.MAINFORM.elements[sfCntyCodeName] != null) { vCntyCode = document.MAINFORM.elements[sfCntyCodeName].value; } //check if the date field is null if (document.MAINFORM.elements[sfDateName] != null) { vDate = document.MAINFORM.elements[sfDateName].value; } //check if state field is null if (document.MAINFORM.elements[sfStateName] != null) { vState = document.MAINFORM.elements[sfStateName].value; } //check if the unit code is null if (document.MAINFORM.elements[sfUnitCodeName] != null) { vBuCodeName = document.MAINFORM.elements[sfUnitCodeName].value; } //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_HOLIDAY_CHECK&HOLI_CNTY_CODE="; actionUrl+=vCntyCode + "&HOLI_DATE=" + vDate + "&HOLI_STATE_CODE=" + vState + "&HOLI_BU_CODE=" + vBuCode; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_HOLIDAY_CHECK&HOLI_CNTY_CODE=" + vCntyCode + "&HOLI_DATE=" //+ vDate + "&HOLI_STATE_CODE=" + vState + "&HOLI_BU_CODE=" + vBuCode; // window.open(url,"",wStyles); openIframe(actionUrl); SYS_SetTimeOutOfAutoSave(); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Reignson on 2003/01/15 purpose: if p1 is not numeric type, below statement will convert it to be numeric. if p1 include illegal letter, beFloat will truncate the remainder part from first illegal letter. if p1 is null or first letter is illegal letter, will return 0. */ function SYS_BeFloat(objValue) { try { var nResult1 = 0; var oArray1; var sTemp1 = ""; if (objValue == null) { return nResult1; } if (typeof(objValue) == "number") { return objValue; } //below statement will remove comma sign and convert string to numeric. if (objValue.indexOf(",") == - 1) { nResult1 = parseFloat(objValue); if (isNaN(nResult1)) { nResult1 = 0; } } else { oArray1 = objValue.split(","); for (var i = 0; i < oArray1.length; i++) { sTemp1 = sTemp1 + oArray1[i]; } nResult1 = parseFloat(sTemp1); } return nResult1; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Reignson on 2003/01/15 purpose: if objValue is not numeric type, below statement will convert it to be numeric. if objValue include illegal letter, beFloat will truncate the remainder part from first illegal letter. if objValue is null or first letter is illegal letter, will return 0. */ function SYS_BeInt(objValue) { try { var nResult1 = 0; if (objValue == null) { return nResult1; } if (typeof(objValue) == "number") { nResult1 = Math.floor(objValue); return nResult1; } nResult1 = parseInt(objValue); if (isNaN(nResult1)) { nResult1 = 0; } return nResult1; } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /** Added by Amelia for focus on multi-layer 2004.4.23 */ //CEV211 DO john.zhong function SYS_CheckError(o, strErrMsg,notShowTab) { try { getDivByField(o); if (strErrMsg != null && strErrMsg != ""){ _SYS_Display_ERROR(strErrMsg); } if (!o.disabled && !o.readonly && o.type != "hidden") { //CEV2-0214 martin-2007-12-17 s if(typeof(ShowTab)=="function"&&typeof(GetTabIdByFld)=="function"&&!notShowTab){ ShowTab(GetTabIdByFld(o)); } //CEV2-0214 martin-2007-12-17-e o.focus(); } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_InqGapi(sGapiInterfaceName, sJSFuncName, callback, bSetValue) { try { return InqGapi_ajax(true, sGapiInterfaceName, sJSFuncName, callback, bSetValue); } catch (e) { alert("[SYS_InqGapi Error]: " + e.expression); } } function SYS_InqGapi_S(sGapiInterfaceName, sJSFuncName, callback, bSetValue) { try { return InqGapi_ajax(false, sGapiInterfaceName, sJSFuncName, callback, bSetValue); } catch (e) { alert("[SYS_InqGapi_S Error]: " + e.expression); } } /** Added by Amelia for get fields from table directly Mandatory: sTableName,sFieldList Optional: sSQLWhere,sMappingList,sSucJsFuncName, sFailJsFuncName sFieldList: F1;F2;.....Fn sMappingList: MF1;MF2;.....MFn or don't input it, use FieldList as MappingList by default */ function SYS_GetTableData(sTableName, sSQLWhere, sFieldList, sMappingList, sSucJsFuncName, sFailJsFuncName) { try { if (sTableName == null || sTableName.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90064); _SYS_Display_ERROR(msg); // alert("[SYS_GetTableData Error]: sTableName is Mandatory !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (sFieldList == null || sFieldList.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90065); _SYS_Display_ERROR(msg); // alert("[SYS_GetTableData Error]: sFieldList is Mandatory !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } /**== CE Edit Start: CE_Core_000084 ,Edited by davie,2005.10.25 ==*/ //var arrParam = new Array("GETTABLEDATA",sTableName,sSQLWhere,sFieldList,sMappingList,sSucJsFuncName,sFailJsFuncName); var arrParam = new Array("GETTABLEDATA", "TD", sTableName, sSQLWhere, sFieldList, sMappingList, sSucJsFuncName, sFailJsFuncName); /**== CE Edit End :CE_Core_000084 ==*/ SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /**==CE Add Start: CE_Core_000084 ,Added by davie,2005.10.25==*/ // new function to get table data from security database function SYS_GetSDTableData(sTableName, sSQLWhere, sFieldList, sMappingList, sSucJsFuncName, sFailJsFuncName) { try { if (sTableName == null || sTableName.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90064); _SYS_Display_ERROR(msg); // alert("[SYS_GetTableData Error]: sTableName is Mandatory !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (sFieldList == null || sFieldList.trim() == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90065); _SYS_Display_ERROR(msg); // alert("[SYS_GetTableData Error]: sFieldList is Mandatory !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } var arrParam = new Array("GETTABLEDATA", "SD", sTableName, sSQLWhere, sFieldList, sMappingList, sSucJsFuncName, sFailJsFuncName); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /**==CE Add End : CE_Core_000084 ==*/ /** Added by Ghyll for EEC000034 2004-12-20 * strLinkSeleName is dropdownlist name * strSqlWhereFieldName'value is where condition * strTableName is tableName * strSqlField is sql column, it can be null. if the strSqlField is null, strSqlField is strLinkSeleName */ function SYS_GenSelectElement(strFldName, strFldList) { try { if (strFldName == null || strFldName.length == 0) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90066); _SYS_Display_ERROR(msg); // alert("Fld name can not be null !"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return ; } var arrParam = new Array("GENSELECTELEMENT", strFldName, strFldList); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } /***********************EEC000034 End****************************/ function SYS_GetRecvCHG(strSqlWhere, strCcy) { try { strCharge = document.forms[0].SYS_CHARGE_SEL.value; var strChgCcyFlag = "EMPTY_CHG_CCY"; if (strCcy != undefined){ if (strCcy.length > 0) { strChgCcyFlag = "NEW_CHG_CCY"; document.forms[0].SYS_CHG_CCY.value = strCcy; } else { strCcy = ""; } } document.forms[0].SYS_CHG_CCY_FLAG.value = strChgCcyFlag; var thisdate = new Date(); var thistime = thisdate.getTime(); var swidth = screen.width - 10; var sheight = screen.height - 50; //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_RECV_CHG&_TRX_CHARGE=CHARGE&_SYS_CHARGE_SEL="; actionUrl+=strCharge; actionUrl+="&_SQL_WHERE=" + strSqlWhere + "&id=" + thistime + "&_SYS_CHG_CCY_FLAG=" + strChgCcyFlag + "&_SYS_CHG_CCY=" + strCcy; actionUrl = encodeUrl(actionUrl); //Frank modify End /*var openUrl = "../servlets/WSTrxManager?_TRX_STATUS=TRX_RECV_CHG&_TRX_CHARGE=CHARGE&_SYS_CHARGE_SEL=" + strCharge; openUrl += "&_SQL_WHERE=" + strSqlWhere + "&id=" + thistime + "&_SYS_CHG_CCY_FLAG=" + strChgCcyFlag + "&_SYS_CHG_CCY=" + strCcy;*/ var retValue = window.showModalDialog(actionUrl, window, "dialogWidth:1000px;dialogHeight:768px"); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_Upload_Image(param) { try { //CEV2-05-19-19 Sean.zhang 2016-3-21 START if ((typeof(UPLOAD_IMAGE_NEW) == "undefined" || !UPLOAD_IMAGE_NEW) && !(SYS_FUNCTION_TYPE == "EC" || SYS_FUNCTION_TYPE == "PM" || SYS_FUNCTION_TYPE == "MM")) { return ; } //CEV2-05-19-19 Sean.zhang 2016-3-21 END if (param != null && param.length != 0) { var strParam = ""; var paramArray = param.split("||"); for (i = 0; i < paramArray.length; i++) { obj = eval("document.forms[0]." + paramArray[i]); if (obj != null && obj.value != null && obj.value.length > 0) { strParam += paramArray[i] + "=" + obj.value + ""; if (i < paramArray.length - 1) { strParam = strParam + ";"; } } } } var thisdate = new Date(); var thistime = thisdate.getTime(); //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start //CEV2-05-19-11 WAYNE MODIFY 2015-07-03 S //var actionUrl="../servlets/WSSUploadImaging?_ACT_TYPE=ADD_IMG&id="; //CEV2-05-19-28 john.zhong 2017-05-02 S if(typeof(isHistDetail)&&isHistDetail==true){ actionUrl="../servlets/WSSUploadImaging?INQ_HIST_DETIAL=T&_ACT_TYPE=INQ_DATA&_INQ_TYPE=INQ_EDIT_DATA&id="; }else{ actionUrl="../servlets/WSSUploadImaging?_ACT_TYPE=INQ_DATA&_INQ_TYPE=INQ_EDIT_DATA&id="; } //CEV2-05-19-28 john.zhong 2017-05-02 E //CEV2-05-19-11 WAYNE MODIFY 2015-07-03 E actionUrl+=thistime + "&_SYS_UPLOADIMAGE_PARAM=" + strParam; actionUrl = encodeUrl(actionUrl); //Frank modify End //url = "../servlets/WSSUploadImaging?_ACT_TYPE=ADD_IMG&id=" + thistime + "&_SYS_UPLOADIMAGE_PARAM=" + strParam; var swidth = screen.width - 200; var sheight = screen.height - 168; var showx = (window.screen.availWidth - swidth) / 2; var showy = (window.screen.availHeight - sheight) / 2; var style = SYS_Upload_Image.arguments[1]; if(typeof(style) == "undefined"){ style = new OpenWinStyle(); style.setWidth(swidth); style.setHeight(sheight); style.setLeft(showx); style.setTop(showy); style.setScrollbars(true); //Added by satheesh for INC000002317200 on 10/10/2021 } // var wStyle = "width=" + swidth + ",height=" + sheight + ",left=" + showx + ",top=" + showy + // ",scrollbars=no,status=no,resizable=no"; openWin(actionUrl, "window", style); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_Edit_Image() { try { if (!(SYS_FUNCTION_TYPE == "EC" || SYS_FUNCTION_TYPE == "PM" || SYS_FUNCTION_TYPE == "MM")) { return ; } var swidth = screen.width - 200; var sheight = screen.height - 168; var showx = (window.screen.availWidth - swidth) / 2; var showy = (window.screen.availHeight - sheight) / 2; var wStyle = "width=" + swidth + ",height=" + sheight + ",left=" + showx + ",top=" + showy + ",scrollbars=no,status=no,resizable=no"; //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../screen/SYS_ViewImaging.jsp?_ACT_TYPE=INQ_DATA&_INQ_TYPE=INQ_EDIT_HEADER"; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../screen/SYS_ViewImaging.jsp?_ACT_TYPE=INQ_DATA&_INQ_TYPE=INQ_EDIT_HEADER"; //CEV2-01-20-01 cash 2012-12-18 s //window.open(actionUrl, "window", wStyle); openWin(actionUrl, "window", wStyle); //CEV2-01-20-01 cash 2012-12-18 e } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_View_Image() { try { var swidth = screen.width - 200; var sheight = screen.height - 168; var showx = (window.screen.availWidth - swidth) / 2; var showy = (window.screen.availHeight - sheight) / 2; var wStyle = "width=" + swidth + ",height=" + sheight + ",left=" + showx + ",top=" + showy + ",scrollbars=no,status=yes,resizable=no"; var vCMainRef = document.forms[0].C_MAIN_REF.value; //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../screen/SYS_ViewImaging.jsp?_ACT_TYPE=INQ_DATA&_INQ_TYPE=VIEW_TRX_HEADER&C_MAIN_REF=" + vCMainRef; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../screen/SYS_ViewImaging.jsp?_ACT_TYPE=INQ_DATA&_INQ_TYPE=VIEW_TRX_HEADER&C_MAIN_REF=" + vCMainRef; //CEV2-01-20-01 cash 2012-12-18 e // window.open(actionUrl, "window", wStyle); openWin(actionUrl, "window", wStyle); //CEV2-01-20-01 cash 2012-12-18 s } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function disField() { try { var obj = document.forms[0].elements; var nonDisabling = window["NON_DISABLING"]; for (var i = 0; i < obj.length; i++) { if (nonDisabling && nonDisabling[obj[i].name]) { continue; } if (obj[i].type == "text" || obj[i].type == "textarea" || obj[i].type == "button") { obj[i].readOnly = true; } else { if (obj[i].type != "hidden") { obj[i].disabled = true; } } } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function disRelField() { try { var obj = document.forms[0].elements; for (var i = 0; i < obj.length; i++) { if (obj[i].type == "text" || obj[i].type == "textarea") { obj[i].readOnly = true; } else { obj[i].disabled = true; } } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function disIframeField() { try { var obj = document.forms[0].elements; for (var i = 0; i < obj.length; i++) { if (obj[i].type == "text" || obj[i].type == "textarea") { obj[i].readOnly = true; } else { obj[i].disabled = true; } } } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function displayError(funName, e) { try { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90001, funName, e.name, e.message); _SYS_Display_ERROR(msg); // alert("function " + funName + "() exception: name=" + e.name + " message=" + e.message); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function validateEmail(obj) { try { var objText = obj.value; var reg=/^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$/i; var r = objText.match(reg); if (r == null) { // alert("check yuor email address!"); var msg = _getClientMessage(90086); _SYS_Display_WARN(msg); return false; } else { return true; } } catch (e) { displayError("SYS_ActionFunc_CAL.validateEmail", e); } } function validatePhone(obj) { try { var objText = obj.value; var reg = /^\d*[\d\-]*\d$/; var r = objText.match(reg); if (r == null) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90087); _SYS_Display_WARN(msg); // alert("check yuor phone number!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } else { return true; } } catch (e) { displayError("SYS_ActionFunc_CAL.validatePhone", e); } } function validdateChar(obj) { try { var objText = obj.value; var reg = /^[A-Za-z]+$/; var r = objText.match(reg); if (r == null) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90088); _SYS_Display_WARN(msg); // alert("check yuor input information!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } else { return true; } } catch (e) { displayError("SYS_ActionFunc_CAL.validdateChar", e); } } function SYS_GetMultiCUBK() { try { //var arguArray = new Array(arguments.length); var multiMappingName_Value = ""; var multiKeyFldName_Value = ""; var multiSucJsFuncName_Value = ""; var multiFailJsFuncName_Value = ""; for (var i = 0; i < arguments.length; i++) { var keyTemp = ""; for (var j = 0; j < arguments[i][1].length; j++) { if (document.MAINFORM.elements[arguments[i][1][j]] == null) { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90089); _SYS_Display_ERROR(msg); // alert("JS Error:[SYS_GetDropList]The key field is null.Pls check it and input again!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (document.MAINFORM.elements[arguments[i][1][j]].value == "") { // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 s var msg = _getClientMessage(90090, document.MAINFORM.elements[arguments[i][1]]); _SYS_Display_ERROR(msg); // alert("JS Error:[SYS_GetDropList]The key field[" + document.MAINFORM.elements[arguments[i][1]] + "] value is empty.Pls check it and input again!"); // CEV2-0063 edit by maliryn and Terry for client message 2007.05.31 e return false; } if (keyTemp != "") { keyTemp += "," + document.MAINFORM.elements[arguments[i][1][j]].value; } else { keyTemp = document.MAINFORM.elements[arguments[i][1][j]].value; } } if (multiMappingName_Value != "") { multiMappingName_Value += "|" + arguments[i][0]; } else { multiMappingName_Value = arguments[i][0]; } if (multiKeyFldName_Value != "") { multiKeyFldName_Value += "|" + keyTemp; } else { multiKeyFldName_Value = keyTemp; } if (arguments[i][2] != null) { if (multiSucJsFuncName_Value != "") { multiSucJsFuncName_Value += "|" + arguments[i][2]; } else { multiSucJsFuncName_Value = arguments[i][2]; } } else { if (multiSucJsFuncName_Value != "") { multiSucJsFuncName_Value += "|"; } } if (arguments[i][3] != null) { if (multiFailJsFuncName_Value != "") { multiFailJsFuncName_Value += "|" + arguments[i][3]; } else { multiFailJsFuncName_Value = arguments[i][3]; } } else { if (multiFailJsFuncName_Value != "") { multiFailJsFuncName_Value += "|"; } } } var arrParam = new Array("GETCUBKMULTI", multiMappingName_Value, multiKeyFldName_Value, multiSucJsFuncName_Value, multiFailJsFuncName_Value); SetTimeOut(arrParam); } catch (e) { DisExcpt("SYS_ActionFunc_CAL", e); } } function SYS_GetAMTFromCCY(objCCYField) { try { if (objCCYField == null) { return false; } var ccyFieldName = objCCYField.name; var ccyFieldValue = objCCYField.value; var dec = 0; for (var i = 0; i < SYS_AMT_CCY.length; i++) { if (ccyFieldName == SYS_AMT_CCY[i][0]) { dec = findDecFromCCY(ccyFieldValue); for (var j = 1; j < SYS_AMT_CCY[i].length; j++) { var objAmt = document.MAINFORM.elements[SYS_AMT_CCY[i][j]]; //CEV2-07-01-01 (CEV2-0789) john.zhong 2014-03-24 S detachObjEvent(objAmt,"onchange", initAMTEvent); attachObjEvent(objAmt,"onchange", initAMTEvent); //CEV2-07-01-01 (CEV2-0789) john.zhong 2014-03-24 E var amtValue = beFloat(objAmt.value); objAmt.value = DecimalFormat(amtValue, dec); } return ; } } } catch (e) { DisExcpt("SYS_ActionFunc", e); } } //CEV2-05-13-01 2011-10-08 (CEV2-0544) john.zhong 2011-07-27 S /* * trx template and system tempate onunload event method */ function trx_sys_templateOnunload(){ if(typeof(custOnunload)=="function"&&custOnunload!=null){ custOnunload(); return; } if(typeof(isReuseRefFlag)=="undefined"){ _SYS_reuseRefNo(); }else{ if("T"==isReuseRefFlag){ _SYS_reuseRefNo(); } } } //CEV2-05-13-01 2011-10-08 (CEV2-0544) john.zhong 2011-07-27 E function _SYS_reuseRefNo() { try { //CEV2-05-21-01(CEV2-0696) Nick Add 2011-11-21 for autoSave transaction Start if(typeof(isUnload)!= "undefined" && isUnload == true){ return; } //CEV2-05-21-01(CEV2-0696) Nick Add 2011-11-21 End //CEV2-0536 CEV2.1.1 2010-01-07 Frank Modify Start var actionUrl="../servlets/WSTrxManager?_TRX_STATUS=TRX_REFUSE_REFNO"; actionUrl = encodeUrl(actionUrl); //Frank modify End //var url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_REFUSE_REFNO"; //CEV2-07-01-22 martin 2020-03-09 s //sendRequestByAjaxPost(actionUrl, false); if(isMSIE){ sendRequestByAjaxPost(actionUrl, false); }else{ sendRequestByAjaxPost(actionUrl, true); } //CEV2-07-01-22 martin 2020-03-09 e } catch (e) { DisExcpt("SYS_ActionFunc", e); } } //CEV2-DO john.zhong 2009-07-24 S function SYS_GetDataForDO(sCUBKMappingName,status,showError,datafromDO){ try{ return getData_ajax(true,sCUBKMappingName,datafromDO,status,showError); }catch(e){ alert("[SYS_GetDataForDO Error]: "+e.expression); } } function SYS_GetDataForDO_S(sCUBKMappingName,status,showError,datafromDO){ try{ return getData_ajax(false,sCUBKMappingName,datafromDO,status,showError); }catch(e){ alert("[SYS_GetDataForDO_S Error]: "+e.expression); } } //CEV2-DO john.zhong 2009-07-24 E //CEV2-01-04-04 May 20171225 S function dealParseData(data, type){ if(typeof data != "undefined" && data != null && data != ""){ if(type=="json"){ data = eval("("+data+")"); }else if(type=="xml"){ data = XMLManager.xmlStrToDom(data); } } if(typeof setParseData == "function"){ setParseData(data); } } //CEV2-01-04-04 May 20171225 E