// $Id: BaseFunc.js,v 1.63 2011/05/18 03:52:18 yinqiaojun Exp $
/**
* global variable
*/
var nMaxTabs = 15; //Max number of tabs
var nFstTabId = 0; //First tab id
var nCurrTabId = 0; //Current tab id
var nLastTabId = 0; //Last tab id
var arrValidDataType = new Array("CHAR", "FLOAT", "INT", "AMT", "DATE", "TIME"); //valid data type
var nDefaultDec = 2; //default decimal
var isOnLoad = false; //is in on load
var isOnLoadTmpl = false; //is in on load template
var isRptFunc = false; //is report function
var isDocList = false; //is doc list avaiable
var isDisableTab = false; //is disable tab
var formKeyValue = "";
var sDoCount = 0; //count of DO records
var sInqStanType = ""; //type of standing data
var sInqSubType = ""; //sub-type of standing data
var sInqTerType = ""; //ter-type of standing data
var sInqDataId = ""; //inquire data id, used in get data setting
var sBkType = ""; //bank type, to be used in getBankDataByBIC()
var sSwAdd = ""; //SWIFT Address, to be used in getBankDataByBIC()
var sEmailGrpName = ""; //Email Group Name array, to be used to get email group
var sEmailGrpNm = "";//Email Group Name, to be used to get email
var sEmailList = ""; //Email List, to be used as EMAIL_TO
var isClauseLayer = true; //show clause in float layer
window.document.title = "Boubyan Bank - Customer Enterprise";
/**
* initial trx
*/
function _OnInit(){
try {
if(Calendar.initCalenSucc == false) {
initCalendar();
}
isOnLoad = true;
isRptFunc = isReport();
isDocList = isDocListAval();
window_onload();
// CEV2-05-58-01 hunk.han 2018-12-27 S
attachClauseLayer();
// CEV2-05-58-01 hunk.han 2018-12-27 E
genTabs();
genIcon();
$('select').change(function(){
rmNode("Template_valSummary");
})
if (window.OnInit)
OnInit(); //trx level oninit
if (SYS_FUNCTION_TYPE != "IQ" && SYS_FUNCTION_TYPE != "RE") {
allFldEvt(); //global events initialize
if (window.InitFldEvt)
InitFldEvt(); //trx events initialize
getTrxDate();
}
initButton();
disableAllProtectFld();
if (SYS_FUNCTION_TYPE == "RE" || SYS_FUNCTION_TYPE == "GE") {
genRelease();
setAuthTrxFuncDesc();
var objForm = document.forms[0];
insertHiddenField(objForm, "C_TRX_STATUS", "");
insertHiddenField(objForm, "C_IS_AGREE", "Y");
}
if (SYS_FUNCTION_TYPE == "IQ" || SYS_FUNCTION_TYPE == "RE") {
showTrxTabsOnly();
disablePage(document.forms[0].name);
if (SYS_FUNCTION_TYPE == "IQ") {
var btnConfirm = document.getElementById("prim_confirm");
var btnCancel = document.getElementById("sec_cancel");
if (btnConfirm != "undefined" && btnConfirm != null) {
document.getElementById("prim_confirm").style.display = "none";
}
if (btnCancel != "undefined" && btnCancel != null) {
document.getElementById("sec_cancel").disabled = false;
}
if (isDocList) {
initDocList();
if (document.getElementById("DOC_LIST")) {
document.getElementById("DOC_LIST").disabled = false;
}
}
}
}
if (SYS_FUNCTION_TYPE == "DM" || SYS_FUNCTION_TYPE == "XM") {
disableAllFld();
hiddenAllIcoButton();
//Martin 20121102 s
disableAMTFld();
//e
}
isOnLoad = false;
if (window.FinalInit)
FinalInit(); //trx level oninit
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-do L&F john.zhong 2009-11-17 S
function _SubPage_Oninit(){
try {
genIcon();
if (window.OnInit)
OnInit()
if (SYS_FUNCTION_TYPE != "IQ" && SYS_FUNCTION_TYPE != "RE") {
allFldEvt();
if (window.InitFldEvt)
InitFldEvt();
}
initButton();
disableAllProtectFld();
//CEV2-do cross browser john.zhong 2013-12-11 S
window.loadOk = true;
//CEV2-do cross browser john.zhong 2013-12-11 E
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-do L&F john.zhong 2009-11-17 E
/**
* hidden all ico button like help button and calendar button
*/
function hiddenAllIcoButton(){
try {
var allFlds = document.forms[0].elements;
for (var i = 0; i < allFlds.length; i++) {
var fldClass = allFlds[i].className;
if (fldClass.indexOf("ICO_") != -1) {
hideButton(allFlds[i].id);
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* submit trx
*/
function _Confirm(){
try {
convToUpperCase();
//trx level validation rules
if (window.ChkTrxData) {
if (!ChkTrxData())
return false;
}
if (!chkDataFmt())
return false; //global level validation rules
if (window.ConfirmTrx) {
ConfirmTrx();
} //trx level business function
//use postFormByAjax Eddy start
// _submit(); //system level submit, controlled by core system
SYS_CONVERT_SYSTEM_DATE();
//CEV2-0536 CEV2.1.1 2010-01-05 Frank Modify Start
var actionUrl="../servlets/WSTrxManager";
if(window.isPopUpWindow&&isPopUpWindow){
actionUrl=actionUrl+"?POP=Y";
}
actionUrl=encodeUrl(actionUrl);
//Frank modify End
document.MAINFORM.action = actionUrl;
document.MAINFORM.method = "post";
//CEV211-DO john.zhong
if (isDO) {
var doData = self.parent.window.getSubmitDOData();
var dataPara = "DO_DATA=" + doData + "&AjaxPost=T";
//alert(dataPara);
document.MAINFORM.target = "_top";
postFormByAjax(document.MAINFORM, furtherConfirm, dataPara);
}
else {
postFormByAjax(document.MAINFORM, furtherConfirm);
}
//use postFormByAjax;Eddy end
}
catch (e) {
showExcpt("BaseFunc", e);
if (e == "E200") {
SYS_Convert_AllDate2CustomFormat();
if (typeof(SYS_NOT_CONFIRM) != "undefined") {
SYS_NOT_CONFIRM = true;
}
}
}
}
//CEV2-dataobject john.zhong 2010-01-05 S
function collectDoData(){
if (typeof(isDO) != "undefined" && isDO) {
var doData = self.parent.window.getSubmitDOData();
document.MAINFORM.DO_DATA.value = doData;
document.MAINFORM.target = "_top";
}
}
//CEV2-dataobject john.zhong 2010-01-05 E
//Start: data format setting
function onAfterPaste(evt){
try {
var obj = getEvtTarget(evt);
var sFldNm = obj.id;
if (window.attachEvent) {
setTimeout(function(){
chkPaste(sFldNm);
}, 1);
}
else
if (window.addEventListener) {
chkPaste(sFldNm);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* This is for formating data and set global events for field.
*/
//To init global events
attachObjEvent(document, "onkeydown", chkKeyDown);
attachObjEvent(document, "onkeyup", chkKeyUp);
attachObjEvent(document, "onclick", chkClick);
function allFldEvt(){
try {
var oMainForm = document.forms["MAINFORM"];
var nElement = oMainForm.elements.length;
var oFld = null;
var sType = "";
var sClassNm = "";
var arrClassNm = "";
var sDataType = "";
var sFldType = "";
_SYS_Batch_DecimalFormat();
for (var nLoop = 0; nLoop < nElement; nLoop++) {
oFld = oMainForm.elements[nLoop];
sType = oFld.type;
//CEV2-07-08-01 wayne modify 2015-12-02 s
if(sType == "select-one"){
continue;
}
//CEV2-07-08-01 wayne modify 2015-12-02 e
sClassNm = oFld.className;
arrClassNm = oFld.className.split("_");
sDataType = arrClassNm[0];
sFldType = arrClassNm[1];
if (arrValidDataType.in_array(sDataType)) {
attachObjEvent(oFld, "onfocus", chkFocus);
attachObjEvent(oFld, "onblur", chkBlur);
}
if (sDataType == "DATE") {
oFld.setAttribute("size", "10");
oFld.setAttribute("maxlength", "10");
if (window.attachEvent) {
attachObjEvent(oFld, "onpaste", onAfterPaste);
}
else
if (window.addEventListener) {
attachObjEvent(oFld, "oninput", onAfterPaste);
}
attachObjEvent(oFld, "onselect", chkSelect);
}
if (sDataType == "AMT") {
oFld.setAttribute("size", "20");
oFld.setAttribute("maxlength", "20");
if (window.attachEvent) {
attachObjEvent(oFld, "onpaste", onAfterPaste);
}
else
if (window.addEventListener) {
attachObjEvent(oFld, "oninput", onAfterPaste);
}
attachObjEvent(oFld, "onselect", chkSelect);
attachObjEvent(oFld, "onchange", _SYS_Batch_DecimalFormat);
//attachObjEvent(oFld, "onblur", _SYS_Batch_DecimalFormat);
attachObjEvent(oFld, "onblur", formatAndShow);
}
if (sDataType == "FLOAT") {
oFld.setAttribute("size", "7");
oFld.setAttribute("maxlength", "7");
if (window.attachEvent) {
attachObjEvent(oFld, "onpaste", onAfterPaste);
}
else
if (window.addEventListener) {
attachObjEvent(oFld, "oninput", onAfterPaste);
}
}
if (sDataType == "INT") {
oFld.value = beInt(oFld.value);
if (window.attachEvent) {
attachObjEvent(oFld, "onpaste", onAfterPaste);
}
else
if (window.addEventListener) {
attachObjEvent(oFld, "oninput", onAfterPaste);
}
}
if (sDataType == "CHAR") {
if (window.attachEvent) {
attachObjEvent(oFld, "onpaste", onAfterPaste);
}
else
if (window.addEventListener) {
attachObjEvent(oFld, "oninput", onAfterPaste);
}
}
//assign showHelpTip() to help tip icons
if (sClassNm == "ICO_HELPTIP") {
attachObjEvent(oFld, "onmouseover", showHelpTip);
if (isMSIE) {
oFld.title = "";
}
else
if (isMozilla) {
oFld.title = " ";
}
}
}
//attach _SYS_Batch_DecimalFormat to currency fields
var nSYS_AMT_CCYLen = SYS_AMT_CCY.length;
for (var j = 0; j < nSYS_AMT_CCYLen; j++) {
var sCCYFldNm = SYS_AMT_CCY[j][0];
var oCCYFld = document.getElementById(sCCYFldNm);
if (oCCYFld) {
attachObjEvent(oCCYFld, "onchange", amtOnchange);
fireObjEvent(oCCYFld,"onchange");
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//martin add for amtformat s
function amtOnchange(evt){
var obj = getEvtTarget(evt);
var dec = findDecFromCCY(obj.value, "AMT");
if (typeof(dec) != "undefind" && dec != null && dec != "") {
window.nDefaultDec = dec;
}
_SYS_Batch_DecimalFormat();
Cal_CCY_DESCRIPTION();
}
//martin add e
/**
* Convert string to amount
*
* @param string Field name
*/
function convStrToAmt(sFldNm){
try {
var obj = document.getElementById(sFldNm);
var sFldType = getFldType(obj.id);
var sAmt = obj.value;
var nAmt = _SYS_getCustFMTFloat(sFldNm);
if (sFldType != "P") {
if (nAmt == 0) {
obj.value = "";
}
else {
obj.value = nAmt;
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert amount to string
*
* @param string Field name
*/
function convAmtToStr(sFldNm){
try {
_SYS_convFld2SysFMT(sFldNm);
_SYS_Conv2CustAmtFMT(sFldNm);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* The value must to be in integer
*
* @param string value
*/
function beInt(Value){
try {
var sValue = String(Value);
var nInt = 0;
if (sValue.length == 0 || sValue == null) {
return nInt;
}
var nValue = SYS_BeFloat(sValue);
nValue = Math.floor(nValue);
nInt = parseInt(nValue);
return nInt;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Add onchange event for field
*
* @param string Field name
*/
function addOnChange(sFldNm){
try {
var oFld = document.getElementById(sFldNm);
var sOnChange = sFldNm + "_OnChange";
if (oFld)
attachObjEvent(oFld, "onchange", eval(sOnChange));
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Add onblur event for field
*
* @param string Field name
*/
function addOnBlur(sFldNm){
try {
var oFld = document.getElementById(sFldNm);
var sOnBlur = sFldNm + "_OnBlur";
if (oFld)
attachObjEvent(oFld, "onblur", eval(sOnBlur));
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Add onclick event for field
*
* @param string Field name
*/
function addOnClick(sFldNm){
try {
var oFld = document.getElementById(sFldNm);
var sOnClick = sFldNm + "_OnClick";
if (oFld)
attachObjEvent(oFld, "onclick", eval(sOnClick));
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-05-58-01 2019-04-04 hunk.han S remove onclick event for field
function removeOnClick(sFldNm) {
var oFld = document.getElementById(sFldNm);
var sOnClick = sFldNm + "_OnClick";
if(oFld) {
detachObjEvent(oFld, "onclick", eval(sOnClick));
}
}
//CEV2-05-58-01 2019-04-04 hunk.han E
/**
* Add onfocus event for field
*
* @param string Field name
*/
function addOnFocus(sFldNm){
try {
var oFld = document.getElementById(sFldNm);
var sOnFocus = sFldNm + "_OnFocus";
if (oFld)
attachObjEvent(oFld, "onfocus", eval(sOnFocus));
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Control buttons
*/
function initButton(){
try {
//for trx only
if (document.getElementById("TrxSysBtnsDiv")) {
GenTrxSysBtns();
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Hide button
*
* @comment Can be instead by hideObj()
*/
function hideButton(sBtnNm){
try {
hideObj(sBtnNm);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Hide object
*
* @param string Object name
*/
function hideObj(sObjNm){
try {
document.getElementById(sObjNm).style.visibility = "hidden";
document.getElementById(sObjNm).style.display = "none";
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Hide object with style.visibility: hidden
*
* @param string Object name
*/
function hiddenVisibilityObj(sObjNm){
try {
document.getElementById(sObjNm).style.visibility = "hidden";
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Show object
*
* @param string Object name
*/
function showObj(sObjNm){
try {
document.getElementById(sObjNm).style.visibility = "visible";
document.getElementById(sObjNm).style.display = "";
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//Start: prototype for object
String.prototype.rTrim = rTrim;
function rTrim(){
try {
var orgStr = this.toString();
var str = orgStr;
var sStrLen = str.length;
while (sStrLen > 0) {
if (str.charAt(sStrLen - 1) != " ") {
break;
}
str = str.substring(0, sStrLen - 1);
}
return str;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
String.prototype.lTrim = lTrim;
function lTrim(){
try {
var orgStr = this.toString();
var str = orgStr;
var nStrLen = str.length;
while (nStrLen > 0) {
if (str.charAt(0) != " ") {
break;
}
str = str.substring(1, nStrLen);
}
return str;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
String.prototype.trim = trim;
function trim(){
try {
return this.replace(/(^\s*)|(\s*$)/g, "");
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert string to chars array
* Usage: convStrToCharsArray(isRmDup)
*
* @param boolean Is remove duplicate?
* @return array
*/
String.prototype.convStrToCharsArray = convStrToCharsArray;
function convStrToCharsArray(isRmDup){
try {
var arrChars = new Array();
var sStr = String(this);
var nStrLen = sStr.length;
for (var i = 0; i < nStrLen; i++) {
var sChar = sStr.substr(i, 1);
if (isRmDup) {
if (!arrChars.in_array(sChar)) {
arrChars.push(sChar);
}
}
else {
arrChars.push(sChar);
}
}
return arrChars;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Remove duplicate characters from string
* Usage: string_unique()
*
* @return string
*/
String.prototype.string_unique = string_unique;
function string_unique(){
try {
var sStr = String(this);
var nStrLen = sStr.length;
var sTmp = "";
for (var i = 0; i < nStrLen; i++) {
if (sTmp.indexOf(sStr.substr(i, 1)) == -1) {
sTmp = sTmp + sStr.substr(i, 1);
}
}
return sTmp;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert string to charcodes array
* Usage: convStrToCharCodesArray(isRmDup)
*
* @param boolean Is remove duplicate?
* @return array
*/
String.prototype.convStrToCharCodesArray = convStrToCharCodesArray;
function convStrToCharCodesArray(isRmDup){
try {
var arrCharCodes = new Array();
var sStr = String(this);
var nCharCode = -1;
if (isRmDup) {
sStr = sStr.string_unique();
}
var nStrLen = sStr.length;
for (var i = 0; i < nStrLen; i++) {
nCharCode = sStr.substr(i, 1).charCodeAt();
arrCharCodes.push(nCharCode);
}
return arrCharCodes;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Check if a value exist in an array
* Usage: in_array(compareValue)
*
* @param string Specifies a value that check it exist in an array
* @return boolean whether the value exist in the array or not
*/
Array.prototype.in_array = in_array;
function in_array(compareValue){
try {
var nArrLen = this.length;
for (var i = 0; i < nArrLen; i++) {
if (this[i] == compareValue)
return true;
}
return false;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Searches the array for a given value and returns the corresponding key if successful
* Usage: array_search(Value)
*
* @param string Specifies a value that check it exist in an array
* @return numeric index value or false
*/
Array.prototype.array_search = array_search;
function array_search(Value){
try {
var nArrLen = this.length;
for (var i = 0; i < nArrLen; i++) {
if (this[i] == Value)
return i;
}
return false;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Remove elements from array by given value
* Usage: array_unset(Value)
*
* @param Value Specifies a value to be removed in an array, value can be in string or numeric
* @return array
*/
Array.prototype.array_unset = array_unset;
function array_unset(Value){
try {
var arrTmp = new Array();
var arrLen = this.length;
for (var i = 0; i < arrLen; i++) {
if (this[i] != Value) {
arrTmp.push(this[i]);
}
}
return arrTmp;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Count number of given value in array
* Usage: array_count_values(Value)
*
* @param Value Specifies a value to be counted in an array, value can be in string or numeric
* @return array
*/
Array.prototype.array_count_values = array_count_values;
function array_count_values(Value){
try {
var nCount = 0;
var nArrLen = this.length;
for (var i = 0; i < nArrLen; i++) {
if (this[i] == Value)
nCount++;
}
return nCount;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Split array by given value
* Usage: array_chunk(Value)
*
* @param Value Specifies a value to be splitted in an array, value can be in string or numeric
* @return array a 2 dimensional array
*/
Array.prototype.array_chunk = array_chunk;
function array_chunk(Value){
try {
var nArrLen = this.array_count_values(Value) + 1;
var arrTmp = new array2D(nArrLen, 1);
var nIdxTmp = 0;
//remove first element, its empty.
for (var n = 0; n < nArrLen; n++) {
arrTmp[n] = arrTmp[n].slice(1);
}
var nArrLen = this.length;
for (var i = 0; i < nArrLen; i++) {
if (this[i] != Value) {
arrTmp[nIdxTmp].push(this[i]);
}
else {
nIdxTmp++;
}
}
return arrTmp;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert char codes array to string
* Usage: convCharCodesToString(isRmDup)
*
* @param boolean Is remove duplicate?
* @return array
*/
Array.prototype.convCharCodesToString = convCharCodesToString;
function convCharCodesToString(isRmDup){
try {
var sStr = "";
if (isRmDup) {
var arrChars = this.array_unset();
}
else {
var arrChars = this;
}
var nArrLen = arrChars.length;
for (var i = 0; i < nArrLen; i++) {
if (typeof(arrChars[i]) == "number") {
var sChar = String.fromCharCode(arrChars[i]);
sStr = sStr + sChar;
}
}
return sStr;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Compare charcodes array with filter and reture a charcodes array within filter array.
* The filter array is legal charcodes set. If the filter array is illegal charcodes, set
* isIllegal to true.
* Usage: chkCharCodesWithFilter()
*
* @param string Filter type, legal or illegal.
* @return array
*/
Array.prototype.chkCharCodesWithFilter = chkCharCodesWithFilter;
function chkCharCodesWithFilter(arrFilter, sFilterType){
try {
var arrValidTypes = new Array("legal", "illegal");
var arrIllegalCharCodes = new Array();
var nArrLen = this.length;
if (!arrValidTypes.in_array(sFilterType)) {
sFilterType = "legal";
}
if (sFilterType == "legal") {
for (var i = 0; i < nArrLen; i++) {
var nCharCode = this[i];
if (!arrFilter.in_array(nCharCode)) {
arrIllegalCharCodes.push(nCharCode);
}
}
}
if (sFilterType == "illegal") {
for (var i = 0; i < nArrLen; i++) {
var nCharCode = this[i];
if (arrFilter.in_array(nCharCode)) {
arrIllegalCharCodes.push(nCharCode);
}
}
}
return arrIllegalCharCodes;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//End: prototype for object
/**
* For disable protected fields when initial transaction
*/
function disableAllProtectFld(){
try {
var oMainForm = document.forms["MAINFORM"];
var form_length = oMainForm.elements.length;
for (var i = 0; i < form_length; i++) {
var classNm = oMainForm.elements[i].className;
var arrclassNm = classNm.split("_");
var sType = arrclassNm[1];
var objType = oMainForm.elements[i].type;
if (sType == "P") {
if (objType == "text" || objType == "textarea") {
oMainForm.elements[i].readOnly = true;
}
else {
oMainForm.elements[i].disabled = true;
}
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Set all fields to read only
* select, button, checkbox and radio set to disabled
*/
function disableAllFld(){
try {
var oMainForm = document.forms["MAINFORM"];
var form_length = oMainForm.elements.length;
for (var i = 0; i < form_length; i++) {
var typeNm = oMainForm.elements[i].type;
oMainForm.elements[i].readOnly = true;
if (typeNm == "select-one" ||
typeNm == "checkbox" ||
typeNm == "radio") {
oMainForm.elements[i].disabled = true;
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Disable field
*
* @param string/obj Field name or object
* @param string 0 or 1
*/
function disableFld(Field, nClsFlag){
try {
var oFld = "";
var sFldNm = "";
if (typeof(Field) == "string") {
oFld = document.getElementById(Field);
sFldNm = Field;
}
else
if (typeof(Field) == "object") {
oFld = Field;
sFldNm = oFld.id;
}
if (!oFld)
return;
var sClass = new String(oFld.className);
var arrClass = sClass.split("_");
var sDataType = arrClass[0];
var sFldType = getFldType(sFldNm);
sClass = sClass.substr(0, (sClass.length - 1)) + "P";
oFld.className = sClass;
if (nClsFlag == undefined) {
nClsFlag = 0;
}
nClsFlag = beInt(nClsFlag);
if (nClsFlag == 1 && !isOnLoad) {
setFldValue(sFldNm, "");
fireObjEvent(oFld, "onchange")
}
var typeNm = oFld.type;
if (typeNm == "select-one" || typeNm == "button" ||
typeNm == "checkbox" ||
typeNm == "radio") {
oFld.disabled = true;
}
else {
oFld.readOnly = true;
}
if (sDataType == "DATE" && sFldType != "P") {
var sIconNm = "ICO_" + sFldNm;
if(document.getElementById(sIconNm)){
hideObj(sIconNm);
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Enable field
*
* @param string/obj Field name or object
* @param string M or O
*/
function enableFld(Field, sStatus){
try {
var oFld = "";
if (typeof(Field) == "string") {
oFld = document.getElementById(Field);
sFldNm = Field;
}
else
if (typeof(Field) == "object") {
oFld = Field;
sFldNm = oFld.id;
}
if (!oFld)
return;
var sClass = oFld.className;
var arrClass = sClass.split("_");
var sDataType = arrClass[0];
//Martin.yin add for not send the parameter sStatus 20120813S
if(typeof(sStatus)=="undefined"){
sStatus = arrClass[1];
}
//End
sClass = sClass.substr(0, (sClass.length - 1)) + sStatus;
oFld.className = sClass;
if (SYS_FUNCTION_TYPE != "IQ" && SYS_FUNCTION_TYPE != "RE") {
oFld.removeAttribute("disabled");
oFld.removeAttribute("readOnly");
}
if (sDataType == "DATE") {
var sIconNm = "ICO_" + sFldNm;
showObj(sIconNm);
}
if (sDataType == "AMT") {
convAmtToStr(sFldNm);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Calculate the date by a date plus days
*
* @param string date field name
* @param integer number of days
*
* @return object the date object
*/
function calDtByDays(sFldNm, nDays){
try {
var oDt = getFldValue(sFldNm);
oDt = SYS_CONVERT_OBJ_SYSTEM_DATE(oDt);
var msPerDay = 24 * 60 * 60 * 1000;
var nDays = beInt(nDays);
var nNewDate = oDt.getTime() + (msPerDay * nDays);
var oNewDate = new Date();
oNewDate.setTime(nNewDate);
return oNewDate;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Calculate the date by a date plus months
*
* @param string date field name
* @param integer number of months
* @param string F (forward) or B (backward)
*
* @return object the date object
*/
function calDtByMonths(sFldNm, nMonths, sFBFlag){
try {
var oDt = getFldValue(sFldNm);
var nMonths = beInt(nMonths);
var nY = oDt.getFullYear();
var nM = oDt.getMonth() + 1;
var nD = oDt.getDate();
nY = nY + Math.floor((nM + nMonths) / 12);
nM = (nM + nMonths) % 12;
if (nM == 0) {
nY = nY - 1;
nM = 12;
}
if (sFBFlag != "F") {
sFBFlag = "B";
}
var arrMM = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
var arrBigMM = new Array(1, 3, 5, 7, 8, 10, 12);
var arrSmallMM = new Array(4, 6, 9, 11);
var bInvalidDt = false;
//Feb
if (nM == 2) {
if (((nY % 4 == 0) && (nY % 100 != 0)) || (nY % 400 == 0)) {
if (nD > 29) {
nD = 29;
bInvalidDt = true;
}
}
else {
if (nD > 28) {
nD = 28;
bInvalidDt = true;
}
}
if (sFBFlag == "F" && bInvalidDt) {
nD = 1;
nM = nM + 1;
if (nM > 12) {
nY = nY + 1
nM = 1
}
}
}
else {
//30 days in this month
if ((arrSmallMM.in_array(nM)) && (nD > 30)) {
nD = 30;
bInvalidDt = true;
}
if (sFBFlag == "F" && bInvalidDt) {
nD = 1;
nM = nM + 1;
if (nM > 12) {
nY = nY + 1
nM = 1
}
}
}
var oNewDt = new Date(nY, nM - 1, nD, 0, 0, 0, 0);
return oNewDt;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//Start: for control div tab
/**
* Show Tab by object or tab id
*
* @param object/string object or div id
*/
function showTab(e){
try {
var sId = "";
if (typeof(e) == "string") {
sId = e;
}
else {
var obj = getEvtTarget(e);
if (typeof(obj) == "undefined") {
return;
}
var sTabId = obj.id;
var arrTabId = sTabId.split("_");
sId = arrTabId[0];
}
nCurrTabId = sId;
for (var i = 0; i < nMaxTabs; i++) {
var sTabDivId = i + "_div";
var scellTabId = i + "_tab";
if (i == sId) {
showElmById(sTabDivId, 1);
//setElmColorById(scellTabId, "#D22630"); //Added by Praveen - For Tab Font Color-#ED1C24
//S 20210216 above line comented and below code added for LF George
var styleElm = document.getElementById(scellTabId);
if (styleElm) {
styleElm.className = 'selectedTab';
}
//E 20210216 LF George
//CEV2-DO john.zhong 2009-08-26 S
if (typeof(resizeDoPanel) == "function") {
var doName = document.getElementById(sTabDivId).getAttribute("doName");
if (doName) {
resizeDoPanel(doName);
}
}
//CEV2-DO john.zhong 2009-08-26 E
if (typeof(refreshDO) == "function") {
refreshDO(i);
}
}
else {
showElmById(sTabDivId, -1);
//setElmColorById(scellTabId, "#230004"); //Added by Praveen - For Tab Font Color
//S 20210216 above line comented and below code added for LF George
var styleElm = document.getElementById(scellTabId);
if (styleElm) {
styleElm.className = 'tab';
}
//E 20210216 LF George
}
}
//generate trx buttons
if (window.GenTrxSysBtns) {
GenTrxSysBtns();
//CEV2-05-19-12 bruce.zhou 2014-6-20 S
if (isDocList) {
initDocList();
}
//CEV2-05-19-12 bruce.zhou 2014-6-20 E
}
if (window.GenRelSysBtns) {
parent.GenRelSysBtns(nCurrTabId);
}
//20190304 DORA CEV2-01-03-20 3.3BUG2 S
changeSecuTabStyle(sId);
//20190304 DORA CEV2-01-03-20 3.3BUG2 E
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//id: element tag id
//show: 1 block
// 0 hide
// -1 none
function showElm(elm, show){
try {
if (elm) {
if (show == 1 && elm.style.display != "block") {
elm.style.display = "block";
}
else
if (show == 0 && elm.style.display != "hide") {
elm.style.display = "hide";
}
else
if (show == -1 && elm.style.display != "none") {
elm.style.display = "none";
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function showElmById(elmid, show){
try {
showElm(document.getElementById(elmid), show);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function setElmColor(elm, clr){
try {
if (elm)
elm.style.color = clr;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function setElmColorById(elmid, clr){
try {
setElmColor(document.getElementById(elmid), clr);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function setElmColorByClass(elmid, classNm){
try {
if (elmid)
elmid.className = classNm;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//End: for control div layer
/**
* Get header for each screen
*/
function getHeader(elementID, headerNm){
try {
////not generate header for inbox catalog
if (typeof(_ACT_TYPE)!="undefined"&&_ACT_TYPE=="CATA_INBOX"&&typeof(SYS_ORG_FUNCTION_NAME)=="undefined") {
return;
}
if (elementID.length == 0 || headerNm == "null" || headerNm == null) {
headerNm = "";
//return false;
}
//change headerNm if this is fix pending
if (window.SYS_FUNCTION_TYPE) {
if (SYS_FUNCTION_TYPE == "EC" && window.SYS_ORG_FUNCTION_NAME) {
headerNm = "Modify " + getFuncDescByFuncNm(SYS_ORG_FUNCTION_NAME);
}
if (SYS_FUNCTION_TYPE == "IQ" && window.SYS_ORG_FUNCTION_NAME) {
headerNm = getFuncDescByFuncNm(SYS_ORG_FUNCTION_NAME);
//The STP func is not in FAP
if (headerNm == undefined) {
headerNm = SYS_ORG_FUNCTION_NAME;
if(window.SYS_ORG_FUNCTION_DESC){
headerNm = SYS_ORG_FUNCTION_DESC;
}
}
}
if (SYS_FUNCTION_TYPE == "RE"){
headerNm = setAuthTrxFuncDesc();
if (headerNm == undefined) {
headerNm = selFuncDesc;
}
}
}
var obj = document.getElementById(elementID);
if (obj) {
obj.innerHTML = headerNm;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Generate random reference number, the length is CHAR(20)
* This is very useful if the main ref is only for system purpose.
*
* @return string return a random reference
*/
function genMainRef(){
try {
var sDt = SYS_BUSI_DATE.replace(/-/g, "").substr(2, 6);
var sTime = SYS_TIME.replace(/:/g, "").substr(0, 4);
var sPrefix = sDt + sTime;
var sRnd = Math.random().toString().replace(/\./g, "");
var n = sRnd.substr(sRnd.length - 1, 1);
var sSufix = sRnd.substr(n, 6);
var sMainRef = sPrefix + sSufix;
if (sMainRef.length < 16) {
var sRnd2 = Math.random().toString().replace(/\./g, "");
var sK = sRnd2.substr(0, 16 - sMainRef.length);
sMainRef += sK;
}
return sMainRef;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert date string to date object, support custom date format
*
* @param string the date string in custom date format
* @return object return a date object
*/
function convDtStrToObj(strDt){
try {
return SYS_CONVERT_OBJ_SYSTEM_DATE(strDt);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert date object to date string, support custom date format
*
* @param object the date object
* @return string return a date string in custom date format
*/
function convDtObjToStr(objDt){
try {
return SYS_CONVERT_OBJ_DISPLAY_DATE(objDt);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Is date 1 later than date 2?
*
* @param string the date 1 field name
* @param string the date 2 field name
* @return boolean if day 1 is later than date 2, return true
*/
function isDt1LaterDt2(sDtFldNm1, sDtFldNm2){
try {
var oDt1 = getFldValue(sDtFldNm1);
var oDt2 = getFldValue(sDtFldNm2);
var date1 = SYS_CONVERT_OBJ_SYSTEM_DATE(oDt1);
var date2 = SYS_CONVERT_OBJ_SYSTEM_DATE(oDt2);
if (date1.getTime() > date2.getTime()) {
//if (oDt1 > oDt2) {
return true;
}
else {
return false;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Is date 1 equal date 2?
*
* @param string the date 1 field name
* @param string the date 2 field name
* @return boolean if day 1 is qeual date 2, return true
*/
function isDt1EqualDt2(sDtFldNm1, sDtFldNm2){
try {
var oDt1 = getFldValue(sDtFldNm1);
var oDt2 = getFldValue(sDtFldNm2);
//carly 20180718 S
var date1 = SYS_CONVERT_OBJ_SYSTEM_DATE(oDt1);
var date2 = SYS_CONVERT_OBJ_SYSTEM_DATE(oDt2);
if (date1.getTime() == date2.getTime()) {
//carly 20180718 E
return true;
}
else {
return false;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Get days between two dates
*
* @param string start date field name
* @param string end date field name
* @return numeric number of days
*/
function getDaysBetween(sStrDtFldNm, sEndDtFldNm){
try {
var oStrDt = getFldValue(sStrDtFldNm);
var oEndDt = getFldValue(sEndDtFldNm);
var nDays = 0;
nDays = (oEndDt - oStrDt) / (1000 * 60 * 60 * 24);
return nDays;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Get JavaScript functin name
* If browser support arguments.callee.name then not required, but IE
* dont support it, only firefox.
*/
function getFuncName(){
try {
//var sFunc = arguments.callee.toString();
var sFunc = getFuncName.caller.toString();
var sFuncNm = "";
sFuncNm = "." + sFunc.substring(sFunc.indexOf(" ") + 1, sFunc.indexOf("("));
return sFuncNm;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Show JavaScript exception
*/
function showExcpt(sJSFileNm, e){
try {
var sFunc = showExcpt.caller.toString();
var sFuncNm = "";
var sExcptMsg = "";
sFuncNm = sFunc.substring(sFunc.indexOf(" ") + 1, sFunc.indexOf("("));
sExcptMsg = "Please print this screen and contact Bank on the Email Support listed above for assistance.
" +
"- File : " +
sJSFileNm +
".js
" +
"- Function : " +
sFuncNm +
"
" +
"- Exception name : " +
e.name +
"
" +
"- Exception message : " +
e.message;
showMsg(sExcptMsg, "An unexpected error has occurred.");
}
catch (e) {
alert(e);
}
}
/**
* Get field value
*
* @param string Field name
* @return X depend on the field data type
*/
function getFldValue(sFldNm){
try {
var FldValue = "";
if (sFldNm.length == 0) {
return FldValue;
}
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return;
}
var sClassNm = oFld.className;
var arrClassNm = oFld.className.split("_");
var sDataType = arrClassNm[0];
FldValue = oFld.value;
if (sDataType == "AMT" || sDataType == "FLOAT") {
FldValue = _SYS_getSysFMTNum(sFldNm);
}
else
if (sDataType == "INT") {
FldValue = beInt(FldValue);
}
else
if (sDataType == "DATE") {
if (FldValue.length == 0 || FldValue == false) {
FldValue = "";
}
else {
//CEV2-02-17-12 bruce modify 2017-02-06 s
//oFld.value = convDtObjToStr(FldValue);
/*if(typeof(FldValue) == "string"){
var dateArr = FldValue.split("-");
if(dateArr.length == 3){
oFld.value = convDtObjToStr(new Date(dateArr[0],dateArr[1]-1,dateArr[2]));
}
}
//CEV2-02-17-12 bruce modify 2017-02-06 e
else{
oFld.value = convDtObjToStr(FldValue);
}*/
}
}
else
if (sDataType == "CHAR") {
if (FldValue == "undefined") {
FldValue = "";
}
}
return FldValue;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Get field title, i.e. field description
*
* @param string Field name
* @return string Field title
*/
function getFldTitle(sFldNm){
try {
var sFldTitle = "";
if (sFldNm.length == 0) {
return sFldTitle;
}
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return;
}
if (oFld.type=="hidden") {
return;
}
sFldTitle = oFld.title;
if (sFldTitle.length == 0) {
sFldTitle = oFld.name;
}
return sFldTitle;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Set field value
*
* @param string Field name
* @return X Field value, depend on the field data type
*/
function setFldValue(sFldNm, FldValue){
try {
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return;
}
var sDataType = getFldDataType(sFldNm);
if (sDataType == "AMT") {
oFld.value = FldValue;
convAmtToStr(sFldNm);
}
else
if (sDataType == "FLOAT") {
oFld.value = FldValue;
//IE stop event here.
if (window.event) {
fireObjEvent(oFld, "onchange");
}
}
else
if (sDataType == "INT") {
oFld.value = beInt(FldValue);
//IE stop event here.
if (window.event) {
fireObjEvent(oFld, "onchange");
}
}
else
if (sDataType == "DATE") {
if (typeof(FldValue) == "undefined" || FldValue.length == 0) {
oFld.value = "";
}
else {
//CEV2-02-17-12 bruce modify 2017-02-06 s
//oFld.value = convDtObjToStr(FldValue);
if(typeof(FldValue) == "string"){
var dateArr = FldValue.split("-");
if(dateArr.length == 3){
oFld.value = convDtObjToStr(new Date(dateArr[0],dateArr[1]-1,dateArr[2]));
}
}else{
oFld.value = convDtObjToStr(FldValue);
}
//CEV2-02-17-12 bruce modify 2017-02-06 e
}
}
else
if (sDataType == "CHAR") {
oFld.value = FldValue;
}
else {
//for no class setting
oFld.value = FldValue;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* get field data type
*
* @param string Field name
* @return string Data type
*/
function getFldDataType(sFldNm){
try {
var sDataType = "";
if (sFldNm.length == 0) {
return sDataType;
}
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return false;
}
if (oFld.className) {
var sClassNm = oFld.className;
var arrClassNm = oFld.className.split("_");
sDataType = String(arrClassNm[0]);
}
return sDataType;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* get field type
*
* @param string Field name
* @return string M/O/P
*/
function getFldType(sFldNm){
try {
var sFldType = "";
if (sFldNm.length == 0) {
return sFldType;
}
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return false;
}
if (oFld.className) {
var sClassNm = oFld.className;
var arrClassNm = oFld.className.split("_");
sFldType = String(arrClassNm[1]);
}
return sFldType;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* get field charset
*
* @param string Field name
* @return string charset
*/
function getFldCharSet(sFldNm){
try {
var sCharSet = "";
if (sFldNm.length == 0) {
return sCharSet;
}
var oFld = document.getElementById(sFldNm);
if (!oFld) {
return false;
}
if (oFld.getAttribute("charset")) {
sCharSet = oFld.getAttribute("charset");
}
return sCharSet;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* create a 2 dimensional array
*
* @param numeric x dimension
* @param numeric y dimension
*
* @return array 2 dimensional array
*/
function array2D(x, y){
try {
this.length = x;
this.x = x;
this.y = y;
for (var i = 0; i < this.length; i++) {
this[i] = new Array(y);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Generate tabs
*/
var arrDivTabs = new array2D(nMaxTabs, 2);
function genTabs(){
try {
arrDivTabs = new array2D(nMaxTabs, 2);
var nIdx = 0;
//generate tabs array
for (var i = 0; i < nMaxTabs; i++) {
var sDivId = i + "_div";
var oDiv = document.getElementById(sDivId);
if (oDiv && oDiv.style.display!="none") {
var sDivTitle = oDiv.title;
//keep tab id
arrDivTabs[nIdx][0] = i;
//keep tab description
if (sDivTitle.length > 0) {
arrDivTabs[nIdx][1] = oDiv.title;
}
else {
arrDivTabs[nIdx][1] = "No title for tab " + i;
}
nIdx++;
}
}
//Div obj for trx tabs
var oTrxTabs = document.getElementById("TrxTabs");
//create tabs table
var oTabTable = document.createElement("table");
oTabTable.setAttribute("id", "TabTable");
oTabTable.setAttribute("class", "tab");
//create tabs table tbody
var oTabTbody = document.createElement("tbody");
oTabTbody.setAttribute("id", "TabTbody");
//create tabs row
var orowTab = document.createElement("tr");
orowTab.setAttribute("id", "TabRow");
for (var j = 0; j < arrDivTabs.length; j++) {
if (arrDivTabs[j][0] != undefined) {
//tab cell
var ocellTab = document.createElement("td");
var scellTabId = arrDivTabs[j][0] + "_tab";
ocellTab.setAttribute("id", scellTabId);
ocellTab.setAttribute("nowrap", "nowrap");
ocellTab.className = "tab";
ocellTab.onclick = showTab;
var sTabTitle = document.createTextNode(arrDivTabs[j][1]);
ocellTab.appendChild(sTabTitle);
orowTab.appendChild(ocellTab);
}
}
oTabTbody.appendChild(orowTab);
oTabTable.appendChild(oTabTbody);
oTrxTabs.appendChild(oTabTable);
//get first tab index
for (var k = 0; k < nMaxTabs; k++) {
if (arrDivTabs[k][0] != undefined) {
nFstTabId = arrDivTabs[k][0];
break;
}
}
//get last tab index
nLastTabId = arrDivTabs[nIdx - 1][0];
//show first tab
showTab(String(nFstTabId));
//hide tab table if only one tab
if (nIdx == 1 || isDisableTab) {
document.getElementById("TabTable").style.visibility = "hidden";
}
} catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Display check field error message
*
* @param string Field name
* @param string Error message
*/
function showFldErr(sFldNm, sErrMsg){
try {
var oFld = document.getElementById(sFldNm);
if (!oFld)
return;
chkFldErr(oFld, sErrMsg);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Check field error and move cursor to this field
*
* @param object Field object
* @param string Error message
*/
function chkFldErr(oFld, sMsgContent){
try {
if (sMsgContent != null && sMsgContent != "") {
showMsg(sMsgContent);
}
if (!oFld.disabled && !oFld.readonly && oFld.type != "hidden") {
//martin add start -- Received this fix for Mixed Pymt Issue : Included by Praveen
var obj = getTabIdByFld(oFld)
if(obj==null || typeof(obj)=="undefined"){
return;
}
//martin add end
showTab(getTabIdByFld(oFld));
oFld.focus();
//return false;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-04-03-03 john.zhong 2015-12-14 S
function isRtl(){
//CEV2-15-01-10 carly.wu 20190816 S
// var dirAttr = $("html").attr("dir");
var dirAttr = $("html",getTopWindow().document).attr("dir");
//CEV2-15-01-10 carly.wu 20190816 E
var rtl = false;
if(dirAttr!=null&&dirAttr.toLowerCase()=="rtl"){
rtl = true;
}
return rtl;
}
//CEV2-04-03-03 john.zhong 2015-12-14 E
/**
* Check field error and move cursor to this field
*
* @param object Field object
*/
function getTabIdByFld(oFld){
try {
var oDiv = null;
var nodeIdfound = false;
do {
if ("BODY" == oFld.parentNode.nodeName) {
break;
}
if (oFld.parentNode!=null && typeof(oFld.parentNode.id) != "undefined" &&
oFld.parentNode.id != "" &&
oFld.parentNode.id.indexOf("_div") != -1) {
nodeIdfound = true;
oDiv = oFld.parentNode;
}
else {
oFld = oFld.parentNode;
}
}
while (!nodeIdfound && oFld != null)
if (!nodeIdfound) {
return 0;
}
if (oDiv != null) {
var sTab = oDiv.id;
var arrTabId = sTab.split("_");
var sTabId = arrTabId[0];
return sTabId;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Remove node by node name
*
* @param string Node name
*/
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 S
function rmNode(sNodeNm ,displayInTopWin){
try {
var displayDocument = getDocument(displayInTopWin);
var oNodeObj = displayDocument.getElementById(sNodeNm);
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 E
if (oNodeObj) {
oNodeObj.parentNode.removeChild(oNodeObj);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Generate hidden field and append to object
*
* @param string Node name
* @param string Field name
* @param string Field value
* @param string Data type
*/
function genHiddenFld(oParentNode, sFldNm, sFldValue, sDataType){
try {
if (document.getElementById(sFldNm)) {
rmNode(sFldNm);
}
var oHiddenFld = document.createElement("input");
oHiddenFld.setAttribute("type", "hidden");
oHiddenFld.setAttribute("name", sFldNm);
oHiddenFld.setAttribute("id", sFldNm);
if (sDataType.length == 0 || !arrValidDataType.in_array(sDataType)) {
sDataType = "CHAR";
}
oHiddenFld.className = sDataType + "_O";
oParentNode.appendChild(oHiddenFld);
setFldValue(sFldNm, sFldValue);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Display object properties
*
* @param obj object
*/
function showObjProps(obj){
try {
var sProps = "";
for (var prop in obj) {
sProps += "." + prop + " = " + obj[prop] + "\n";
}
return sProps;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Disable page for disallow any actions on the page
*
* @param obj/string form object or form name
*/
function disablePage(sFormNm){
try {
var oForm;
if (typeof(sFormNm) == "object") {
oForm = sFormNm;
}
else
if (typeof(sFormNm) == "string") {
oForm = document.forms[sFormNm];
}
if (oForm) {
var nFormLen = oForm.elements.length
document.body.unload = new Function("return false");
for (var i = 0; i < nFormLen; i++) {
var oFld = oForm.elements[i];
var sObjType = oFld.type;
var sFldNm = "";
if (oFld.id) {
sFldNm = oFld.id;
}
else {
sFldNm = "";
}
var sDataType = getFldDataType(sFldNm);
if ((sObjType == "text") || (sObjType == "textarea")) {
oFld.readOnly = true;
if (sDataType == "INT") {
setFldValue(sFldNm, oFld.value);
}
}
else
if ((sObjType == "select-one") ||
(sObjType == "submit") ||
(sObjType == "reset") ||
(sObjType == "checkbox") ||
(sObjType == "radio")) {
if(oFld.name != "IsAgreeGroup"){
oFld.disabled = true;
}
}
oFld.onblur = new Function("return false");
if (String(window.location).indexOf("PrintPage") != -1) {
return;
}
//hide help tips, buttons, icons for inquire func
if ((typeof(SYS_FUNCTION_TYPE) != "undefined" && "IQ" == SYS_FUNCTION_TYPE) || "Delete" == ITEM_ID) {
if(sObjType == "text" || sObjType == "textarea"){
return;
}
else
if (sFldNm.indexOf("HT_") != -1 ||
sFldNm.indexOf("_BT") != -1 ||
sFldNm.indexOf("ICO_") != -1) {
hideObj(sFldNm);
}
}
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* To disable return for Reason for Refusal in release function
*/
function disableReturn(evt){
try {
var obj = getEvtTarget(evt);
var nKeyCode = getKeyCode(evt);
if (nKeyCode == 13 && obj.type == "text") {
return false;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Convert to uppercase for the charset is in arrUpperCaseCharSet array.
* Invoked in the _Confirm() only.
*/
function convToUpperCase(){
try {
var oMainForm = document.forms["MAINFORM"];
var nElement = oMainForm.elements.length;
var oFld = "";
var sFldNm = "";
var sFldValue = "";
var sCharSet = "";
for (var i = 0; i < nElement; i++) {
oFld = oMainForm.elements[i];
oFldNm = oFld.id;
sFldValue = oFld.value;
sCharSet = oFld.getAttribute("charset");
if ((sCharSet != undefined) && (arrUpperCaseCharSet.in_array(sCharSet))) {
setFldValue(sFldNm, sFldValue.toUpperCase());
}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Get transaction date for TRX_DT field
*/
function getTrxDate(){
try {
var sTrxDt = SYS_CONVERT_DISPLAY_DATE(SYS_DATE);
var oTrxDt = convDtStrToObj(sTrxDt);
if (document.getElementById("TRX_DT") &&
(SYS_FUNCTION_TYPE != "RE" && SYS_FUNCTION_TYPE != "IQ")) {
setFldValue("TRX_DT", oTrxDt);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Display trx tabs only for inq history screen
*/
function showTrxTabsOnly(){
try {
//var sHref = window.location.href;
//CEV2-07-01-04 john.zhong 2014-04-08 S
//if (sHref.indexOf("_TRX_STATUS=INQDTL_VIEW") != -1||(isIE11&&typeof(isHistDetail)!="undefined"&&isHistDetail)) {
//CEV2-07-01-04 john.zhong 2014-04-08 E
if(isInqHistoryDtl() || isPopUpWindow){
//document.body.style.background = "#ffffff"; //S commented for UI UX Changes George
document.body.style.margin = "5px";
var cont = document.getElementById("B_CONTENT");
cont.style.left = "14px"; // Syed changed for L&F-- old "144px";
// cont.style.top = "75px"; commented by Syed for L&F-- old "115px";
cont.style.width = "1230px";
hideObj("divHeader");
hideObj("divMenu");
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
*
* @description is in inquire history detail page
* @author wayne
* @patchNo CEV2-15-01-03
* @since CEV3.1
* @date 2015-12-03
* @returns [Boolean] is or not
* @example
* if(isInqHistoryDtl()){...}
*/
//CEV2-15-01-03 wayne 2015-12-03 add s
function isInqHistoryDtl() {
return SYS_FUNCTION_TYPE == "IQ" &&
(window.location.href.indexOf("_TRX_STATUS=INQDTL_VIEW") != -1 ||
(typeof (isHistDetail) != "undefined" && isHistDetail));
}
//CEV2-15-01-03 wayne 2015-12-03 add e
/**
* Display main content for sys template screen, example:catalog
*/
function showMainContent(){
document.body.style.background = "#ffffff";
document.body.style.margin = "5px";
var cont = document.getElementById("B_CONTENT");
cont.style.left = "0px";
cont.style.top = "0px";
hideObj("divHeader");
hideObj("divMenu");
}
/**
* Is this trx for report
*/
function isReport(){
try {
var bRtnFlag = false;
if (window.SYS_FUNCTION_TYPE) {
if (SYS_FUNCTION_TYPE == "MM" &&
SYS_FUNCTION_NAME.indexOf("Report") != -1 &&
SYS_FUNCTION_SHORT_NAME.indexOf("Report") != -1 &&
beInt(SYS_I_EVENT_TIMES) == 0) {
bRtnFlag = true;
}
}
return bRtnFlag;
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Is documents list avaiable?
*/
function isDocListAval(){
try {
if (!document.getElementById("DocListMenu")) {
return false;
}
var hasImage = document.getElementById("DocListMenu").options.length > 0;
var hasReport = typeof(reportArray) != "undefined" && reportArray.length > 0;
if (isInqHistory && (hasImage || hasReport)) {
return true;
}
else {
return false;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function setAuthTrxFuncDesc(){
try {
if (typeof(sOrgTrxFuncId) == "undefined" || sOrgTrxFuncId == null) {
return;
}
else {
var sAuthTrxFuncDesc = "";
var sOrgTrxFuncDesc = getFuncDescByFuncId(sOrgTrxFuncId);
if(typeof(sOrgTrxFuncDesc) == "undefined"){
sAuthTrxFuncDesc = selFuncDesc;
} else {
sAuthTrxFuncDesc = "Authorise " + sOrgTrxFuncDesc;
}
return sAuthTrxFuncDesc;
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function refRel(flag){
try {
var oForm = document.forms["MAINFORM"];
var oRefuseReason = document.getElementById("RefuseReason");
if (flag) {
//Refuse
oForm.C_REFUSE_REASON.disabled = false;
oForm.C_REFUSE_REASON.readOnly = false;
oForm.C_REFUSE_REASON.value = "";
showObj("RefuseReason");
setFldValue("C_IS_AGREE","N");
}
else {
//Release
oForm.C_REFUSE_REASON.disabled = true;
oForm.C_REFUSE_REASON.value = "";
hiddenVisibilityObj("RefuseReason");
setFldValue("C_IS_AGREE","Y");
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
function genRelease(){
try {
if ((typeof(SYS_FUNCTION_TYPE) != "undefined" && SYS_FUNCTION_TYPE == "RE") ||
(typeof(ITEM_ID) != "undefined" && ITEM_ID == "Release")) {
var relString = "";
relString += "
";
var oRelDiv = document.createElement("div");
oRelDiv.setAttribute("id", "releaseTab");
oRelDiv.innerHTML = relString;
var headTab = document.getElementById("reltab");
if(headTab == null){
headTab = document.getElementById("headerName");
}
var oHeadTabsParent = headTab.parentNode;
oHeadTabsParent.appendChild(oRelDiv);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* generate icons, it shd be modified for reduce scan all fields when initial
* a trx
*/
function genIcon(){
try {
var oMainForm = document.forms["MAINFORM"];
var nElement = oMainForm.elements.length;
var oFld = null;
var sType = "";
var sClassNm = "";
var arrClassNm = "";
var sDataType = "";
for (var nLoop = 0; nLoop < nElement; nLoop++) {
oFld = oMainForm.elements[nLoop];
sType = oFld.type;
sClassNm = oFld.className;
arrClassNm = oFld.className.split("_");
sDataType = arrClassNm[0];
//removed as use the calendar provided button
//if (sDataType == "DATE") {
// addDtIcon(oFld.id);
//}
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* BeInt() has been called in system functions.
*/
function BeInt(Value){
try {
beInt(Value);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* DisableAllFields() has been called in system functions.
*/
function DisableAllFields(){
try {
disableAllFld();
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* DispErrMsg() has been called in system functions.
*/
function DispErrMsg(sMsgContent, sMsgTitle){
try {
showMsg(sMsgContent, sMsgTitle);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* GenRelease() has been called in system functions.
*/
function GenRelease(){
try {
genRelease();
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* GenTabs() has been called in system functions.
*/
function GenTabs(){
try {
genTabs();
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* GetTabIdByFld() has been called in system functions.
*/
function GetTabIdByFld(oFld){
try {
return getTabIdByFld(oFld);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* ShowTab() has been called in system functions.
*/
function ShowTab(e){
try {
showTab(e);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Setup value for PARENT_MAIN_REF for inquire History
*/
function Get_PARENT_MAIN_REF(){
try {
var C_MAIN_REF = getFldValue("C_MAIN_REF");
setFldValue("PARENT_MAIN_REF", C_MAIN_REF);
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
/**
* Setup Email To, this is a switch for STAN email.
*/
function GetEmailGrpName(){
try {
SYS_GetDataBySSS("getEmailGrpNmData", "sEmailGrpName", "GetEmailGrpNm"); //Get EMAIL_LIST from STD_EMAIL, EMAILTRX_TYPE=N
var eList = sEmailGrpName.split("/");
for (k = 0; k < eList.length; k++) {
var fList = eList[k].split("-");
//if (fList[0] == sSelectedFuncId) {
if (typeof(FUNC_ID) =="string" && fList[0] == FUNC_ID){
sEmailGrpNm = fList[1];
SYS_GetDataBySSS("getEmailListData", "sEmailGrpNm", "GetEmailList"); //Get EMAIL_LIST from STD_EMAIL, EMAILTRX_TYPE=G
}
}
}
catch (E) {
DisExcpt("BaseFunc", E);
}
}
function GetEmailGrpNm(){
try {
// to do
}
catch (E) {
DisExcpt("BaseFunc", E);
}
}
function GetEmailList(){
try {
setFldValue("EMAIL_TO", sEmailList);
setFldValue("EMAIL_SUBJECT", "CSBank Email Notification");
}
catch (E) {
DisExcpt("BaseFunc", E);
}
}
/**
*In function level event js, two solutions provided.
*1) GetEmailGrpName(); it is used to get the emails by STAN Email Group and Email Notification functions
*2) GetEmailbyScnData(); it is used to get the emails by another way.
*/
var isOpenImg = false;
function GetImageList(){
try {
if (document.getElementById("ViewImgLinkDiv")) {
//if (hasImageContent() || hasReportContent()) {
if (hasImageContent() || hasReportContent() || hasDocContent()) {
showObj("ViewImgLinkDiv");
showObj("ViewImgDiv");
if (hasImageContent()) {
for (var i = 0; i < allImageInfo.length; i++) {
var imgBtn = document.getElementById("ViewImage" + i);
if(imgBtn!=null){
imgBtn.disabled = false;
}
}
}
if (hasReportContent()) {
for (var j = 0; j < reportArray.length; j++) {
var rptBtn = document.getElementById("ViewReport" + j);
if(rptBtn!=null){
rptBtn.disabled = false;
}
}
}
//CEV2-05-19-24 Add for HTML document Start
if (hasDocContent()) {
for (var k = 0; k < docIndex.length; k++) {
var docBtn = document.getElementById("ViewDoc" + k);
if(docBtn!=null){
docBtn.disabled = false;
}
}
}
// CEV2-05-19-24 Add for HTML document End
isOpenImg = true;
var imgLink = document.getElementById("ViewImgLink");
var sOnClick = "showImgDiv";
attachObjEvent(imgLink, "onclick", eval(sOnClick));
}
}
}
catch (E) {
DisExcpt("BaseFunc", E);
}
}
function showImgDiv(){
try {
var imgLink = document.getElementById("ViewImgLink");
if (isOpenImg) {
hideObj("ViewImgDiv");
imgLink.innerHTML = "Show Image(s)";
isOpenImg = false;
}
else {
isOpenImg = true;
showObj("ViewImgDiv");
imgLink.innerHTML = "Hide Image(s)";
}
}
catch (E) {
DisExcpt("BaseFunc", E);
}
}
//CEV2-0277 john.zhong 2010-01-15 S
function onlyShowMultiRelContent(){
try {
document.body.style.background = "#ffffff";
document.body.style.margin = "5px";
var cont = document.getElementById("B_CONTENT");
cont.style.left = "0px";
cont.style.top = "0px";
hideObj("divHeader");
hideObj("divMenu");
//hideObj("releaseTab");
hideObj("Secu_RelSysBtns");
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-0277 john.zhong 2010-01-15 E
/**
* attEvent in catalog for detect onclick
*/
function attachOnclickEvent(){
try {
var oMainForm = document.forms[0];
var nElement = oMainForm.elements.length;
for(i=0;idocument.documentElement.scrollWidth-40;
if(b&&window.event.clientY<0||window.event.altKey||window.event.ctrlKey){
return true;
}else{
return false;
}
}
return false;
}
function clearSesWhenClose(){
if((typeof(isPopUpWindow)=="undefined"||!isPopUpWindow)&&isCloseWin()){
SYS_CE_LOGOUT(true);
}
}
function cfmSuccOnInit(){
window_onload();
if (typeof(OnInit) != "undefined"){
OnInit();
}
genCfmSuccBtns();
if(isPopUpWindow){
showMainContent();
}
}
//CEV2-0391 john.zhong 2011-01-14 S
function selectUnselectAll(obj){
try {
if(obj){
var isCheck = obj.checked;
cataSelectAllClick(isCheck,"_Sel_CheckBox");
}
} catch (e) {
showExcpt("BaseFunc", e);
}
}
function hiddenSelectAll(){
try{
if(isNeedHideSelectAll()||_ACT_TYPE == "CATA_SECU"){
var selAllObj = document.getElementById("_Sel_CheckBox_ALL");
if(selAllObj){
selAllObj.disabled = true;
selAllObj.style.display = "none";
}
}
} catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-0391 john.zhong 2011-01-14 E
//This mothed is used to check if Multi trx selected in catalog
function isMultiTrx(){
try {
var _selected_Array = new Array();
var selectObjs = document.getElementsByName("_Sel_CheckBox");
var len = selectObjs.length;
var _i = 0;
while(_i < len){
if(selectObjs[_i].checked){
_selected_Array.push(_i);
}
_i++;
}
if(_selected_Array.length>1){
return true;
}else{
return false;
}
}
catch (e){
showExcpt("BaseFunc", e);
}
}
//Martin 2012-11-02 S
function disableAMTFld(){
var oMainForm = document.forms["MAINFORM"];
var form_length = oMainForm.elements.length;
for (var i = 0; i < form_length; i++) {
var cls = oMainForm.elements[i].className;
if (cls != null && cls.indexOf("AMT_")>=0) {
oMainForm.elements[i].disabled = true;
}
}
}
//E
//CEV2-01-01-01 cash 2012-05-02 s
//This mothed is used to check password strength
function checkPwdStrength(){
try {
var password = document.getElementById("NEWPASSWORD").value;
if((typeof(password)=="undefined") || password == ""){
return;
}
password = encodeURIComponent(password);
var actionUrl = "../servlets/WSTrxManager?_TRX_STATUS=PWD_CHECK&C_PASSWORD="+password;
actionUrl = encodeUrl(actionUrl);
sendRequestByAjaxPost(actionUrl, true, genPwdStrength);
} catch (e) {
showExcpt("BaseFunc", e);
}
}
function genPwdStrength(xmlhttp) {
try {
var errorMsg = getSysErrorFromRespXml(xmlhttp);
if(errorMsg!=null) {
checkPwdStrengthFail(errorMsg);
return;
}
var rtnDom = xmlhttp.responseXML;
if (typeof(rtnDom) == "object") {
var root = rtnDom.documentElement;
if (root == null) {
return null;
}
var status = XMLManager.getChildNodeValue(root,"Status",true);
if(status=="N"){
var warnMsg = XMLManager.getChildNodeValue(root,"Warning",true);
checkPwdStrengthFail(warnMsg);
document.getElementById("pwd-strength").style.display="none";
//document.getElementById("success").style.display="none";
return;
}
var level = XMLManager.getChildNodeValue(root,"PasswordLevel",true);
var iLevel = parseInt(level);
var pwd_ul = document.getElementById("pwd-strength");
var liArray = pwd_ul.getElementsByTagName("li");
for (var i = 0; i < liArray.length; i++) {
liArray[i].className="";
}
document.getElementById("pwd-strength").style.display="block";
for (var j = iLevel; j > 0; j--) {
document.getElementById("pwdstrength_"+j).className="pwdstrength_"+level;
}
var curr = document.getElementById("pwdstrength_"+level);
curr.className = curr.className + " currs";
//document.getElementById("success").style.display="block";
}
} catch (e) {
showExcpt("BaseFunc", e);
}
}
function checkPwdStrengthFail(errMsg){
_SYS_Display_ERROR(errMsg);
document.getElementById("NEWPASSWORD").value = "";
}
//e
//CEV2-01-02-01 john.zhong 2013-09-10 S
function showSSVErrInErrPage(){
try{
var ssvResData = getSSVResData();
if(ssvResData==null||ssvResData.length<=0){
return false;
}
var errUl = document.getElementById("err_ul");
var errLi = document.getElementById("err_li");
errLi.style.display = "none";
for(var i=0;i-1){
sMsgContent = sMsgContent.replace(/{{\w+}}/g,"");
if(sMsgContent.indexOf("[[")>-1 && sMsgContent.indexOf("]]")>-1){
sMsgContent = sMsgContent.replace("[[","(");
sMsgContent = sMsgContent.replace("]]",")");
}
}
// CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 S
var displayDocument = getDocument(displayInTopWin);
rmNode("Template_valSummary",displayInTopWin);
var oErrDiv = displayDocument.createElement("div");
oErrDiv.setAttribute("id", "Template_valSummary");
oErrDiv.className = "MsgToUser";
var oErrTable = displayDocument.createElement("table");
oErrTable.setAttribute("id", "errTable");
var oErrTableBody = displayDocument.createElement("tbody");
oErrTableBody.setAttribute("id", "errTableBody");
var oErrRow = displayDocument.createElement("tr");
oErrRow.setAttribute("id", "rowErr");
var oErrCell = displayDocument.createElement("td");
oErrCell.setAttribute("id", "cellErr");
var oErrTitle = displayDocument.createElement("span");
oErrTitle.setAttribute("id", "errMsgTitle");
oErrTitle.className = "MsgToUserHeader";
var oErrList = displayDocument.createElement("ul");
var arrErrMsg = sMsgContent.split("|");
var nErrMsg = arrErrMsg.length;
if (sMsgTitle == undefined || sMsgTitle == null ||
sMsgTitle.length == 0) {
if(level == "1"){
sMsgTitle = "Success information.";
}else if(level == "2"){
sMsgTitle = "Warning information.";
}else
oErrTitle.innerHTML = "There was a problem submitting your request.";
}
else {
oErrTitle.innerHTML = sMsgTitle;
}
for (var i = 0; i < nErrMsg; i++) {
var oErrMsgLi = displayDocument.createElement("li");
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 E
var sErrMsgId = "errMsg_" + i;
oErrMsgLi.setAttribute("id", sErrMsgId);
oErrMsgLi.innerHTML = arrErrMsg[i];
oErrList.appendChild(oErrMsgLi);
}
oErrTitle.appendChild(oErrList);
oErrCell.appendChild(oErrTitle);
oErrRow.appendChild(oErrCell);
oErrTableBody.appendChild(oErrRow);
oErrTable.appendChild(oErrTableBody);
oErrDiv.appendChild(oErrTable);
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190816 S
var oTrxTabs = displayDocument.getElementById("TrxTabs");
var oTrxTabsParent = oTrxTabs.parentNode;
oTrxTabsParent.insertBefore(oErrDiv, oTrxTabs);
//ADD CEV2-05-25-18
if(level == "1"){
//$(".MsgToUser").css("background-color","#d4edda");
//$(".MsgToUser").css("border","solid 1px #c3e6cb");
$(".MsgToUser ul",displayDocument).css("color","#D22630");// syed color code changed old value-#246B1A
$(".MsgToUser table tr td span.MsgToUserHeader",displayDocument).css("color","#D22630");// syed color code changed old value-#246B1A
}else if(level == "2"){
//$(".MsgToUser").css("background-color","#fff3cd");
//$(".MsgToUser").css("border","solid 1px #ffeeba");
$(".MsgToUser ul",displayDocument).css("color","#D22630");
$(".MsgToUser table tr td span.MsgToUserHeader",displayDocument).css("color","#D22630");
}else if(level == "3"){
//$(".MsgToUser").css("background-color","#f8d7da");
//$(".MsgToUser").css("border","solid 1px #f5c6cb");
$(".MsgToUser ul",displayDocument).css("color","#DC4839");
$(".MsgToUser table tr td span.MsgToUserHeader",displayDocument).css("color","#DC4839");
}
//END CEV2-05-25-18
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190816 E
//CEV2-04-03-03 john.zhong 2015-12-14 S
if(isRtl()){
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190816 S
$("#errMsgTitle",displayDocument).css("padding-right","25px");
$("#errMsgTitle",displayDocument).css("padding-left","0");
$("div.MsgToUser li",displayDocument).css("margin-left","0");
$("div.MsgToUser li",displayDocument).css("margin-right","8px");
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190816 E
}
//CEV2-04-03-03 john.zhong 2015-12-14 E
}
catch (e) {
//showExcpt("BaseFunc", e);
}
}
//CEV2-05-25-18 END
//CEV2-05-58-01 hunk.han 2018-12-27 S scan the input element which has attribute data-inqcubk ,then attach AutoComplete function
function attachAutoComplete() {
try{
//cubk
var flds = $("input[data-inqcubkrule]");
for (var i = 0; i < flds.length; i++) {
var inqCUBKRuleName = $(flds[i]).attr('data-inqcubkrule');
var getCUBKRuleName = $(flds[i]).attr('data-getcubkrule');
addCUBKAutoComplete(flds[i], inqCUBKRuleName, getCUBKRuleName);
}
}catch(e){
showExcpt("BaseFunc", e);
}
}
function attachClauseLayer() {
try{
//clause
if(typeof(addClauseAutoComplete) === 'function' && isClauseLayer) {
addClauseAutoComplete();
}
}catch(e){
showExcpt("BaseFunc", e);
}
}
// CEV2-05-58-01 hunk.han 2018-12-27 E
//CEV2-05-58-01 hunk.han 2018-10-17 S copy from clauseMain.jsp
function off(type, clauseParams) {
var str = "";
var doc = document;
var actionUrl = "../servlets/WSGetClause?REQUEST_TYPE=GETCLAUSECONTEXT&";
//CEV2-05-58-01 hunk.han 2018-08-27 E
if (clauseParams) {
if (clauseParams.selectID.length === 0) {
return;
}
var ids = clauseParams.selectID;
for (var i = 0; i < ids.length; i++) {
str += "CLAUSE_ID=" + ids[i];
if (i < ids.length - 1) {
str += "&";
}
}
str += "&PASTE_TYPE=" + type;
actionUrl += str;
actionUrl += "&isAutoComplete=true";
actionUrl = encodeUrl(actionUrl);
$.ajax({
type : "post",
url : actionUrl,
async : false,
dataType : "text",
success : clauseParams.callBack,
error : function(e) {
DisExcpt("clauseAuto", e);
}
});
rmNode("Template_valSummary");
return;
}
//CEV2-05-58-01 hunk.han 2018-08-27 E
var oSelect = doc.c_select.t_clause;
var len = oSelect.length;
var ot_clause = document.getElementById("t_clause");
if (len > 0) {
for (var i = 0; i < len; i++) {
str += "CLAUSE_ID=" + ot_clause.options[i].value;
if (i < len - 1)
str += "&";
}
str += "&PASTE_TYPE=" + type;
actionUrl += str;
actionUrl = encodeUrl(actionUrl);
document.getElementById("iclause").src = actionUrl;
document.body.disabled = true;
var oc_select = document.getElementById("c_select");
for (var i = 0; i < oc_select.elements.length; i++) {
oc_select.elements[i].disabled = true;
}
document.body.style.cursor = "not-allowed";
getOpener().rmNode("Template_valSummary");
} else {
alert("Please choose the clause !");
return false;
}
}
function clause_view_open(reqViewType, clauseParams) {
var actionUrl = "../servlets/WSGetClause?REQUEST_TYPE=PREVIEWCLAUSECONTEXT&VIEW_TYPE=";
if (clauseParams) {
actionUrl += reqViewType + "&CLAUSE_ID=" + clauseParams.selectID;
actionUrl = encodeUrl(actionUrl);
$.ajax({
type : "post",
url : actionUrl,
async : false,
dataType : "text",
success : clauseParams.callBack,
error : function(e) {
DisExcpt("clauseAuto", e);
}
});
return;
}
var oForm = document.c_select;
var oClause = document.getElementById("f_clause").options;
var oTClause = document.getElementById("t_clause").options;
var oo = findSelectClause(oClause);
if (oo == null) {
oClause = oTClause;
oo = findSelectClause(oClause);
}
if (oo == null) {
alert("Please choose a selected clause !");
return;
}
actionUrl += reqViewType + "&CLAUSE_ID=" + oo.value;
actionUrl = encodeUrl(actionUrl);
document.getElementById("iclause").src = actionUrl;
}
//CEV2-05-58-01 hunk.han 2018-10-19 E copy from clauseMain.jsp
//CEV2-05-58-01 hunk.han 2018-10-19 S Add the autoComplete event to the Clause field.Fld is a collection of fields that add autoComplete events
function addClauseAuto(flds) {
var hasAddEvent = false;
if (typeof (flds) === 'undefined') {
var textareas = document.getElementsByTagName('textarea');
for (var i = 0; i < textareas.length; i++) {
var textarea = textareas[i];
var textarea_next = $(textarea).next();
if (textarea_next.val() === 'CLAUSE') {
var option = {};
option.hasAddEvent = hasAddEvent;
option.type = textarea.id;
$(textarea).cAutocomplete(option);
hasAddEvent = true;
}
}
} else {
for (var i = 0; i < flds.length; i++) {
var textarea = flds[i];
var option = {};
option.hasAddEvent = hasAddEvent;
option.type = textarea.id;
$(textarea).cAutocomplete(option);
hasAddEvent = true;
}
}
}
//CEV2-05-58-01 hunk.han 2018-10-19 E
//20190304 DORA CEV2-01-03-20 3.3BUG2 S
function changeSecuTabStyle(sId){
if($("#tabTable").length>0){
var className = "tab" + sId;
if($("."+className).length>0){
$("."+className).css("color","#D22630");
$("."+className).css({"border":"1px solid #a2a0a1"});
$("."+className).css({"border-bottom":"#fff"});
$("."+className).css({"padding":"4px"});
var allTdEle = $("#tabTable td");
for (var k = 0; k 0){
continue;
}
allTdEle[k].style.color = "#a2a0a1";
allTdEle[k].style.border = "";
allTdEle[k].style.borderBottom= "1px solid #a2a0a1";
}
}
}
}
//20190304 CEV2-01-03-20 DORA 3.3BUG2 E
//ADD DORA 20190411 CEV2-05-25-18 ERROR Message
function dealSpecificErrMsg(sMsgContent){
if(sMsgContent.indexOf("}}")>-1){
sMsgContent = sMsgContent.substring(sMsgContent.indexOf("}}")+2);
if(sMsgContent.indexOf("[[")>-1 && sMsgContent.indexOf("]]")>-1){
sMsgContent = sMsgContent.replace("[[","(");
sMsgContent = sMsgContent.replace("]]",")");
}
}
return sMsgContent;
}
//END
//CEV2-05-31-19 20191230 HUNK S
function Preview_Form() {
var actionUrl="../servlets/WSSPreviewForm";
var formXml = getFormDataUrl(document.MAINFORM, '');
actionUrl += "?" + formXml;
actionUrl = encodeUrl(actionUrl);
window.open(actionUrl, "win", "toolbar=0,menubar=0,resizable=1,scrollbars=1,status=1,fullwindow");
}
//CEV2-05-31-19 20191230 HUNK E
// CEV2-05-07-09 S
/**
* Show the screen of a specified action.
* @param actionName Name of target action
* @param actionParams action parameter object
*/
function actionOnClick(actionName, actionParams) {
ClearAllInputFieldsValue();
let actionUrl = '../servlets/WSSActionRouting?IS_FUNC_START=T&NO_MAPPING=T';
if (actionParams) {
Object.keys(actionParams).forEach(key => {
actionUrl += `&${key}=${actionParams[key]}`;
})
}
actionUrl += `&C_ACTION_ID=${actionName}`;
actionUrl = encodeUrl(actionUrl);
submitForm(document.forms[0], actionUrl);
}
/**
* Show detail screen by clicking hyperlinks or action buttons of catalogs
* The paramString may contain parameters below:
* - C_ACTION_ID or FUNC_ID (not both): ID of the target action or function
* - MAPPING: keys of the record which will be shown in detail screen
* - Other parameters
*/
function showDetailScreen(paramString) {
ClearAllInputFieldsValue();
var actionUrl = '../servlets/WSSActionRouting?IS_FUNC_START=T&NO_MAPPING=T&TARGET=S' + paramString;
actionUrl = encodeUrl(actionUrl);
submitForm(document.forms[0], actionUrl);
}
//S Added for UI UX Changes George
/**
* Show detail screen by clicking hyperlinks or action buttons of catalogs
* @param actionName Name of target action
* @param rowData Catalog row data
*/
function showDetailScreen(actionName, rowData) {
ClearAllInputFieldsValue();
//S Modified for UI UX Changes George 20231227
let actionUrl= '../servlets/WSSActionRouting?IS_FUNC_START=T&NO_MAPPING=T&TARGET=S&C_ACTION_ID=' + actionName;
if(rowData!=null){
actionUrl += '&MAPPING=' + object2xml(rowData);
}
//E Modified for UI UX Changes George 20231227
actionUrl = encodeUrl(actionUrl);
submitForm(document.forms[0], actionUrl);
}
//E Added for UI UX Changes George
//S Commented for UI UX Changes George
function object2xml(obj) {
var xml = '';
for (var key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
continue;
}
xml += '<' + key + '>' + encodeURIComponent(obj[key]) + '' + key + '>';
}
xml += '';
return xml;
}
//E Commented for UI UX Changes George
/*
//S Added for UI UX Changes George
function object2xml(rowData) {
let xml = '';
for (const [key, value] of Object.entries(rowData)) {
xml += `<${key}>${value}${key}>`;
}
xml += '';
return xml;
}
*/
//E Added for UI UX Changes George
//S Commented for UI UX Changes George
/*
// carly.wu 20210813 Trx template list component S
function loadTemplateByItem(tempObj, skipConfirm){
if (!skipConfirm) {
var truthBeTold = confirmToHold();
if (!truthBeTold){
return;
}
}
var templId = tempObj.id;
var templName = tempObj.value;
var actionUrl = "../servlets/WSTrxManager?isTrx=Y&_TRX_STATUS=TEMPLATE&TMPL_INFO=";
actionUrl+=templId+"&IS_NEW_TEMPLATE=Y";
actionUrl+="&TMPL_TYPE=LOADING&T_CONTENT_NAME="+templName+"&T_CONTENT_ID="+templId;
var theForm = document.MAINFORM;
theForm.action = actionUrl;
postFormByAjax(theForm ,templCallBack);
}
//E Commented for UI UX Changes George
*/
//S Added for UI UX Changes George
// carly.wu 20210813 Trx template list component S
function loadTemplateByItem(tempObj) {
var truthBeTold = confirmToHold();
if (!truthBeTold) {
return;
}
var templId = tempObj.id;
var templName = tempObj.value;
var actionUrl = "../servlets/WSTrxManager?isTrx=Y&_TRX_STATUS=TEMPLATE&TMPL_INFO=";
actionUrl += templId + "&IS_NEW_TEMPLATE=Y";
actionUrl += "&TMPL_TYPE=LOADING&T_CONTENT_NAME=" + templName + "&T_CONTENT_ID=" + templId;
var theForm = document.MAINFORM;
theForm.action = actionUrl;
postFormByAjax(theForm, templCallBack);
}
//E Added for UI UX Changes George
function confirmToHold(){
return window.confirm("Click OK to Continue, Cancel to Cancel.");
}
function templCallBack(xmlhttp) {
var fullFieldValFunc = xmlhttp.responseText;
if (fullFieldValFunc){
eval(fullFieldValFunc);
}
}
// carly.wu 20210813 Trx template list component E
// CEV2-05-07-09 E
//CEV2-05-14-26 pending/Release compare difference
function custHighLightChangedFields(){
//comment compare feature
}
function dealChangedField(fieldName){
try{
var changedField = document.getElementById(fieldName);
if(changedField != null && "hidden" == changedField.type){
return;
}
var btn = document.createElement("span");
//btn.setAttribute("type", "button");
btn.setAttribute("buttonName", fieldName);
btn.setAttribute("class","compare-diff__button");
btn.onclick = compareDiff;
//btn.setAttribute("value", "Compare");
btn.innerHTML = "Compare";
changedField.parentNode.appendChild(btn);
}catch(e){
alert(e);
}
}
function compareDiff(evt){
var obj = getEvtTarget(evt);
var btnName = obj.getAttribute("buttonName");
if(_ChangeData != null && _ChangeData.length > 0 ){
var arrLen = _ChangeData.length;
for(var i=0;i= 0){
oriField.className="compare-Container__content compare-Container__AMT";
}
compareContainer.appendChild(oriField);
var calWidth = compareField.offsetWidth;
var calHeight = compareField.offsetHeight;
if('select-one' == fieldType){
var optionLen = compareField.options.length;
for(var i=0;i{
span = document.createElement('span');
span.appendChild(document
.createTextNode(each));
oriDiv.appendChild(span);
});
diff.forEach((part) => {
const clsName = part.added ? 'compare-diff__add' :
part.removed ? 'compare-diff__removed' : 'compare-diff__normal';
span = document.createElement('span');
span.className = clsName;
span.appendChild(document
.createTextNode(part.value));
newDiv.appendChild(span);
});
document.getElementById("disFieldDesc").innerHTML = compareField.title;
document.getElementById("display").style.display = "block";
}
}catch(e){
alert(e);
}
}
function hideCompare(){
document.getElementById("display").style.display = "none";
}
function hideCompareContainer(evt){
var obj = getEvtTarget(evt);
var btnName = obj.getAttribute("buttonName");
var compareContainer = document.getElementById("compare_" + btnName);
if(compareContainer){
compareContainer.style.display = "none";
}
}
//S Modified for UI UX Changes George
//CEV2-05-14-26 pending/Release compare difference
// May CEV2-05-63-01 20210826 S
function viewDocuments(documentMap) {
const document = documentMap.data;
const type = documentMap.type;
const docIndex = document.fileIndex; //C_IMG_INDX
const docDesc = document.desc; //C_IMG_DOC_DESC
const docType = document.fileType; //C_IMG_FILE_TYPE
const docPath = document.path;
if (type === 'Document') {
viewDocument(docIndex);
} else if (type === 'Form') {
if (docType === 'html') {
viewDocument(docIndex);
} else {
viewReport(docType, docIndex, docPath);
}
} else {
//image
const imageIndex = docIndex; //C_IMG_INDX
const imageDocDesc = docDesc; //C_IMG_DOC_DESC
const imageFileType = docType; //C_IMG_FILE_TYPE
if (imageIndex != null) {
var vFileValue = "../servlets/WSSUploadImaging?_ACT_TYPE=INQ_DATA&_INQ_TYPE=VIEW_IMG_FILE&IMG_INDEX=" + imageIndex +
"&IMG_FILE_TYPE=" + imageFileType + "&IMG_DOC_DESC=" + imageDocDesc + "&Date=" + new Date().toString();
const url = vFileValue;
const swidth = screen.width - 10;
const sheight = screen.height - 10;
const wStyle = "width=" + swidth + ",height=" + sheight + ",left=0,top=0,scrollbars=yes,status=no,resizable=yes";
if (vFileValue.length > 0) {
openWin(url, "", wStyle);
}
}
}
}
//E Modified for UI UX Changes George
//S Modified for UI UX Changes George
function viewDocument(docIndx) {
try {
var url = "../servlets/WSTrxManager?_TRX_STATUS=TRX_INQ_DOCS&docIndex=" + docIndx;
var style = viewDocument[0];
if (typeof(style) == "undefined") {
style = new OpenWinStyle();
style.setScrollbars(true);
style.setResizable(true);
style.setWidth(1000);
style.setHeight(700);
style.setLeft(10);
style.setTop(10);
style.setScreenX(10);
style.setScreenY(10);
}
viewWindow = openWin(url, "viewWindow", style);
} catch (e) {
showExcpt("SysviewImage", e);
}
}
//E Modified for UI UX Changes George
//S Modified for UI UX Changes George
function viewReport(format, index, name) {
var url = "../servlets/WSTrxManager?_TRX_STATUS=CE_REPORT_VIEW_DTAL&CERPT_TYPE=FORM&C_REPORT_FORMAT=" + format + "&C_REPORT_INDX=" + index + "&C_REPORT_NAME=" + name + "&OUTPUT_TYPE=export";
openDocument(url);
}
// May CEV2-05-63-01 20210826 E
//E Modified for UI UX Changes George
function _SuperSearch() {
try {
var vCataNum = "1";
var vCataCurr = "1";
var vForm = document.MAINFORM;
vForm._ACT_TYPE.value = "CATA_INBOX";
vForm.ITEM_ID.value = "ByMainRef";//TODO to be defined
vForm.CATA_NUM.value = vCataNum;
vForm.CATA_CURR.value = vCataCurr;
vForm.IS_GLOBAL_INQ.value = "T";
vForm.TRAN_NAME.value = "ByMainRef";//TODO the same value as ITEM_ID
vForm.TITLE_NAME.value = "GlobalSearch";//TODO to be defined
vForm.SEL_TYPE.disable = true;
setUniqueFieldValue(vForm, "_TRX_STATUS", "CE_CATAMANAGER");
//jason edit 20150402 s
var actionUrl = "../servlets/WSTrxManager";
vForm.action = encodeUrl("../servlets/WSTrxManager");
vForm.method = "post";
vForm.submit();
//submitForm(vForm, actionUrl);
//jason edit 20150402 e
} catch (E) {
SYS_Display_Exception("BaseFunc", E);
}
}
function whatNextForSupINQ(cataIndex){
try {
var actionUrl = "../servlets/WSTrxManager?_TRX_STATUS=SUPERINQNEXT&_SEL_CHECK="+cataIndex;
actionUrl = encodeUrl(actionUrl);
sendRequestByAjaxPost(actionUrl, true, retrieveNextForSupINQ);
} catch (E) {
SYS_Display_Exception("BaseFunc", E);
}
}
function retrieveNextForSupINQ(xmlhttp){
try {
var errorMsg = getSysErrorFromRespXml(xmlhttp);
if(errorMsg!=null) {
//TODO
return;
}
//TODO
var nextData = xmlhttp.responseXML;
var root = nextData.documentElement;
var pdtID = root.getAttribute("PdtId");
var oriCataIndex = root.getAttribute("OriCataIndex");
var funcs = XMLManager.findChildNodes(root,"Func");
if(funcs==null||funcs.length<=0){
if(document.getElementById("FuncLinkGrid")){
rmNode("FuncLinkGrid");
}
var oTable = document.getElementById("B_CONTENT");
var inputs = oTable.getElementsByTagName("input");
var len = inputs.length;
for(var m=0;m= 1000000000000000) {
return "Error";
}
var temp;
var intAmt = "", decAmt = "";
var dicimalSymbol, digitGroupSymbol;
var decimalPlace, count;
var inputAmt = aInputAmt.toString();
var result = "";
dicimalSymbol = SYS_AMT_DEC_FORMAT;
digitGroupSymbol = SYS_AMT_INT_FORMAT;
var reDigitGroupSymbol = new RegExp(digitGroupSymbol,"g");
var place = new Array(9);
place[1] = "";
place[2] = " Thousand ";
place[3] = " Million ";
place[4] = " Billion ";
place[5] = " Trillion "
inputAmt = inputAmt.replace(reDigitGroupSymbol, "");
decimalPlace = inputAmt.indexOf(dicimalSymbol);
//decimalPlace = inputAmt.indexOf('.');
if (decimalPlace > 0) {
temp = inputAmt + "00";
temp = temp.substr(decimalPlace + 1, 2);
decAmt = ConvertTens(temp);
inputAmt = inputAmt.substr(0, decimalPlace);
}
count = 1;
while ( inputAmt != "" ) {
var start = inputAmt.length - 3;
if(start<0){
start = 0;
}
temp = ConvertHundreds(inputAmt.substr(start, 3));
if (temp != "") {
intAmt = temp + place[count] + intAmt;
}
if (inputAmt.length > 3) {
var len = inputAmt.length - 3;
inputAmt = inputAmt.substr(0, len);
} else {
inputAmt = "";
}
count++;
}
switch(decAmt) {
case "": decAmt = "";
break;
case "One":
if(document.getElementById("LC_CCY").value =="KWD" ||document.getElementById("LC_CCY").value =="AED"||document.getElementById("LC_CCY").value =="BHD"||document.getElementById("LC_CCY").value =="IQD"||document.getElementById("LC_CCY").value =="JOD"){
decAmt = " And One Fill";
}
else if(document.getElementById("LC_CCY").value =="INR"||document.getElementById("LC_CCY").value =="PKR"){
decAmt = " And One Paise";
}
else if(document.getElementById("LC_CCY").value =="CHF"){
decAmt = " And One Centime";
}
else if(document.getElementById("LC_CCY").value =="CNY"){
decAmt = " And One Fen";
}
else if(document.getElementById("LC_CCY").value =="GBP"){
decAmt = " And One Pence";
}
else if(document.getElementById("LC_CCY").value =="EGP" ||document.getElementById("LC_CCY").value =="LBP" ){
decAmt = " And One Piastres";
}
else if(document.getElementById("LC_CCY").value =="NOK" || document.getElementById("LC_CCY").value =="SEK"){
decAmt = " And One Ore";
}
else if(document.getElementById("LC_CCY").value =="JPY"){
decAmt = " And One Cen";
}
else if(document.getElementById("LC_CCY").value =="PHP"||document.getElementById("LC_CCY").value =="MXN"){
decAmt = " And One Centavos";
}
else if(document.getElementById("LC_CCY").value =="OMR"){
decAmt = " And One Baiza";
}
else if(document.getElementById("LC_CCY").value =="QAR" ||document.getElementById("LC_CCY").value =="SAR"){
decAmt = " And One Dirhams";
}
else if(document.getElementById("LC_CCY").value =="RMB"){
decAmt = " And One Fen";
}
else if(document.getElementById("LC_CCY").value =="TRL"){
decAmt = " And One Kurus";
}
else if(document.getElementById("LC_CCY").value =="IDR"){
decAmt = " And One Sen";
}
else
decAmt = " And One Cent";
break;
default:
if(document.getElementById("LC_CCY").value =="KWD" ||document.getElementById("LC_CCY").value =="AED"||document.getElementById("LC_CCY").value =="BHD"||document.getElementById("LC_CCY").value =="IQD"||document.getElementById("LC_CCY").value =="JOD"){
decAmt = decAmt = " And " + decAmt + " Fills";
}
else if(document.getElementById("LC_CCY").value =="INR" || document.getElementById("LC_CCY").value =="PKR"){
decAmt = decAmt = " And " + decAmt + " Paises";
}
else if(document.getElementById("LC_CCY").value =="PHP"||document.getElementById("LC_CCY").value =="MXN"){
decAmt = decAmt = " And " + decAmt + " Centavos";
}
else if(document.getElementById("LC_CCY").value =="TRL"){
decAmt = decAmt = " And " + decAmt + " Kurus";
}
else if(document.getElementById("LC_CCY").value =="RMB"){
decAmt = decAmt = " And " + decAmt + " Fen";
}
else if(document.getElementById("LC_CCY").value =="QAR" ||document.getElementById("LC_CCY").value =="SAR"){
decAmt = decAmt = " And " + decAmt + " Dirhams";
}
else if(document.getElementById("LC_CCY").value =="JPY"){
decAmt = decAmt = " And " + decAmt + " Cens";
}
else if(document.getElementById("LC_CCY").value =="IDR"){
decAmt = decAmt = " And " + decAmt + " Sens";
}
else if(document.getElementById("LC_CCY").value =="CHF"){
decAmt = decAmt = " And " + decAmt + " Centimes";
}
else if(document.getElementById("LC_CCY").value =="CNY"){
decAmt = decAmt = " And " + decAmt + " Fens";
}
else if(document.getElementById("LC_CCY").value =="NOK"||document.getElementById("LC_CCY").value =="SEK"){
decAmt = decAmt = " And " + decAmt + " Ores";
}
else if(document.getElementById("LC_CCY").value =="OMR"){
decAmt = decAmt = " And " + decAmt + " Baiza";
}
else if(document.getElementById("LC_CCY").value =="GBP"){
decAmt = decAmt = " And " + decAmt + " Pence";
}
else if(document.getElementById("LC_CCY").value =="EBP" || document.getElementById("LC_CCY").value =="LBP"){
decAmt = decAmt = " And " + decAmt + " Piastres";
}
else
decAmt = " And " + decAmt + " Cents";
}
if (intAmt == "") {
intAmt = "Zero";
}
result = intAmt + decAmt;
return result;
}
function ConvertHundreds(aInputAmt) {
var result = "";
if (aInputAmt == "") {
return result;
}
var inputAmt = "000" + aInputAmt;
inputAmt = inputAmt.substr(inputAmt.length - 3, 3);
if (inputAmt.substr(0, 1) != "0") {
result = ConvertDigit(inputAmt.substr(0, 1)) + " Hundred ";
}
if (inputAmt.substr(1, 1) != "0") {
//if (result.length > 0) {
// result += " And ";
//}
result += ConvertTens(inputAmt.substr(1, 2));
} else if (inputAmt.substr(2, 1) != "0") {
//if (result.length > 0) {
//result += " And ";
//}
result += ConvertDigit(inputAmt.substr(2, 1));
}
return result;
}
function ConvertTens(aInputTens) {
var result = "";
if ( aInputTens.substr(0, 1) == "1") {
switch (aInputTens) {
case "10": result = "Ten";
break;
case "11": result = "Eleven"
break;
case "12": result = "Twelve"
break;
case "13": result = "Thirteen"
break;
case "14": result = "Fourteen"
break;
case "15": result = "Fifteen"
break;
case "16": result = "Sixteen"
break;
case "17": result = "Seventeen"
break;
case "18": result = "Eighteen"
break;
case "19": result = "Nineteen"
break;
}
} else {
switch (aInputTens.substr(0, 1)) {
case "2": result = "Twenty "
break;
case "3": result = "Thirty "
break;
case "4": result = "Forty "
break;
case "5": result = "Fifty "
break;
case "6": result = "Sixty "
break;
case "7": result = "Seventy "
break;
case "8": result = "Eighty "
break;
case "9": result = "Ninety "
break;
}
result = result + ConvertDigit(aInputTens.substr(1, 1))
}
return result;
}
function ConvertDigit(aInputDigit) {
var result = "";
switch (aInputDigit) {
case "1": result = "One"
break;
case "2": result = "Two"
break;
case "3": result = "Three"
break;
case "4": result = "Four"
break;
case "5": result = "Five"
break;
case "6": result = "Six"
break;
case "7": result = "Seven"
break;
case "8": result = "Eight"
break;
case "9": result = "Nine"
break;
default: result = ""
break;
}
return result;
}
function formatAndShow(evt){
var obj = getEvtTarget(evt);
alert(ConvertAmtToWords(obj.value));
_SYS_Batch_DecimalFormat();
}
//End
function _Release_onclick(value) {
try {
var vForm = document.forms[0];
if (!check_select_one()) {
var msg = _getClientMessage(90149);
_SYS_Display_WARN(msg);
return false;
}
if (!isFAPEnable(value)) {
return ;
}
//SUMCata();
var isCfm = null;
isCfm = window.confirm("Click OK to confirm.");
if (isCfm) {
value.disabled = true;
var vFuncID = value.getAttribute("itemFunc");
vForm.ID.value = vFuncID;
vForm.TRXL_TYPE.value = "S";
vForm.ITEM_ID.value = "Release";
vForm._TRX_STATUS.value = "LDGLIST";
setIsShowScreenFromCata();
var isAgreeObj = document.getElementById("C_IS_AGREE");
if(typeof(isAgreeObj)!="undefined"){
var refuseObj = document.getElementById("C_REFUSE_REASON");
if(refuseObj){
var refuseValue = refuseObj.value;
if(refuseValue!=null&&refuseValue.length>0){
isAgreeObj.value = "N";
}
}
}
//CEV2-0778 cash 20130709 s
var actionUrl = "../servlets/WSTrxManager";
actionUrl = encodeUrl(actionUrl);
vForm.action = actionUrl;
//vForm.action = "../servlets/WSTrxManager";
//CEV2-0778 cash 20130709 e
vForm.method = "post";
vForm.submit();
}
} catch (e) {
DisExcpt("SYS_DealButton", e);
}
}
//CEV2-0391 john.zhong 2011-02-17 S
function genCataRelease(){
try {
if (
(typeof(SYS_FUNCTION_TYPE) != "undefined" && SYS_FUNCTION_TYPE == "RE") ||
(typeof(ITEM_ID) != "undefined" && (ITEM_ID == "Release"||ITEM_ID=="Authorize"))
) {
var relString = "";
relString += "";
var oRelDiv = document.createElement("div");
oRelDiv.setAttribute("id", "releaseTab");
oRelDiv.innerHTML = relString;
var headTab = document.getElementById("headerName");
var oHeadTabsParent = headTab.parentNode;
oHeadTabsParent.appendChild(oRelDiv);
}
}
catch (e) {
showExcpt("BaseFunc", e);
}
}
//CEV2-0391 john.zhong 2011-02-17 E
function _displ_sele(obj){
try {
var isMulti = false;
if(typeof(multiCheck)=="function"){
isMulti = multiCheck();
//alert(isMulti);
if (isMulti && needMulti=="T"){
SUMCata();
}
}
if (obj.checked) {
if (ITEM_ID != "Unlock" && !isMulti) {
disableAnyOtherCheckBox(obj);
}
if (_ACT_TYPE == "CATA_SECU") {
}
else {
checkDisableBtn(obj, true);
}
}
else {
if (_ACT_TYPE != "CATA_SECU") {
checkDisableBtn(obj, false);
}
}
}
catch (E) {
SYS_Display_Exception("BaseFunc", E);
}
}
function Cal_CCY_DESCRIPTION()
{
var LC_CCY = getFldValue("LC_CCY");
var ccyDesc="";
try{
switch (LC_CCY) {
case "AUD":
ccyDesc = "AUSTRALIAN DOLLAR";
break;
case "CAD":
ccyDesc = "CANADIAN DOLLAR";
break;
case "CHF":
ccyDesc = "SWISS FRANCS";
break;
case "DKK":
ccyDesc = "DANISH KRONE";
break;
case "EUR":
ccyDesc = "EURO";
break;
case "GBP":
ccyDesc = "POUND STERLING";
break;
case "HKD":
ccyDesc = "HONG KONG DOLLARS";
break;
case "INR":
ccyDesc = "INDIAN RUPEE";
break;
case "JPY":
ccyDesc = "YEN";
break;
case "KWD":
ccyDesc = "KUWAITI DINAR";
break;
case "NOK":
ccyDesc = "NORWEGIAN KRONE";
break;
case "NZD":
ccyDesc = "NEW ZEALAND DOLLAR";
break;
case "SEK":
ccyDesc = "SWEDISH KRONA";
break;
case "SGD":
ccyDesc = "SINGAPORE DOLLAR";
break;
case "USD":
ccyDesc = "US DOLLAR";
break;
case "AED":
ccyDesc = "U.A.E DIRHAM";
break;
case "BDT":
ccyDesc = "TAKA";
break;
case "BHD":
ccyDesc = "BAHRAINI DINAR";
break;
case "BSD":
ccyDesc = "BAHAMIAN DOLLAR";
break;
case "CNY":
ccyDesc = "YUAN RENMINBI";
break;
case "CYP":
ccyDesc = "CYPRUS POUND";
break;
case "EGP":
ccyDesc = "EGYPTIAN POUND";
break;
case "IDR":
ccyDesc = "RUPIAH";
break;
case "IQD":
ccyDesc = "IRAQI DINAR";
break;
case "JOD":
ccyDesc = "JORDANIAN DINAR ";
break;
case "LBP":
ccyDesc = "LEBANESE POUND";
break;
case "LKR":
ccyDesc = "SRI LANKA RUPEE";
break;
case "MXN":
ccyDesc = "MEXICAN NUEVO PESO ";
break;
case "OMR":
ccyDesc = "RIYAL OMANI";
break;
case "PHP":
ccyDesc = "PHILIPPINE PESO";
break;
case "PKR":
ccyDesc = "PAKISTAN RUPEE";
break;
case "QAR":
ccyDesc = "QATARI RIAL";
break;
case "RMB":
ccyDesc = "CHINESE YUAN";
break;
case "SAR":
ccyDesc = "SAUDI RIYAL";
break;
case "TRL":
ccyDesc = "TURKISH LIRA";
break;
case "YER":
ccyDesc = "YEMENI RIAL";
break;
}
setFldValue("CCY_DESCRIPTION", ccyDesc);
}catch(e){
showExcpt("IMLC_ApplyImpLc_Function", e);
}
}
/*
* Added the following Method to do the SWIFT Validation
* for all the SWIFT Related Fields
* By Praveen @28-APRIL-2009
*/
var splExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\>\<\!\|\?\,\'\/]/;
function Chk_SWFT_Vdt(val) {
try {
var strPass = val.value;
var strLength = strPass.length;
var lchar = strPass.charAt((strLength) - 1);
if(lchar.search(splExp) != -1) {
var updtValue = strPass.substring(0, (strLength) - 1);
val.value =updtValue;
}
} catch (e) {
showExcpt("IMLC_ApplyImpLc_Function", e);
}
}
/*
*Added the following Methods SYS_Edit_Image() and SYS_View_Image()
*to include the Image View Option in the CE BaseLine System as per Boubyan Bank's Requirement.
*
*/
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";
var thisdate = new Date();
var systime = thisdate.getTime();
var url = "../servlets/WSSUploadImaging?_ACT_TYPE=INQ_DATA&_INQ_TYPE=INQ_EDIT_DATA&" + "_SYS_UPLOADIMAGE_PARAM=null&IMG_REF_NO=001&_SYS_TIME="+systime;
//CEV2-0778 martin s
url = encodeUrl(url);
//End
window.open(url, "window", wStyle);
} catch (E) {
DisExcpt("BaseFunc", E);
}
}
function SYS_View_Image() {
try { //alert("in");
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;
var url = "../screen/SYS_ViewImaging.jsp?_ACT_TYPE=INQ_DATA&_INQ_TYPE=VIEW_TRX_HEADER&C_MAIN_REF=" +
vCMainRef+"&DATE="+new Date();
//cev2-0778 martin S
url = encodeUrl(url)
//End
window.open(url, "window", wStyle);
} catch (e) {
DisExcpt("BaseFunc", e);
}
}
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 S
function getDocument(displayInTopWin){
return displayInTopWin ? getTopWindow().document : document;
}
//CEV2-15-01-10 carly.wu add getTopWindow for document 20190911 E