function searchCode(start_from) { url='index.php?module=EcmProducts&action=searchCode&start='+start_from+'&to_pdf=1'; var req=mint.Request(); req.OnSuccess = function() { document.getElementById("code").value = this.responseText; }; req.Send(url); } function checkCode(code) { if (document.forms.EditView.record.value!="") return; url='index.php?module=EcmProducts&action=checkCode&code='+code+'&to_pdf=1'; var req=mint.Request(); req.OnSuccess = function() { if (this.responseText=='0') alert(MOD.LBL_CODE_ERROR); if (this.responseText=='2') alert('Istnieje kod typu: '+code+'_-----'); }; req.Send(url); } function freeCodes(code) { window.open("index.php?module=EcmProducts&action=freeCodes&code="+code, "_blank"); } function getBaseComponents(type) { if (type == 1) var code = OPT.base_code; if (type == 2) var code = document.getElementById("components_code").value; url='index.php?module=EcmProducts&action=getBaseComponents&product_code='+code+'&to_pdf=1'; var req=mint.Request(); req.OnSuccess = function() { ItemListClear(); OPT.base_code = null; try { pl = eval(this.responseText); for(x in pl) { var pl_row = pl[x]; if(!pl[x].code || pl[x].code == '') {} else N.addRow().setData(pl_row); } } catch(err) { pl = null; }; }; req.Send(url); } function SetTabIndexs() { var main = document.getElementById('main'); var td = main.getElementsByTagName('td'); var selectedTable = null; //var selectingColor = 'red'; //var selectingCellTable = 'green'; var TableIndex = 0; for(var i=0; i0) N.row(0).deleteRow(); } function getFormPost(action) { if(!action) action = 'previewPDF'; var pd = 'to_pdf=1'+'&module=EcmQuotes&action='+action+'&record='+document.forms.EditView.record.value; pd += '&cache=fromJava'+ItemListSave(true); var pd2 = new Object(); pd2['module'] = 'EcmQuotes'; pd2['action'] = action; pd2['record'] = document.forms.EditView.record.value; pd2['to_pdf'] = '1'; pd2['cache'] = 'fromJava'; document.forms.EditView.position_list.value = ''; document.forms["EditView"].action.value = action; var tmp; for(var i=0; i').replace(/'/gi,'\'').replace(/"/gi,'"');; var e = document.getElementById(the_key); if(e) { e.value = displayValue; } } } //if(N.selectedRow) N.selectedRow.calculateTotal(); }; var itd = document.getElementById('itemsTableDIV'); itd.onscroll = function() { if(!AjaxSearchProducts.AjaxSearchFrozen) if(N.selectedCell && N.selectedCell.LeftPosition && N.selectedCell.TopPosition) { var top = N.selectedCell.TopPosition+N.selectedCell.offsetHeight; if(((N.selectedCell.offsetTop+N.selectedCell.offsetHeight-this.scrollTop) > (this.offsetHeight+5)) || ((N.selectedCell.offsetTop-this.scrollTop) < (-10))) AjaxSearchProducts.div.style.display = 'none'; else AjaxSearchProducts.div.style.display = ''; AjaxSearchProducts.div.style.top = top - this.scrollTop; } } ItemListSave = function(json) { //if(CheckDiscount() == -1) { ERROR = true; return false; } //calculateTotal(); var data = new Object(); for(var i=0; i