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; i
0) 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; iYours browser not accept iframes!";
}
}
);
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_quotes) {
alert('This option is disabled for You.');
document.forms.EditView.status.value = ((OPT.old_status)?OPT.old_status:'');
}
OPT.old_status = document.forms.EditView.status.value;
}
function CheckDiscount(noAlert) {
var discount = 0;
var tmp = UserFormatNumberToNumber(document.getElementById('discount').value);
if(tmp == -1) {
if(!noAlert)
alert(MOD['LBL_DISCOUNT_ERROR']+' ('+document.getElementById('discount').value+')');
discount = -1;
document.getElementById('discount').style.color = 'red';
} else {
discount = tmp;
document.getElementById('discount').value = NumberToUserFormatNumber(discount);
document.getElementById('discount').style.color = 'black';
}
return discount;
}
//document.getElementById('previewPDF').innerHTML = "";
//ProductListSave();
//YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},this.postData());
var AjaxSearchProducts;
var parentFL;
var productFL;
var contactFL;
addEvent(
window,
'load',
function () {
var CHANGER = new changer();
CHANGER.interval = 500;
set_focus();
//initialize table
//N = new MyTable('itemsTable');
//N.divParent = document.getElementById('itemsTableDIV');
var from_popup_return = false;
function returnedData(popup_reply_data) {
from_popup_return = true;
var form_name = popup_reply_data.form_name;
var name_to_value_array = popup_reply_data.name_to_value_array;
for (var the_key in name_to_value_array) {
if(the_key == 'toJSON'){}
else {
var displayValue=name_to_value_array[the_key].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').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