function openRow(openrowobject) { var object=openrowobject; var temp=object.parentElement; var table=temp.parentElement; var id=object.xxrowid; for (var i=0;i 0) { if (delimitter == ' ') { while (cartLines[i].indexOf(' ') > 0) { cartLines[i] = cartLines[i].replace(' ', ' '); } } lineItems = cartLines[i].split(delimitter); if (isNaN(qtyColNo)) { qty = 1; } else { qty = parseInt(lineItems[qtyColNo - 1]); } partNo = lineItems[partColNo - 1]; // Strip off Quotations from the part number partNo = partNo.replace(/"/g, ''); partNo = partNo.replace(/\*/g, ''); partNo = partNo.replace(/\./g, ''); partNo = partNo.replace(/\s+/g, ''); partsList = partsList + qty + ',' + partNo + splitter; } else { alert('The delimiter you specified does not exist in the file.'); return false; } } break; } if (preview == 'Y' || fileType == 'EPC') { document.getElementById('oText1').value = partsList; document.getElementById('oText1').fireEvent('onChange'); alert('Please review the Quantity/Parts Pair in the text area and click on Copy Into Order to see prices.'); } else { document.getElementById('oText2').value = partsList; document.getElementById('oText2').fireEvent('onChange'); document.getElementById('copyToOrder').fireEvent('onClick'); } return true; } catch(e) { //e = 'ActiveX is not enabled in your browser. To enable ActiveX:\n'; //e = e + 'At the top of your browser, click on Tools, then Internet Options.\n'; //e = e + 'Go to the Security Tab and then click on the Custom Level Button.\n'; //e = e + 'Scroll down until you find the item \"Initialize and script ActiveX controls not marked as safe\"\n'; //e = e + 'and make sure it is set to \"Prompt\" and not "\Disable\".\n'; //e = e + 'Click on OK to exit out of Internet Options and try importing your file again.'; //alert(e); e = 'ActiveX is not enabled in your browser. To enable ActiveX, click OK and follow the instructions on the next page.\n'; var input_box=confirm(e); if (input_box==true) { window.open("/images/help/EnablingActiveX.htm"); } } } } function fireClickEvent(control) { if (document.all) { control.fireEvent('onclick'); } else { var clickEvent = document.createEvent('MouseEvent'); clickEvent.initEvent('click', false, true); control.dispatchEvent(clickEvent); } } function getWindowHeight() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } return myHeight; } function getTZDate() { var myDate = new Date(); var myYear = myDate.getFullYear(); var myMonth = myDate.getMonth(); var myDay = myDate.getDay(); var isDST = false; /* whether we are in Daylight Saving Time or not */ var timeZoneOffset = myDate.getTimezoneOffset() / 60; var TZ; var TZDate; switch (myYear) { case 2007: { if (Date.parse(myDate) < Date.parse("March 11, 2007") || Date.parse(myDate) > Date.parse("November 4, 2007")){isDST = false;} else {isDST = true;} break; } case 2008: { if (Date.parse(myDate) < Date.parse("March 9, 2008") || Date.parse(myDate) > Date.parse("November 2, 2008")){isDST = false;} else {isDST = true;} break; } case 2009: { if (Date.parse(myDate) < Date.parse("March 8, 2009") || Date.parse(myDate) > Date.parse("November 1, 2009")){isDST = false;} else {isDST = true;} break; } case 2010: { if (Date.parse(myDate) < Date.parse("March 14, 2010") || Date.parse(myDate) > Date.parse("November 7, 2010")){isDST = false;} else {isDST = true;} break; } case 2011: { if (Date.parse(myDate) < Date.parse("March 13, 2011") || Date.parse(myDate) > Date.parse("November 6, 2011")){isDST = false;} else {isDST = true;} break; } case 2012: { if (Date.parse(myDate) < Date.parse("March 11, 2012") || Date.parse(myDate) > Date.parse("November 4, 2012")){isDST = false;} else {isDST = true;} break; } } if (isDST) { switch (timeZoneOffset) { case 4:{TZ = "AST or EDT";break;} case 5:{TZ = "CDT";break;} case 6:{TZ = "MDT";break;} case 7:{TZ = "PDT";break;} } } else { switch (timeZoneOffset) { case 4:{TZ = "AST";break;} case 5:{TZ = "EST";break;} case 6:{TZ = "CST";break;} case 7:{TZ = "MST";break;} case 8:{TZ = "PST";break;} } } // Do not add the time zone unless they ask for it // TZDate = myDate.toLocaleString() + " (" + TZ + ")"; TZDate = myDate.toLocaleString(); return TZDate; } function disableSpclPrice() { var ind = document.getElementById('GRPNUM').selectedIndex; var isDisabled; var grptyp = document.getElementById('GRPNUM').options[ind].tag_GRPTYP; if (grptyp == 'P') { isDisabled = true; document.getElementById('validation').style.display = 'inline'; } else { isDisabled = false; document.getElementById('validation').style.display = 'none'; } var elm = document.getElementById('SPCLST'); elm.disabled = isDisabled; elm = document.getElementById('SPCPRC'); elm.disabled = isDisabled; elm = document.getElementById('SPCCOR'); elm.disabled = isDisabled; //elm = document.getElementById('SPCSPK'); //elm.disabled = isDisabled; elm = document.getElementById('SPCBRN'); elm.disabled = isDisabled; return true; } function selectAllChkbx() { var status; var val; var hiddenPart; if (document.getElementById('slctAll').checked) { status = true; val = 'Y'; } else { status = false; val = 'N'; } for(var i=0; i" + stdNavPanelGetWaitHTML(elOrdNav, "/images/wam/loading_animation.gif", "", "", "", "") + ""); elOrdNav.document.close(); } function is_invalideInput_SPCL(elmNumber) { var inputName; var qty; var sellPack; var d1; var d2; var counter = "0000"; if (elmNumber == 'a') { // Validate All Input Fields try { var table = document.getElementById('specials'); for (var i=0;i 0) { d1 = parseInt(qty/sellPack); d2 = parseFloat(qty/sellPack); // Check to see if the qty requested is multiply of sell pack if (d1 != d2) { alert('Quantities should be a multiple of their respective Sell Pack.'); return true; } } // Check to see if the qty requested is more than available quantity avlFlag = document.getElementById('Z1ALLOWFL').value; if (avlFlag == "2") { inputName = 'BLRDPNORD.' + counter + '.DCTAVLQTY'; avlQty = parseInt(document.getElementById(inputName).value); if (qty > avlQty) { alert('Requested Quantity cannot be more than available quantity for a line item.'); return true; } } } } counter = "0000"; } // Check for Warranty (RO) Number is this is a warranty order before placing the order var frghtFlag = document.getElementById('Z1FRALWFL').value; if (frghtFlag == 'Y') { if (stdrentry == 'P') { var rad = document.getElementsByName('Z2RADVAL'); if (rad != null) { if (rad[0].checked) { var roNum = document.getElementById('WARNUM').value; if (roNum == null || roNum == '') { alert('You have specified this order as a Warranty Order but have not entered the Warranty Number.'); return true; } } } } // Update the free freight usage updateUsedAllw(); } disableButtons_Ordrvw(); return false; } catch(e) { alert(e); return true; } } function Set_Cookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); // if the expires variable is set, make the correct expires time, the // current script below will set it for x number of days, to make it // for hours, delete * 24, for minutes, delete * 60 * 24 if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } //alert( 'today ' + today.toGMTString() );// this is for testing purpose only var expires_date = new Date( today.getTime() + (expires) ); //alert('expires ' + expires_date.toGMTString());// this is for testing purposes only document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString() ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function initRVWPage() { var table = document.getElementById('orderLines'); var divTag = ''; var dropdown = null; var id = '0000'; var rowNum = null; try { var frghtFlag = null; frghtFlag = document.getElementById('Z1FRALWFL').value; // Check if Warranty Question is rendered on the page (meaning the warehouse is using the Freight Allowance Program if (frghtFlag == 'Y') { // alert('Initializing ...'); // show/hide freight allowance question based on the value of Delivery Codes for (var i=0;i 0 && relCode == '$-') { divTag.style.display = 'inline'; } else { divTag.style.display = 'none'; } } else { divTag.style.display = 'none'; } } } catch (e) { alert(e); } } function showRO() { try { var frghtAllwnce = parseInt(document.getElementById('DXALLO').value); var d = document.getElementById('roNum'); var d2 = document.getElementById('frtQ'); var rad = document.getElementsByName('Z2RADVAL'); if (rad[0].checked) { d.style.display = 'inline'; d2.style.display = 'none'; } else { d.style.display = 'none'; if (frghtAllwnce == -99) { d2.style.display = 'none'; } else { d2.style.display = 'inline'; } document.getElementById('WARNUM').value = ''; } initRVWPage(); } catch (e) { alert(e); } } function updateUsedAllw() { try { var table = document.getElementById('orderLines'); var rad = null; var id = null; var currUsage = 0; for (var i=0;i= 0) { counter = counter.substr(1, 4 - j.toString().length) + j.toString(); if (elmName.indexOf("ZZPDATE") >= 0) { elmName = "ZZINDEX" + "." + counter + "." + "ZZPDATE"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); } if (elmName.indexOf("ZZPBRNCH") >= 0) { elmName = "ZZINDEX" + "." + counter + "." + "ZZPBRNCH"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); } if (elmName.indexOf("ZZPINVCE") >= 0) { elmName = "ZZINDEX" + "." + counter + "." + "ZZPINVCE"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); } if (elmName.indexOf("ZZPORDER") >= 0) { elmName = "ZZINDEX" + "." + counter + "." + "ZZPORDER"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); } if (elmName.indexOf("ZZPGENO") >= 0) { elmName = "ZZINDEX" + "." + counter + "." + "ZZPGENO"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); j++; } counter = "0000"; } } j = j - 1; postData = "&ZZINDEX..=" + j + postData; sendAJAXRequestWithPostData('w_HistoryList', 'TPORDHIST', 'Search', 'STDNEXT', nextPageFlag, 'ZZRENTRY', stdrentry, postData, true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function getDocDetail(dctordnum, dctordsts, dctbrnlid, dctinvnum, dctorddat, dctdlvdat, dctshpto, dctshpdsc, dctcstpoh, dctdlvfrm) { try { var lang = getLanguage(); var portNo = getPort(); var postData = ""; postData += "&" + "DCTORDNUM" + "=" + escape(dctordnum); postData += "&" + "DCTORDSTS" + "=" + escape(dctordsts); postData += "&" + "DCTBRNLID" + "=" + escape(dctbrnlid); postData += "&" + "DCTINVNUM" + "=" + escape(dctinvnum); postData += "&" + "DCTORDDAT" + "=" + escape(dctorddat); postData += "&" + "DCTDLVDAT" + "=" + escape(dctdlvdat); postData += "&" + "DCTSHPTO" + "=" + escape(dctshpto); postData += "&" + "DCTSHPDSC" + "=" + escape(dctshpdsc); postData += "&" + "DCTCSTPO#" + "=" + escape(dctcstpoh); postData += "&" + "DCTDLVFRM" + "=" + escape(dctdlvfrm); window.scroll(0,0); sendAJAXRequestWithPostData('w_OderDetail1', 'TPORDER', 'orderDetail', 'STDRENTRY', 1, 'STDRENTRY', 1, postData, true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function getStatementDetail(docNum, docDate) { try { var lang = getLanguage(); var portNo = getPort(); sendAJAXRequest('w_OderDetail1', 'ZZRENTRY', 'D', 'TPORDHIST', 'STMDetail', 'Z1DOCNUM', docNum, 'Z1DOCDATE', docDate, true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function viewDocList() { try { var lang = getLanguage(); var portNo = getPort(); var sts = stdGetFromDocumentByNameOrId(document, "DCTORDSTS_options"); var ordSts = sts.options[sts.selectedIndex].value; switch (ordSts) { case "S": sendAJAXRequest('w_HistoryList', 'ZZRENTRY', 'D', 'TPORDHIST', 'GetStatements', 'DCTORDSTS', ordSts, 'ZZRENTRY', 'D', true, lang, portNo); break; default: sendAJAXRequest('w_HistoryList', 'ZZRENTRY', 'D', 'TPORDHIST', 'Search', 'DCTORDSTS', ordSts, 'ZZRENTRY', 'D', true, lang, portNo); break; } return true; } catch(e) { alert(e); return true; } } function validateRegForm() { try { var errMsg = ''; var inputName = 'DXCONT'; var newPwd1; var newPw21; var inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9\s]*)$/)) {errMsg += '- Contact Name is required and should only include letters or numbers.
';} inputName = 'DXADD1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9\s@_\.#]*)$/)) {errMsg += '- Address Line 1 is required and should only include letters, numbers or @, _, # or .
';} inputName = 'DXCITY'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z])([-a-zA-Z\s]*)$/)) {errMsg += '- City is required and should only include letters.
';} inputName = 'DXSTAT'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z]){2}$/)) {errMsg += '- State is required and should only be 2 letters.
';} inputName = 'DXZIP'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9]*)$/)) {errMsg += '- Zip Code is required and should only include letters and numbers.
';} inputName = 'DXCTRY'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z])([-a-zA-Z\s]*)$/)) {errMsg += '- Country is required and should only include letters.
';} inputName = 'DXEML1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/)) {errMsg += '- Email Address is required and should be in the correct format.
';} inputName = 'ZZDXEML1'; if (stdGetFromDocumentByNameOrId(document, inputName) != null) { email2 = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != email2) {errMsg += '- Email Address and Confirm Email Address should match.
';} } inputName = 'DXTEL1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; // if (!inputValue.match(/((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}/)) {errMsg += '- Phone Number is required and should be in the correct format ((xxx)xxx-xxxx or xxx-xxx-xxxx).
';} if (!inputValue.match(/\d{10}/)) {errMsg += '- Phone Number is required and should only be numbers (no parentheses or dashes).
';} inputName = 'DXTPCT'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (parseInt(inputValue) <= 0) {errMsg += '- Please select a Business Type.
';} inputName = 'ZZNWPWD1'; if (stdGetFromDocumentByNameOrId(document, inputName) != null) { newPwd1 = stdGetFromDocumentByNameOrId(document, inputName).value; if ((newPwd1 != '') && (newPwd1 != null)) { if (!newPwd1.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9@_\.#]*)$/)) {errMsg += '- The new password should only include letters, numbers or @, _, # or .
';} inputName = 'ZZNWPWD2'; newPwd2 = stdGetFromDocumentByNameOrId(document, inputName).value; if (newPwd1 != newPwd2) {errMsg += '- The new password and the confirm password should be exactly the same.
';} } } // If password Hint Question Number is not present, the form is being viewed from Admin Console so Don't check the password answer inputName = 'DXPASH'; if (stdGetFromDocumentByNameOrId(document, inputName) != null) { inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (parseInt(inputValue) <= 0) {errMsg += '- Please select a Password Hint Question.
';} inputName = 'DXPASA'; if (stdGetFromDocumentByNameOrId(document, inputName) != null) { inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9\s]*)$/)) {errMsg += '- Password Hint Answer is required and should only include letters or numbers.
';} } } inputName = 'DXBSYC'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (parseInt(inputValue) <= 0) {errMsg += '- Please select a Business System.
';} if (errMsg != '') { errMsg = 'Errors listed below were found in your registration form. Please correct them and click continue.
' + errMsg; document.getElementById('errMsgs').style.display = 'block'; document.getElementById('errMsgs').innerHTML = errMsg; return true; } else { return false; } } catch(e) { alert(e); return true; } } function getLanguage() { try { var query = location.search.substring(1); var pairs = query.split("+"); for (var i = 0; i < pairs.length; i++) { var pos = pairs[i].indexOf('='); if (pos == -1) continue; var argname = pairs[i].substring(0,pos); if (argname.toLowerCase() == 'language' || argname.toLowerCase() == 'lang' || argname.toLowerCase() == 'l') { var lang = pairs[i].substring(pos+1); break; } } return lang; } catch(e) { alert(e); return 'ENG'; } } function getPort() { try { return location.port; } catch(e) { alert(e); return null; } } function getOsiData(partnm, partky, lnecde, prddsc, lstprc, cusprc) { try { InsertHidden(document.LANSA, 'PARTNM', partnm); InsertHidden(document.LANSA, 'PARTKY', partky); InsertHidden(document.LANSA, 'ZZLNECDE', lnecde); InsertHidden(document.LANSA, 'ZZPRDDSC', prddsc); InsertHidden(document.LANSA, 'ZZLSTPRC', lstprc); InsertHidden(document.LANSA, 'ZZCUSPRC', cusprc); return true; } catch(e) { alert(e.message); } } function addOsiToCart(part, partky, lnecde, ordqtyFld, brnlidFld, prddsc, lstprc, cusprc, corprc, selpck, i, code01) { try { var divName = "d_" + i; var rowQty = stdGetFromDocumentByNameOrId(document, ordqtyFld).value; var elBranch = stdGetFromDocumentByNameOrId(document, brnlidFld); var rowBranch = elBranch.value; var lline = 0; /*Since the line number is not know yet*/ InsertHidden(document.LANSA, 'PART', part); InsertHidden(document.LANSA, 'PARTKY', partky); InsertHidden(document.LANSA, 'LNECDE',lnecde); InsertHidden(document.LANSA, 'LLINE', lline); InsertHidden(document.LANSA, 'ORDQTY', rowQty); InsertHidden(document.LANSA, 'BRNLID', rowBranch); InsertHidden(document.LANSA, 'AVLQTY', rowQty); InsertHidden(document.LANSA, 'PRDDSC', prddsc); InsertHidden(document.LANSA, 'LSTPRC', lstprc); InsertHidden(document.LANSA, 'CUSPRC', cusprc); InsertHidden(document.LANSA, 'CORPRC', corprc); InsertHidden(document.LANSA, 'SELPCK', selpck); InsertHidden(document.LANSA, 'CODE01', code01); if (document.getElementById(divName)) { if (document.getElementById(divName).style.display == 'none') { document.getElementById(divName).style.display = 'inline'; } } return true; } catch(e) { alert(e.message); } } function toggleOEColmns(module) { try { var winWidth; if (typeof(window.innerWidth) == 'number') { //Non-IE winWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' winWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible winWidth = document.body.clientWidth; } var normalDisp; var oeDisp; var partsTbl = document.getElementById('partsTbl'); var rows = partsTbl.getElementsByTagName('tr'); var col_h = document.getElementById('oecatgrp_h'); var toggleAnch = document.getElementById('toggleOE'); if (col_h.style.display == 'none') { oeDisp = 'block'; normalDisp = 'none'; toggleAnch.innerText = 'Hide OE Information'; if (module == "catalog" && winWidth < 1024) { var prddscH = partsTbl.rows[0].getElementsByTagName('th')[6]; prddscH.style.width = 110 + 'px'; } } else { oeDisp = 'none'; normalDisp = 'block'; toggleAnch.innerText = 'Show OE Information'; } for (var row = 0; row < rows.length; row++) { switch (module) { case "orderparts": if (row == 0) { var cells_h = rows[row].getElementsByTagName('th'); cells_h[5].style.display = oeDisp; cells_h[6].style.display = normalDisp; cells_h[7].style.display = oeDisp; cells_h[9].style.display = oeDisp; } else { var cells = rows[row].getElementsByTagName('td'); cells[5].style.display = oeDisp; cells[6].style.display = normalDisp; cells[7].style.display = oeDisp; cells[9].style.display = oeDisp; } break; case "catalog": var rowid = rows[row].id; if (rowid.toUpperCase().search('P') > 0 || row == 0) { if (row == 0) { var cells_h = rows[row].getElementsByTagName('th'); cells_h[4].style.display = normalDisp; cells_h[5].style.display = oeDisp; cells_h[7].style.display = oeDisp; cells_h[8].style.display = normalDisp; cells_h[9].style.display = oeDisp; cells_h[11].style.display = oeDisp; if (winWidth < 1024) { cells_h[16].style.display = normalDisp; cells_h[17].style.display = normalDisp; } } else { var cells = rows[row].getElementsByTagName('td'); cells[4].style.display = normalDisp; cells[5].style.display = oeDisp; cells[7].style.display = oeDisp; cells[8].style.display = normalDisp; cells[9].style.display = oeDisp; cells[11].style.display = oeDisp; if (winWidth < 1024) { cells[15].style.display = normalDisp; cells[16].style.display = normalDisp; } } } break; } } } catch(e) { alert(e.message); } } /* ******************************************************************************************** */ /* Admin Console Functions */ /* ******************************************************************************************** */ function togglecols1() { try { var i; var th1; var td1; for (var j= 1; j < 9; j++) { i = 1; td1 = "c" + j + "_" + i; th1 = "c" + j; if (document.getElementById(th1).style.display == 'none' || document.getElementById(th1).style.display == '' ) { document.getElementById(th1).style.display = 'block'; document.getElementById('tbl').style.width = "100%"; } else { document.getElementById(th1).style.display = 'none'; document.getElementById('tbl').style.width = "550px"; } while (document.getElementById(td1)) { if (document.getElementById(td1).style.display == 'none' || document.getElementById(td1).style.display == '') { document.getElementById(td1).style.display = 'block'; } else { document.getElementById(td1).style.display = 'none'; } i = i + 1; td1= "c" + j + "_" + i; } } } catch(e) { alert(e); } } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function ExportToExcel1() { try { var oEx = new ActiveXObject("Excel.Application"); var oBo = oEx.Workbooks.Add; var oSh = oBo.Worksheets(1); var i; var txt; for (i=1; i < salesTbl.rows(0).cells.length; i++) { if (salesTbl.rows(0).cells(i).style.display == 'block' || (salesTbl.rows(0).cells(i).style.display == '' && salesTbl.rows(0).cells(i).className != 'addcol1')) { oSh.Cells(1, i) = trim(salesTbl.rows(0).cells(i).innerText); } } for (i=1; i < salesTbl.rows.length; i++) { txt = trim(salesTbl.rows(i).cells(1).innerText); if (txt.toLowerCase() != "totals") { for (var j=1;j < salesTbl.rows(i).cells.length; j++) { if (salesTbl.rows(i).cells(j).style.display == 'block' || (salesTbl.rows(i).cells(j).style.display == '' && salesTbl.rows(i).cells(j).className != 'addcol1')) { oSh.Cells(i + 1, j) = salesTbl.rows(i).cells(j).innerText; } } } } oEx.Visible = true; oEx.UserControl = true; } catch(e) { alert(e.message); oSh = null; oBo.Close(false); oBo = null; oEx.Quit(); oEx = null; } } function togglecols2() { try { var i; var th1; var td1; var td2; for (var j= 1; j < 9; j++) { i = 1; td1 = "c" + j + "_" + i; th1 = "c" + j; td2 = "c" + j + "_f"; if (document.getElementById(th1).style.display == 'none' || document.getElementById(th1).style.display == '' ) { document.getElementById(th1).style.display = 'block'; document.getElementById('tbl').style.width = "100%"; document.getElementById(td2).style.display = 'block'; } else { document.getElementById(th1).style.display = 'none'; document.getElementById('tbl').style.width = "700px"; document.getElementById(td2).style.display = 'none'; } while (document.getElementById(td1)) { if (document.getElementById(td1).style.display == 'none' || document.getElementById(td1).style.display == '') { document.getElementById(td1).style.display = 'block'; } else { document.getElementById(td1).style.display = 'none'; } i = i + 1; td1= "c" + j + "_" + i; } } } catch(e) { alert(e); } } function togglecols3() { try { var i; var th1; var td1; var td2; for (var j= 1; j < 9; j++) { i = 1; td1 = "c" + j + "_" + i; th1 = "c" + j; td2 = "c" + j + "_f"; if (document.getElementById(th1).style.display == 'none' || document.getElementById(th1).style.display == '' ) { document.getElementById(th1).style.display = 'block'; document.getElementById('tbl').style.width = "100%"; document.getElementById(td2).style.display = 'block'; } else { document.getElementById(th1).style.display = 'none'; document.getElementById('tbl').style.width = "900px"; document.getElementById(td2).style.display = 'none'; } while (document.getElementById(td1)) { if (document.getElementById(td1).style.display == 'none' || document.getElementById(td1).style.display == '') { document.getElementById(td1).style.display = 'block'; } else { document.getElementById(td1).style.display = 'none'; } i = i + 1; td1= "c" + j + "_" + i; } } } catch(e) { alert(e); } } function togglestats() { try { var d = document.getElementById('salesstats'); if (d.style.display == 'block') { d.style.display = 'none'; } else { d.style.display = 'block'; } } catch(e) { alert(e); } } function refreshUsrAuth1() { try { var lang = getLanguage(); var portNo = getPort(); var userId = document.getElementById('DCUSER').value; var userWd = document.getElementById('DCWHID').value; sendAJAXRequest('UsrAuth1', 'STDRENTRY', 'D', 'TPADMIN', 'UsrAuth1', 'DCWHID', userWd, 'DCUSER', userId, true, lang, portNo); } catch(e) { alert(e); } } function updateUsrAuth1() { try { var lang = getLanguage(); var portNo = getPort(); var userId = document.getElementById('DCUSER').value; var userWd = document.getElementById('DCWHID').value; var postData = ""; var elmName; var counter = "0000"; var j = 1; for (var i= 0; i < document.forms[0].elements.length; i++) { elmName = document.forms[0].elements[i].name; if (elmName.indexOf("DOCS") >= 0) { counter = counter.substr(1, 4 - j.toString().length) + j.toString(); if (elmName.indexOf("TCALLW_PROXY") >= 0) { elmName = "DOCS" + "." + counter + "." + "TCALLW"; if (document.getElementById("__DOCS." + counter + ".TCALLW_PROXY").checked == true) { postData += "&" + elmName + "=Y"; } else { postData += "&" + elmName + "=N"; } } if (elmName.indexOf("TSCODE") >= 0) { elmName = "DOCS" + "." + counter + "." + "TSCODE"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); } if (elmName.indexOf("TSDESC") >= 0) { elmName = "DOCS" + "." + counter + "." + "TSDESC"; postData += "&" + elmName + "=" + escape(document.forms[0].elements[i].value); j++; } counter = "0000"; } } j = j - 1; postData = "&DOCS..=" + j + postData; postData += "&" + "DCWHID" + "=" + escape(userWd); sendAJAXRequestWithPostData('UsrAuth1', 'TPADMIN', 'UsrAuth1', 'STDRENTRY', 'U', 'DCUSER', userId, postData, true, lang, portNo); return true; } catch(e) { alert(e); return true; } } function validateProfileInput() { try { var errMsg = ''; var inputName = 'DXCONT'; var inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9\s]*)$/)) {errMsg += '- Contact Name is required and should only include letters or numbers.
';} } inputName = 'DXADD1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9\s@_\.#]*)$/)) {errMsg += '- Address Line 1 is required and should only include letters, numbers or @, _, # or .
';} } inputName = 'DXCITY'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z])([-a-zA-Z\s]*)$/)) {errMsg += '- City is required and should only include letters.
';} } inputName = 'DXSTAT'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z]){2}$/)) {errMsg += '- State is required and should only be 2 letters.
';} } inputName = 'DXZIP'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z]|[0-9])([-a-zA-Z0-9]*)$/)) {errMsg += '- Zip Code is required and should only include letters and numbers.
';} } inputName = 'DXCTRY'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([a-zA-Z])([-a-zA-Z\s]*)$/)) {errMsg += '- Country is required and should only include letters.
';} } inputName = 'DXEML1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; if (inputValue != null && inputValue != '') { if (!inputValue.match(/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/)) {errMsg += '- Email Address is required and should be in the correct format.
';} } inputName = 'DXTEL1'; inputValue = stdGetFromDocumentByNameOrId(document, inputName).value; // if (!inputValue.match(/((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}/)) {errMsg += '- Phone Number is required and should be in the correct format ((xxx)xxx-xxxx or xxx-xxx-xxxx).
';} if (inputValue != null && inputValue != '') { if (!inputValue.match(/\d{10}/)) {errMsg += '- Phone Number is required and should only be numbers (no parentheses or dashes).
';} } if (errMsg != '') { errMsg = 'Errors listed below were found in your registration form. Please correct them and click continue.
' + errMsg; document.getElementById('errMsgs').style.display = 'block'; document.getElementById('errMsgs').innerHTML = errMsg; return true; } else { return false; } } catch(e) { alert(e); return true; } } function addNewCustType() { try { stdGetFromDocumentByNameOrId(document, 'newtype').style.display = 'block'; } catch(e) { alert(e); } return false; } function showCustomers(wtwdct, wdid) { try { var lang = getLanguage(); var portNo = getPort(); var divName = 'c_' + wtwdct; var targetDiv = stdGetFromDocumentByNameOrId(document, divName); var disp = targetDiv.style.display; if (disp == 'none' || disp == '') { // Show Customers targetDiv.style.display = 'block'; targetDiv.innerText = 'Showing Customers...'; // Call the getPartTypes webroutine using Ajax Handlers sendAJAXRequest(divName, 'STDRENTRY', 1, 'TPADMIN2', 'custsForType', 'WTWDCT', wtwdct, 'DWWHID', wdid, true, lang, portNo); return true; } else { // Collapse Sub Types targetDiv.style.display = 'none'; return true; } } catch(e) { alert(e); return true; } } function refreshSet1() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = stdGetFromDocumentByNameOrId(document, 'DWWHID').value; sendAJAXRequest('set1', 'STDRENTRY', 'D', 'TPADMIN2', 'setWebSite', 'DWWHID', wdid, 'STDRENTRY', 'D', true, lang, portNo); } catch(e) { alert(e); } } function updateWebSite() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; var website = stdGetFromDocumentByNameOrId(document, 'DWWEBA').value; sendAJAXRequest('set1', 'STDRENTRY', 'B', 'TPADMIN2', 'setWebSite', 'DWWHID', wdid, 'DWWEBA', website, true, lang, portNo); } catch(e) { alert(e); } } function refreshSet2() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = stdGetFromDocumentByNameOrId(document, 'DWWHID').value; sendAJAXRequest('set2', 'STDRENTRY', 'D', 'TPADMIN2', 'setLandPage', 'DWWHID', wdid, 'STDRENTRY', 'D', true, lang, portNo); } catch(e) { alert(e); } } function updateLandPage() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; var landPageElm = stdGetFromDocumentByNameOrId(document, 'DWINIPAGE'); var landPage = landPageElm.options[landPageElm.selectedIndex].value; sendAJAXRequest('set2', 'STDRENTRY', 'A', 'TPADMIN2', 'setLandPage', 'DWWHID', wdid, 'DWINIPAGE', landPage, true, lang, portNo); } catch(e) { alert(e); } } function refreshSet3() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = stdGetFromDocumentByNameOrId(document, 'DWWHID').value; sendAJAXRequest('set3', 'STDRENTRY', 'D', 'TPADMIN2', 'setSpclView', 'DWWHID', wdid, 'STDRENTRY', 'D', true, lang, portNo); } catch(e) { alert(e); } } function updateSpclView() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; var spcViewElm = stdGetFromDocumentByNameOrId(document, 'Z1SPCVNO'); var spcView = 0; for (i = 0; i < 2; i++) { if (spcViewElm[i].checked == true) {spcView = i + 1;} } sendAJAXRequest('set3', 'STDRENTRY', 'C', 'TPADMIN2', 'setSpclView', 'DWWHID', wdid, 'Z1SPCVNO', spcView, true, lang, portNo); } catch(e) { alert(e); } } function refreshSet4() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = stdGetFromDocumentByNameOrId(document, 'DWWHID').value; sendAJAXRequest('set4', 'STDRENTRY', 'D', 'TPADMIN2', 'setCustomFlds', 'DWWHID', wdid, 'STDRENTRY', 'D', true, lang, portNo); } catch(e) { alert(e); } } function updateCustomFlds() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; var postData = ""; var elmName; var counter1 = "0000"; var c1 = 0 var counter2 = "0000"; var c2 = 0 var counter3 = "0000"; var c3 = 0 var j1 = 1; var j2 = 1; var j3 = 1; for (var i= 0; i < document.forms['LANSA'].elements.length; i++) { elmName = document.forms['LANSA'].elements[i].name; if (elmName != null) { if (elmName.indexOf("CFLDS2") >= 0) { counter1 = counter1.substr(1, 4 - j1.toString().length) + j1.toString(); if (elmName.indexOf("RFFLID") >= 0) { elmName = "CFLDS2" + "." + counter1 + "." + "RFFLID"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c1++; } if (elmName.indexOf("RFFLTY") >= 0) { elmName = "CFLDS2" + "." + counter1 + "." + "RFFLTY"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c1++; } if (elmName.indexOf("RFFLHD") >= 0) { elmName = "CFLDS2" + "." + counter1 + "." + "RFFLHD"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c1++; } if (elmName.indexOf("Z1FLDTYP") >= 0) { elmName = "CFLDS2" + "." + counter1 + "." + "Z1FLDTYP"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c1++; } if (c1 == 4) { j1++; c1 = 0; } counter1 = "0000"; } if (elmName.indexOf("CFLDVS_D2") >= 0) { counter2 = counter2.substr(1, 4 - j2.toString().length) + j2.toString(); if (elmName.indexOf("RVFLID") >= 0) { elmName = "CFLDVS_D2" + "." + counter2 + "." + "RVFLID"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c2++; } if (elmName.indexOf("RVFLSQ") >= 0) { if (elmName.indexOf("ZZRVFLSQ") >= 0) { elmName = "CFLDVS_D2" + "." + counter2 + "." + "ZZRVFLSQ"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c2++; } else { elmName = "CFLDVS_D2" + "." + counter2 + "." + "RVFLSQ"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c2++; } } if (elmName.indexOf("RVFLVL") >= 0) { elmName = "CFLDVS_D2" + "." + counter2 + "." + "RVFLVL"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c2++; } if (c2 == 4) { j2++; c2 = 0; } counter2 = "0000"; } if (elmName.indexOf("CFLDVS_C2") >= 0) { counter3 = counter3.substr(1, 4 - j3.toString().length) + j3.toString(); if (elmName.indexOf("RVFLID") >= 0) { elmName = "CFLDVS_C2" + "." + counter3 + "." + "RVFLID"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c3++; } if (elmName.indexOf("RVFLSQ") >= 0) { if (elmName.indexOf("ZZRVFLSQ") >= 0) { elmName = "CFLDVS_C2" + "." + counter3 + "." + "ZZRVFLSQ"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c3++; } else { elmName = "CFLDVS_C2" + "." + counter3 + "." + "RVFLSQ"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c3++; } } if (elmName.indexOf("RVFLVL") >= 0) { elmName = "CFLDVS_C2" + "." + counter3 + "." + "RVFLVL"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c3++; } if (c3 == 4) { j3++; c3 = 0; } counter3 = "0000"; } } } j1 = j1 - 1; j2 = j2 - 1; j3 = j3 - 1; postData = "&CFLDS2..=" + j1 + postData; postData = "&CFLDVS_D2..=" + j2 + postData; postData = "&CFLDVS_C2..=" + j3 + postData; sendAJAXRequestWithPostData('set4', 'TPADMIN2', 'setCustomFlds', 'STDRENTRY', 'U', 'DWWHID', wdid, postData, true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function addNewFldValue(fldid, type) { try { var c = 0; var counter = "0000"; var listName; var spanId; switch (type) { case "L": listName = "CFLDVS_D2"; spanId = 'l_' + fldid; break; case "M": listName = "CFLDVS_C2"; spanId = 'm_' + fldid; break; } for (var i= 0; i < document.forms['LANSA'].elements.length; i++) { elmName = document.forms['LANSA'].elements[i].name; if (elmName != null && elmName.indexOf(listName) >= 0 && elmName.indexOf("RVFLID") >= 0) {c++;} } c++; counter = counter.substr(1, 4 - c.toString().length) + c.toString(); var newID = document.createElement('input'); newID.setAttribute('id', listName + '.' + counter + '.RVFLID'); newID.setAttribute('name', listName + '.' + counter + '.RVFLID'); newID.setAttribute('class', 'utext'); newID.setAttribute('type', 'hidden'); newID.setAttribute('value', fldid); document.getElementById(spanId).appendChild(newID); var newSeq = document.createElement('input'); newSeq.setAttribute('id', listName + '.' + counter + '.RVFLSQ'); newSeq.setAttribute('name', listName + '.' + counter + '.RVFLSQ'); newSeq.setAttribute('class', 'number'); newSeq.style.width = '30px'; newSeq.setAttribute('value', '000'); document.getElementById(spanId).appendChild(newSeq); var newVal = document.createElement('input'); newVal.setAttribute('id', listName + '.' + counter + '.RVFLVL'); newVal.setAttribute('name', listName + '.' + counter + '.RVFLVL'); newVal.setAttribute('class', 'utext'); newVal.style.width = '180px'; newVal.setAttribute('value', 'Enter a value'); document.getElementById(spanId).appendChild(newVal); var newSeq2 = document.createElement('input'); newSeq2.setAttribute('id', listName + '.' + counter + '.ZZRVFLSQ'); newSeq2.setAttribute('name', listName + '.' + counter + '.ZZRVFLSQ'); newSeq2.setAttribute('class', 'number'); newSeq2.setAttribute('type', 'hidden'); newSeq2.setAttribute('value', '000'); document.getElementById(spanId).appendChild(newSeq2); var br = document.createElement('br'); document.getElementById(spanId).appendChild(br); document.getElementById(spanId).style.display = 'block'; } catch(e) { alert(e.message); } return false; } function deleteCustFld(fieldId) { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; sendAJAXRequest('set4', 'RFFLID', fieldId, 'TPADMIN2', 'dltCustFld', 'DWWHID', wdid, 'STDRENTRY', 'D', true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function deleteCustFldValue(seqNum, fieldId) { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; sendAJAXRequest('set4', 'RVFLID', fieldId, 'TPADMIN2', 'dltCustFldVal', 'DWWHID', wdid, 'RVFLSQ', seqNum, true, lang, portNo); return true; } catch(e) { alert(e.message); return true; } } function addNewCustFld(stdrentry) { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; sendAJAXRequest('newfld', 'STDRENTRY', stdrentry, 'TPADMIN2', 'addCustFld', 'DWWHID', wdid, 'STDRENTRY', stdrentry, true, lang, portNo); return true; } catch(e) { alert(e.message); } } function addNewFldValue2(fldid) { try { var c = 0; var counter = "0000"; var listName = "CFLDVS_D3"; var spanId = 'l_' + fldid; for (var i= 0; i < document.forms['LANSA'].elements.length; i++) { elmName = document.forms['LANSA'].elements[i].name; if (elmName != null && elmName.indexOf(listName) >= 0 && elmName.indexOf("RVFLID") >= 0) {c++;} } c++; counter = counter.substr(1, 4 - c.toString().length) + c.toString(); var newID = document.createElement('input'); newID.setAttribute('id', listName + '.' + counter + '.RVFLID'); newID.setAttribute('name', listName + '.' + counter + '.RVFLID'); newID.setAttribute('class', 'utext'); newID.setAttribute('type', 'hidden'); newID.setAttribute('value', fldid); document.getElementById(spanId).appendChild(newID); var newSeq = document.createElement('input'); newSeq.setAttribute('id', listName + '.' + counter + '.RVFLSQ'); newSeq.setAttribute('name', listName + '.' + counter + '.RVFLSQ'); newSeq.setAttribute('class', 'number'); newSeq.style.width = '30px'; newSeq.setAttribute('value', '000'); document.getElementById(spanId).appendChild(newSeq); var newVal = document.createElement('input'); newVal.setAttribute('id', listName + '.' + counter + '.RVFLVL'); newVal.setAttribute('name', listName + '.' + counter + '.RVFLVL'); newVal.setAttribute('class', 'utext'); newVal.style.width = '180px'; newVal.setAttribute('value', 'Enter a value'); document.getElementById(spanId).appendChild(newVal); var br = document.createElement('br'); document.getElementById(spanId).appendChild(br); document.getElementById(spanId).style.display = 'block'; } catch(e) { alert(e.message); } return false; } function createNewCustomFld() { try { var lang = getLanguage(); var portNo = getPort(); var wdid = document.getElementById('DWWHID').value; var fldid = document.getElementById('Z2RFFLID').value; var fldtype = document.getElementById('Z2RFFLTY').value; var fldheader = document.getElementById('Z2RFFLHD').value; var postData = ""; var elmName; var counter = "0000"; var c = 0 var j = 1; for (var i= 0; i < document.forms['LANSA'].elements.length; i++) { elmName = document.forms['LANSA'].elements[i].name; if (elmName != null) { if (elmName.indexOf("CFLDVS_D3") >= 0) { counter = counter.substr(1, 4 - j.toString().length) + j.toString(); if (elmName.indexOf("RVFLID") >= 0) { elmName = "CFLDVS_D3" + "." + counter + "." + "RVFLID"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c++; } if (elmName.indexOf("RVFLSQ") >= 0) { elmName = "CFLDVS_D3" + "." + counter + "." + "RVFLSQ"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c++; } if (elmName.indexOf("RVFLVL") >= 0) { elmName = "CFLDVS_D3" + "." + counter + "." + "RVFLVL"; postData += "&" + elmName + "=" + escape(document.forms['LANSA'].elements[i].value); c++; } if (c == 3) { j++; c = 0; } counter = "0000"; } } } j = j - 1; postData = "&CFLDVS_D3..=" + j + postData; postData += "&" + "Z2RFFLID" + "=" + escape(fldid); postData += "&" + "Z2RFFLTY" + "=" + escape(fldtype); postData += "&" + "Z2RFFLHD" + "=" + escape(fldheader); sendAJAXRequestWithPostData('set4', 'TPADMIN2', 'addCustFld', 'STDRENTRY', 'A', 'DWWHID', wdid, postData, true, lang, portNo); return false; } catch(e) { alert(e.message); return false; } } /* ******************************************************************************************** */