Add JS files
This commit is contained in:
1107
modules/EcmFkVatKinds/EcmFkVatKinds.js
Executable file
1107
modules/EcmFkVatKinds/EcmFkVatKinds.js
Executable file
File diff suppressed because it is too large
Load Diff
985
modules/EcmFkVatKinds/EcmFkVatKindsDetailView.js
Executable file
985
modules/EcmFkVatKinds/EcmFkVatKindsDetailView.js
Executable file
@@ -0,0 +1,985 @@
|
||||
/* because of perfect code portability! */
|
||||
document.forms.EditView = document.forms.DetailView;
|
||||
|
||||
|
||||
var CHANGER = new changer();
|
||||
CHANGER.interval = 500;
|
||||
|
||||
/* Decree */
|
||||
addEvent(
|
||||
window,
|
||||
'load',
|
||||
function() {
|
||||
// console.clear();
|
||||
// console.log(123);
|
||||
|
||||
if(true) {
|
||||
var i_type = document.getElementById('i_type');
|
||||
var value = i_type.value;
|
||||
|
||||
var panel = document.getElementById('panel_ECMFKBOOK_DETAILS');
|
||||
var table = panel.children[0];
|
||||
|
||||
if(!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = table.getElementsByTagName('tr');
|
||||
|
||||
// console.log(rows);
|
||||
// return;
|
||||
|
||||
var acc_code_row = rows[5];
|
||||
|
||||
console.log(acc_code_row);
|
||||
|
||||
switch(value) {
|
||||
default:
|
||||
case '1': // Sprzedaz
|
||||
case '2': // Zakup
|
||||
case '4': // Ogolny
|
||||
acc_code_row.style.display = 'none';
|
||||
break;
|
||||
case '3': // Platniczy
|
||||
acc_code_row.style.display = 'table-row';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHANGER.add(
|
||||
'account_acc_wn',
|
||||
'checked',
|
||||
function(obj) {
|
||||
if (true == obj.checked) {
|
||||
document.getElementById('acc_wn').disabled = true;
|
||||
document.getElementById('acc_wn_code').disabled = true
|
||||
|
||||
document.getElementById('btn_acc_wn_code').disabled = true
|
||||
document.getElementById('btn_clr_acc_wn_code').disabled = true
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
document.getElementById('acc_wn').disabled = false;
|
||||
document.getElementById('acc_wn_code').disabled = false;
|
||||
|
||||
document.getElementById('btn_acc_wn_code').disabled = false;
|
||||
document.getElementById('btn_clr_acc_wn_code').disabled = false;
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
CHANGER.add(
|
||||
'account_acc_ma',
|
||||
'checked',
|
||||
function(obj) {
|
||||
if (true == obj.checked) {
|
||||
document.getElementById('acc_ma').disabled = true;
|
||||
document.getElementById('acc_ma_code').disabled = true
|
||||
|
||||
document.getElementById('btn_acc_ma_code').disabled = true
|
||||
document.getElementById('btn_clr_acc_ma_code').disabled = true
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
document.getElementById('acc_ma').disabled = false;
|
||||
document.getElementById('acc_ma_code').disabled = false;
|
||||
|
||||
document.getElementById('btn_acc_ma_code').disabled = false;
|
||||
document.getElementById('btn_clr_acc_ma_code').disabled = false;
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
set_focus();
|
||||
|
||||
//initialize kind
|
||||
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();
|
||||
}
|
||||
|
||||
N.onRefreshRowIndex = function(row) {
|
||||
return true;
|
||||
|
||||
var data = new Object();
|
||||
data['index'] = (row.index + 1).toString();
|
||||
|
||||
row.cells.item(0).setData(data);
|
||||
};
|
||||
|
||||
N.onCreateRow = function(row) {
|
||||
// console.log(row);
|
||||
|
||||
row.newPos = false;
|
||||
row.style.height = OPT['row_item_height'];
|
||||
|
||||
row.ondblclick = function() {
|
||||
this.newPos = !this.newPos;
|
||||
|
||||
for (var i = 0; i < this.myTable.colCount(); i++) {
|
||||
this.cells.item(i).change(!this.newPos);
|
||||
}
|
||||
};
|
||||
|
||||
row.onSelect = function() {
|
||||
for (var i = 0; i < this.myTable.colCount(); i++) {
|
||||
this.cells.item(i).style.height = OPT['row_item_height_selected'];
|
||||
this.cells.item(i).change(!this.newPos);
|
||||
}
|
||||
};
|
||||
|
||||
row.onDeselect = function() {
|
||||
for (var i = 0; i < this.myTable.colCount(); i++) {
|
||||
this.cells.item(i).style.height = OPT['row_item_height'];
|
||||
this.cells.item(i).change(false);
|
||||
}
|
||||
};
|
||||
|
||||
row.calculateTotal = function() {
|
||||
// calculateTotalItems();
|
||||
// console.log('calculateTotal');
|
||||
return true;
|
||||
|
||||
var data = new Object();
|
||||
|
||||
this.cells.item(3).getData(data, true);
|
||||
this.cells.item(5).getData(data, true);
|
||||
this.cells.item(6).getData(data, true);
|
||||
|
||||
if (data.quantity && data.price) {
|
||||
data.price2 = data.price - data.price * data.discount / 100;
|
||||
data.total = data.quantity * data.price2;
|
||||
}
|
||||
else {
|
||||
data.total = 0;
|
||||
data.price2 = 0;
|
||||
}
|
||||
|
||||
this.cells.item(7).setData(data);
|
||||
this.cells.item(10).setData(data);
|
||||
|
||||
calculateTotalItems();
|
||||
};
|
||||
};
|
||||
|
||||
var itd = document.getElementById('itemsTableDIV');
|
||||
|
||||
itd.onscroll = function() {
|
||||
// console.log('onscroll');
|
||||
return true;
|
||||
|
||||
if (!AjaxSearch1Items.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)))
|
||||
AjaxSearch1Items.div.style.display = 'none';
|
||||
else
|
||||
AjaxSearch1Items.div.style.display = '';
|
||||
|
||||
AjaxSearch1Items.div.style.top = top - this.scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
N.onCreateCell = function(cell) {
|
||||
var i = cell.index;
|
||||
|
||||
cell.change = function(select) {
|
||||
//
|
||||
};
|
||||
|
||||
cell.style.height = OPT['row_item_height'];
|
||||
|
||||
// cell.select = function() {
|
||||
// var d = new Date();
|
||||
// console.log(d + " " + i);
|
||||
// }
|
||||
|
||||
cell.onDeselect = function() {
|
||||
var data = this.parentNode.getData();
|
||||
|
||||
console.log(data);
|
||||
|
||||
// if (!data.id || data.id == '') {
|
||||
// var data2 = new Object();
|
||||
|
||||
this.parentNode.setData(data);
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Title.
|
||||
if (i == 0) {
|
||||
cell.change = function(select) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(select) {
|
||||
cn[0].name = 'i_title';
|
||||
cn[0].id = 'i_title';
|
||||
} else {
|
||||
cn[0].name = '';
|
||||
cn[0].id = '';
|
||||
}
|
||||
}
|
||||
|
||||
cell.getData = function(data) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(cn[0].value) {
|
||||
data.i_title = cn[0].value;
|
||||
} else {
|
||||
data.i_title = false;
|
||||
}
|
||||
};
|
||||
|
||||
cell.setData = function(data) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(data.i_title) {
|
||||
cn[0].value = data.i_title;
|
||||
} else {
|
||||
cn[0].value = '';
|
||||
}
|
||||
};
|
||||
|
||||
var edit0 = document.createElement('input');
|
||||
edit0.setAttribute('type', 'text');
|
||||
edit0.setAttribute('readOnly', 'readonly');
|
||||
edit0.setAttribute('tabIndex', 1);
|
||||
edit0.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit0);
|
||||
}
|
||||
|
||||
// Name.
|
||||
if (i == 1) {
|
||||
cell.change = function(select) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(select) {
|
||||
cn[0].name = 'i_col_1_decoded';
|
||||
cn[0].id = 'i_col_1_decoded';
|
||||
|
||||
cn[1].name = 'i_col_1_translations_decoded';
|
||||
cn[1].id = 'i_col_1_translations_decoded';
|
||||
|
||||
cn[2].name = 'i_col_2_decoded';
|
||||
cn[2].id = 'i_col_2_decoded';
|
||||
|
||||
cn[3].name = 'i_col_2_translations_decoded';
|
||||
cn[3].id = 'i_col_2_translations_decoded';
|
||||
} else {
|
||||
cn[0].name = '';
|
||||
cn[0].id = '';
|
||||
|
||||
cn[1].name = '';
|
||||
cn[1].id = '';
|
||||
|
||||
cn[2].name = '';
|
||||
cn[2].id = '';
|
||||
|
||||
cn[3].name = '';
|
||||
cn[3].id = '';
|
||||
}
|
||||
}
|
||||
|
||||
cell.getData = function(data) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(cn[0].value) {
|
||||
// data.i_col_1_decoded = cn[0].value;
|
||||
data.i_col_1_decoded = cn[0].value.split(/[ ]*,[ ]*/).filter(function(element, index, array){ return element != ''});
|
||||
} else {
|
||||
// data.i_col_1_decoded = '';
|
||||
data.i_col_1_decoded = [];
|
||||
}
|
||||
|
||||
if(cn[1].value) {
|
||||
// data.i_col_1_translations_decoded = cn[1].value;
|
||||
data.i_col_1_translations_decoded = cn[1].value.split(/[ ]*,[ ]*/).filter(function(element, index, array){ return element != ''});
|
||||
} else {
|
||||
// data.i_col_1_translations_decoded = '';
|
||||
data.i_col_1_translations_decoded = [];
|
||||
}
|
||||
|
||||
if(cn[2].value) {
|
||||
// data.i_col_2_decoded = cn[2].value;
|
||||
data.i_col_2_decoded = cn[2].value.split(/[ ]*,[ ]*/).filter(function(element, index, array){ return element != ''});
|
||||
} else {
|
||||
// data.i_col_2_decoded = '';
|
||||
data.i_col_2_decoded = [];
|
||||
}
|
||||
|
||||
if(cn[3].value) {
|
||||
// data.i_col_2_translations_decoded = cn[3].value;
|
||||
data.i_col_2_translations_decoded = cn[3].value.split(/[ ]*,[ ]*/).filter(function(element, index, array){ return element != ''});
|
||||
} else {
|
||||
// data.i_col_2_translations_decoded = '';
|
||||
data.i_col_2_translations_decoded = [];
|
||||
}
|
||||
|
||||
// console.log('get data:', data);
|
||||
};
|
||||
|
||||
cell.setData = function(data) {
|
||||
// console.log('set data:', data);
|
||||
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(data.i_col_1_decoded) {
|
||||
cn[0].value = data.i_col_1_decoded.filter(function(element, index, array){ return element != ''}).join(', ');
|
||||
} else {
|
||||
cn[0].value = '';
|
||||
}
|
||||
|
||||
if(data.i_col_1_translations_decoded) {
|
||||
cn[1].value = data.i_col_1_translations_decoded.filter(function(element, index, array){ return element != ''}).join(', ');
|
||||
} else {
|
||||
cn[1].value = '';
|
||||
}
|
||||
|
||||
if(data.i_col_2_decoded) {
|
||||
cn[2].value = data.i_col_2_decoded.filter(function(element, index, array){ return element != ''}).join(', ');
|
||||
} else {
|
||||
cn[2].value = '';
|
||||
}
|
||||
|
||||
if(data.i_col_2_translations_decoded) {
|
||||
cn[3].value = data.i_col_2_translations_decoded.filter(function(element, index, array){ return element != ''}).join(', ');
|
||||
} else {
|
||||
cn[3].value = '';
|
||||
}
|
||||
};
|
||||
|
||||
var edit0 = document.createElement('input');
|
||||
edit0.setAttribute('type', 'text');
|
||||
edit0.setAttribute('readOnly', 'readonly');
|
||||
edit0.setAttribute('tabIndex', 1);
|
||||
edit0.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit0);
|
||||
|
||||
var edit1 = document.createElement('input');
|
||||
edit1.setAttribute('type', 'text');
|
||||
edit1.setAttribute('readOnly', 'readonly');
|
||||
edit1.setAttribute('tabIndex', 1);
|
||||
edit1.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit1);
|
||||
|
||||
var edit2 = document.createElement('input');
|
||||
edit2.setAttribute('type', 'hidden');
|
||||
// edit2.setAttribute('readOnly', 'readonly');
|
||||
edit2.setAttribute('tabIndex', 1);
|
||||
edit2.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit2);
|
||||
|
||||
var edit3 = document.createElement('input');
|
||||
edit3.setAttribute('type', 'hidden');
|
||||
// edit3.setAttribute('readOnly', 'readonly');
|
||||
edit3.setAttribute('tabIndex', 1);
|
||||
edit3.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit3);
|
||||
|
||||
// Picker.
|
||||
/*
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('style','display: none; float: right; text-align: right; border: 1px #cccccc solid; padding: 3px;');
|
||||
|
||||
var list = document.createElement('ul');
|
||||
list.setAttribute('style', 'margin: 0;');
|
||||
|
||||
for(var okey in NAME){
|
||||
var otmp = NAME[okey];
|
||||
|
||||
if(otmp){
|
||||
var lh = document.createElement('lh');
|
||||
lh.setAttribute('style', 'font-weight: bold;');
|
||||
lh.innerHTML = okey;
|
||||
|
||||
list.appendChild(lh);
|
||||
|
||||
for(var key in otmp){
|
||||
var tmp = otmp[key];
|
||||
|
||||
if(tmp) {
|
||||
var item = document.createElement('li');
|
||||
item.setAttribute('style', 'margin: 1px;');
|
||||
|
||||
var anchor = document.createElement('a');
|
||||
anchor.setAttribute('name', tmp.id);
|
||||
anchor.setAttribute('style', 'cursor: pointer; clear: both;');
|
||||
anchor.innerHTML = tmp.name;
|
||||
|
||||
anchor.onclick = function() {
|
||||
var cn = cell.getElementsByTagName('input');
|
||||
|
||||
var data = cell.parentNode.getData();
|
||||
data.i_col_1_decoded.push(this.name)
|
||||
cell.parentNode.setData(data);
|
||||
|
||||
div.style.display = 'none';
|
||||
}
|
||||
|
||||
item.appendChild(anchor);
|
||||
list.appendChild(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.appendChild(list);
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.setAttribute('src','modules/EcmQuotes/images/edit_position.gif');
|
||||
img.setAttribute('style','cursor:pointer;display:block;');
|
||||
|
||||
img.onclick=function(){
|
||||
if(div.style.display=='none') {
|
||||
div.style.display='block';
|
||||
} else {
|
||||
div.style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
// cell.appendChild(document.createElement('br'));
|
||||
cell.appendChild(div);
|
||||
cell.appendChild(img);
|
||||
*/
|
||||
}
|
||||
|
||||
// Order.
|
||||
if (i == 2) {
|
||||
cell.change = function(select) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(select) {
|
||||
cn[0].name = 'i_order';
|
||||
cn[0].id = 'i_order';
|
||||
|
||||
cn[1].name = 'i_order_name';
|
||||
cn[1].id = 'i_order_name';
|
||||
} else {
|
||||
cn[0].name = '';
|
||||
cn[0].id = '';
|
||||
|
||||
cn[1].name = '';
|
||||
cn[1].id = '';
|
||||
}
|
||||
}
|
||||
|
||||
cell.getData = function(data) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(cn[0].value) {
|
||||
data.i_order = cn[0].value;
|
||||
} else {
|
||||
data.i_order = '';
|
||||
}
|
||||
|
||||
if(cn[1].value) {
|
||||
data.i_order_name = cn[1].value;
|
||||
} else {
|
||||
data.i_order_name = '';
|
||||
}
|
||||
};
|
||||
|
||||
cell.setData = function(data) {
|
||||
var cn = this.getElementsByTagName('input');
|
||||
|
||||
if(data.i_order) {
|
||||
cn[0].value = data.i_order;
|
||||
} else {
|
||||
cn[0].value = '';
|
||||
}
|
||||
|
||||
if(data.i_order_name) {
|
||||
cn[1].value = data.i_order_name;
|
||||
} else {
|
||||
cn[1].value = '';
|
||||
}
|
||||
};
|
||||
|
||||
var edit0 = document.createElement('input');
|
||||
edit0.setAttribute('type', 'hidden');
|
||||
edit0.setAttribute('readOnly', 'readonly');
|
||||
edit0.setAttribute('tabIndex', 1);
|
||||
edit0.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit0);
|
||||
|
||||
var edit1 = document.createElement('input');
|
||||
edit1.setAttribute('readOnly', 'readonly');
|
||||
edit1.setAttribute('tabIndex', 1);
|
||||
edit1.className = 'inputs';
|
||||
|
||||
cell.appendChild(edit1);
|
||||
|
||||
// Order.
|
||||
/*
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('style','display:none; float:right; text-align:right; border: 1px #cccccc solid; padding:3px;');
|
||||
|
||||
var list = document.createElement('ul');
|
||||
list.setAttribute('style', 'margin: 0;');
|
||||
|
||||
for(var key in ORDER){
|
||||
var tmp = ORDER[key];
|
||||
|
||||
if(tmp){
|
||||
var item = document.createElement('li');
|
||||
item.setAttribute('style', 'margin: 1px;');
|
||||
|
||||
var anchor = document.createElement('a');
|
||||
anchor.setAttribute('name', tmp.id);
|
||||
anchor.setAttribute('style', 'cursor: pointer; clear: both;');
|
||||
anchor.innerHTML = tmp.name;
|
||||
|
||||
anchor.onclick = function() {
|
||||
var cn = cell.getElementsByTagName('input');
|
||||
|
||||
cn[0].value= this.name;
|
||||
cn[1].value= this.innerHTML;
|
||||
|
||||
div.style.display = 'none';
|
||||
}
|
||||
|
||||
item.appendChild(anchor);
|
||||
list.appendChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
div.appendChild(list);
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.setAttribute('src','modules/EcmQuotes/images/edit_position.gif');
|
||||
img.setAttribute('style','cursor:pointer;display:block;');
|
||||
|
||||
img.onclick=function(){
|
||||
if(div.style.display=='none') {
|
||||
div.style.display='block';
|
||||
} else {
|
||||
div.style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
// cell.appendChild(document.createElement('br'));
|
||||
cell.appendChild(div);
|
||||
cell.appendChild(img);
|
||||
*/
|
||||
}
|
||||
|
||||
/* Options unused this time.
|
||||
// Options.
|
||||
if (i == 8) {
|
||||
var img;
|
||||
|
||||
//insert
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('alt', MOD['LBL_INSERT_NEW_ROW']);
|
||||
img.setAttribute('src', 'modules/EcmFkPackages/images/insertrow.gif');
|
||||
img.style.cursor = 'pointer';
|
||||
|
||||
img.onclick = function() {
|
||||
this.parentNode.myTable.addRow(this.parentNode.parentNode.index + 1);
|
||||
};
|
||||
|
||||
//delete
|
||||
cell.appendChild(img);
|
||||
cell.appendChild(document.createTextNode(" "));
|
||||
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('alt', MOD['LBL_DELETE_ROW']);
|
||||
img.setAttribute('src', 'modules/EcmFkPackages/images/deleterow.gif');
|
||||
img.style.cursor = 'pointer';
|
||||
|
||||
img.onclick = function() {
|
||||
removeReservation(cell);
|
||||
this.parentNode.parentNode.deleteRow();
|
||||
};
|
||||
|
||||
cell.appendChild(img);
|
||||
cell.appendChild(document.createElement('br'));
|
||||
|
||||
//move up
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('alt', MOD['LBL_MOVE_ROW_UP']);
|
||||
img.setAttribute('src', 'modules/EcmFkPackages/images/moverowup.gif');
|
||||
img.style.cursor = 'pointer';
|
||||
|
||||
img.onclick = function() {
|
||||
this.parentNode.parentNode.moveUp();
|
||||
};
|
||||
|
||||
cell.appendChild(img);
|
||||
cell.appendChild(document.createTextNode(" "));
|
||||
|
||||
//move down
|
||||
img = document.createElement('img');
|
||||
img.setAttribute('alt', MOD['LBL_MOVE_ROW_DOWN']);
|
||||
img.setAttribute('src', 'modules/EcmFkPackages/images/moverowdown.gif');
|
||||
img.style.cursor = 'pointer';
|
||||
|
||||
img.onclick = function() {
|
||||
this.parentNode.parentNode.moveDown();
|
||||
};
|
||||
|
||||
cell.appendChild(img);
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
N.onSetCellData = function(row, cell, data) {
|
||||
if (cell.innerHTML == '') {
|
||||
cell.innerHTML = ' ';
|
||||
}
|
||||
};
|
||||
|
||||
var pl = document.getElementById('items_list').value;
|
||||
console.log(pl.length);
|
||||
|
||||
if (pl && pl != '') {
|
||||
try {
|
||||
pl = eval(pl);
|
||||
console.log(pl);
|
||||
|
||||
for (x in pl) {
|
||||
var pl_row = pl[x];
|
||||
|
||||
console.log(pl_row);
|
||||
// if (!pl[x].code || pl[x].code == '')
|
||||
// {
|
||||
//
|
||||
// } else {
|
||||
N.addRow().setData(pl_row);
|
||||
// }
|
||||
}
|
||||
} catch (err) {
|
||||
pl = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (N.rowCount() == 0) {
|
||||
N.addRow();
|
||||
}
|
||||
|
||||
calculateTotalItems = function() {
|
||||
return true;
|
||||
|
||||
var a_wn = 0;
|
||||
var a_ma = 0;
|
||||
|
||||
for (var i = 0; i < N.rowCount(); i++) {
|
||||
var data = N.row(i).getData();
|
||||
|
||||
// console.log('data ', data);
|
||||
|
||||
// console.log('type wn', data.i_acc_wn_type, 'amount ', data.i_amount);
|
||||
|
||||
if(data.i_acc_wn_type == '1' || data.i_acc_wn_type == 'Bilansowe') {
|
||||
a_wn += data.i_amount;
|
||||
}
|
||||
|
||||
// console.log('type ma', data.i_acc_ma_type, 'amount ', data.i_amount);
|
||||
|
||||
if(data.i_acc_ma_type == '1' || data.i_acc_ma_type == 'Bilansowe') {
|
||||
a_ma += data.i_amount;
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('total wn ', a_wn, 'total ma ', a_ma);
|
||||
|
||||
var amount_wn = document.getElementById('amount_wn');
|
||||
var amount_ma = document.getElementById('amount_ma');
|
||||
|
||||
amount_wn.value = NumberToUserFormatNumber(a_wn);
|
||||
amount_ma.value = NumberToUserFormatNumber(a_ma);
|
||||
|
||||
return true;
|
||||
|
||||
var vats = new Object();
|
||||
var subtotal = 0;
|
||||
var total = 0;
|
||||
|
||||
for (var i = 0; i < N.rowCount(); i++) {
|
||||
var data = N.row(i).getData();
|
||||
|
||||
if (OPT.to_is_vat_free == 0) {
|
||||
if (data.vat_id && data.name != '') {
|
||||
if (typeof(vats[data.vat_id]) != "object") {
|
||||
vats[data.vat_id] = new Object();
|
||||
vats[data.vat_id]['vat'] = 0;
|
||||
}
|
||||
|
||||
vats[data.vat_id]['vat'] += data.total;
|
||||
}
|
||||
}
|
||||
|
||||
subtotal += data.total;
|
||||
}
|
||||
|
||||
total = subtotal;
|
||||
|
||||
var rt = document.getElementById('position_result_kind');
|
||||
|
||||
for (var i = 1; i < rt.rows.length - 1; i++) {
|
||||
if (!vats[rt.rows.item(i).id]) {
|
||||
rt.deleteRow(i);
|
||||
--i;
|
||||
} else {
|
||||
vats[rt.rows.item(i).id]['node'] = rt.rows.item(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (var x in vats) {
|
||||
if (VAT[x]) {
|
||||
vats[x]['vat'] = vats[x]['vat'] * (parseFloat(VAT[x].value) / 100);
|
||||
total += vats[x]['vat'];
|
||||
|
||||
var txL = MOD['LBL_VAT'] + ' (' + VAT[x].name + ')';
|
||||
var txF = NumberToUserFormatNumber(vats[x]['vat']);
|
||||
}
|
||||
|
||||
if (vats[x]['node']) {
|
||||
vats[x]['node'].id = x;
|
||||
vats[x]['node'].cells.item(0).innerHTML = txL;
|
||||
vats[x]['node'].cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='" + txF + "'>";
|
||||
} else {
|
||||
rt.insertRow(1);
|
||||
|
||||
rt.rows.item(1).id = x;
|
||||
rt.rows.item(1).insertCell(0);
|
||||
rt.rows.item(1).cells.item(0).className = 'positionsLabel';
|
||||
rt.rows.item(1).cells.item(0).innerHTML = txL;
|
||||
rt.rows.item(1).insertCell(1);
|
||||
rt.rows.item(1).cells.item(1).className = 'positionsField';
|
||||
rt.rows.item(1).cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='" + txF + "'>";
|
||||
}
|
||||
}
|
||||
|
||||
var total2 = total;
|
||||
|
||||
total2 = ((OPT['type'] == "correct") ? '-' : '') + NumberToUserFormatNumber(total2).toString();
|
||||
total = ((OPT['type'] == "correct") ? '-' : '') + NumberToUserFormatNumber(total).toString();
|
||||
|
||||
document.getElementById('articles_subtotal').value = NumberToUserFormatNumber(subtotal);
|
||||
|
||||
if (document.getElementById('articles_total'))
|
||||
document.getElementById('articles_total').value = total2;
|
||||
};
|
||||
|
||||
ItemListSave = function(json) {
|
||||
var data = '';
|
||||
|
||||
for (var i = 0; i < N.rowCount(); i++) {
|
||||
data = data + '&items_' + i.toString() + '=' + JSON.stringifyNoSecurity(N.row(i).getData());
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
ItemsList = function(json) {
|
||||
var data = '';
|
||||
|
||||
for (var i = 0; i < N.rowCount(); i++) {
|
||||
data = data + '||||' + JSON.stringifyNoSecurity(N.row(i).getData());
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
if (typeof sqs_objects != 'undefined') {
|
||||
sqs_objects["code_p"] = {
|
||||
"method": "get_product_array",
|
||||
"modules": ["EcmProducts"],
|
||||
"field_list": ["index_dbf", "id", "name", "currency_id"],
|
||||
"populate_list": ["code_p", "id_p", "name_p", "currency_id_p"],
|
||||
"conditions": [{
|
||||
"name": "index_dbf",
|
||||
"op": "like_custom",
|
||||
"end": "%",
|
||||
"value": ""
|
||||
}],
|
||||
"limit": "30",
|
||||
"order": "index_dbf",
|
||||
"no_match_text": "No Match"
|
||||
};
|
||||
|
||||
sqs_objects["name_p"] = {
|
||||
"method": "get_product_array",
|
||||
"modules": ["EcmProducts"],
|
||||
"field_list": ["date_entered", "name", "id", "index_dbf", "currency_id"],
|
||||
"populate_list": ["name_p", "name_p", "id_p", "code_p", "currency_id_p"],
|
||||
"conditions": [{
|
||||
"name": "name",
|
||||
"op": "like_custom",
|
||||
"end": "%",
|
||||
"value": ""
|
||||
}],
|
||||
"limit": "30",
|
||||
"order": "name",
|
||||
"no_match_text": "No Match"
|
||||
};
|
||||
}
|
||||
|
||||
function generateNumber() {
|
||||
var url = 'to_pdf=1&generate=1&module=EcmFkPackages&action=generateNumber&type=normal&template_id=' + document.getElementById('template_id').value;//+'&record='+document.forms.EditView.record.value;
|
||||
|
||||
//if(document.getElementById('template_id').value == '') { alert('There are no DocumentTemplates in data base!'); return;}
|
||||
doRequest(
|
||||
'index.php',
|
||||
url,
|
||||
function(result) {
|
||||
var arr = eval(result)[0];
|
||||
|
||||
document.getElementById('number').value = arr.number;
|
||||
document.getElementById('document_no').value = arr.document_no;
|
||||
},
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
calculateTotalItems();
|
||||
|
||||
if (OPT['new_number']) {
|
||||
generateNumber();
|
||||
|
||||
document.getElementById('ITEMS_menu').style.display = 'none';
|
||||
document.getElementById('SERVICES_menu').style.display = 'none';
|
||||
|
||||
//save PW
|
||||
document.getElementById('stock_doc_inside_in').value = '1';
|
||||
}
|
||||
|
||||
function setToAddrEmail(str) {
|
||||
if (str && str != '')
|
||||
str = eval(str);
|
||||
else
|
||||
str = '';
|
||||
|
||||
if (typeof(str) == "object")
|
||||
str = str[0];
|
||||
else
|
||||
str = '';
|
||||
|
||||
if (document.getElementById('parent_type').value == 'Accounts') {
|
||||
//= document.getElementById('to_addrs_field'); if(tmp) tmp.value = (str=='')?'':(((str.name)?str.name:'')+' <'+((str.email1)?str.email1:'')+'>; ');
|
||||
tmp = document.getElementById('parent_address_street');
|
||||
|
||||
if (tmp) {
|
||||
tmp.value = (str.billing_address_street) ? str.billing_address_street : '';
|
||||
}
|
||||
|
||||
tmp = document.getElementById('parent_address_city');
|
||||
|
||||
if (tmp) {
|
||||
tmp.value = (str.billing_address_city) ? str.billing_address_city : '';
|
||||
}
|
||||
|
||||
tmp = document.getElementById('parent_address_postalcode');
|
||||
|
||||
if (tmp) {
|
||||
tmp.value = (str.billing_address_postalcode) ? str.billing_address_postalcode : '';
|
||||
}
|
||||
|
||||
tmp = document.getElementById('parent_address_country');
|
||||
|
||||
if (tmp) {
|
||||
tmp.value = (str.billing_address_country) ? str.billing_address_country : '';
|
||||
}
|
||||
|
||||
// tmp = document.getElementById('to_nip');
|
||||
//
|
||||
// if (tmp) {
|
||||
// tmp.value = (str.sic_code) ? str.sic_code : '';
|
||||
// }
|
||||
|
||||
tmp = document.getElementById('to_vatid');
|
||||
|
||||
if (tmp) {
|
||||
tmp.value = (str.nip) ? str.nip : '';
|
||||
}
|
||||
|
||||
tmp = document.getElementById('to_is_vat_free');
|
||||
|
||||
if (tmp) {
|
||||
tmp.checked = (str.is_vat_free == 1) ? true : false;
|
||||
}
|
||||
|
||||
document.getElementById('parent_name_copy').value = document.getElementById('parent_name').value;
|
||||
|
||||
tmp = document.getElementById('ecmlanguage');
|
||||
|
||||
if (tmp && str.ecmlanguage) {
|
||||
if (tmp.value != str.ecmlanguage) {
|
||||
tmp.value = str.ecmlanguage;
|
||||
setTexts();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ChangeAccessFunction(obj, type) {
|
||||
var objs = obj.getElementsByTagName('input');
|
||||
|
||||
for (var i = 0; i < objs.length; i++)
|
||||
if (objs[i].id != 'parent_name' && objs[i].id != 'parent_id' && objs[i].name != 'btn_parent_name' && objs[i].name != 'btn_clr_parent_name' && objs[i].name != 'btn_create_parent_name') {
|
||||
objs[i].disabled = type;
|
||||
}
|
||||
|
||||
var objs = obj.getElementsByTagName('textarea');
|
||||
|
||||
for (var i = 0; i < objs.length; i++) {
|
||||
objs[i].disabled = type;
|
||||
}
|
||||
|
||||
var objs = obj.getElementsByTagName('select');
|
||||
|
||||
for (var i = 0; i < objs.length; i++) {
|
||||
if (objs[i].id != 'parent_type') {
|
||||
objs[i].disabled = type;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 'disabled') {
|
||||
TabsMainBlock = true;
|
||||
} else {
|
||||
TabsMainBlock = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log('N done');
|
||||
}
|
||||
);
|
||||
/* /Decree */
|
||||
1293
modules/EcmFkVatKinds/EcmFkVatKindsEditView.js
Executable file
1293
modules/EcmFkVatKinds/EcmFkVatKindsEditView.js
Executable file
File diff suppressed because it is too large
Load Diff
2434
modules/EcmFkVatKinds/MyTable.js
Executable file
2434
modules/EcmFkVatKinds/MyTable.js
Executable file
File diff suppressed because it is too large
Load Diff
48
modules/EcmFkVatKinds/fkbooks.js
Executable file
48
modules/EcmFkVatKinds/fkbooks.js
Executable file
@@ -0,0 +1,48 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
var rhandle=new RevisionListHandler();var from_popup_return=false;function ecmfkvatkind_set_return(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;related_doc_id='EMPTY';for(var the_key in name_to_value_array)
|
||||
{if(the_key=='toJSON')
|
||||
{}
|
||||
else
|
||||
{var displayValue=name_to_value_array[the_key];displayValue=displayValue.replace(''',"'");displayValue=displayValue.replace('&',"&");displayValue=displayValue.replace('>',">");displayValue=displayValue.replace('<',"<");displayValue=displayValue.replace('" ',"\"");if(the_key=='related_doc_id'){related_doc_id=displayValue;}
|
||||
window.ecmfkvatkind.forms[form_name].elements[the_key].value=displayValue;}}
|
||||
related_doc_id=JSON.stringifyNoSecurity(related_doc_id);var conditions=new Array();conditions[conditions.length]={"name":"ecmfkvatkind_id","op":"starts_with","value":related_doc_id};var query=new Array();var query={"module":"EcmFkVatKindisterRevisions","field_list":['id','revision','date_entered'],"conditions":conditions,"order":'date_entered desc'};result=global_rpcClient.call_method('query',query,true);rhandle.display(result);}
|
||||
function RevisionListHandler(){}
|
||||
RevisionListHandler.prototype.display=function(result){var names=result['list'];var rev_tag=ecmfkvatkind.getElementById('related_doc_rev_id');rev_tag.options.length=0;for(i=0;i<names.length;i++){rev_tag.options[i]=new Option(names[i].fields['revision'],names[i].fields['id'],false,false);}
|
||||
rev_tag.disabled=false;}
|
||||
function setvalue(source){src=new String(source.value);target=new String(source.form.ecmfkvatkind_name.value);if(target.length==0){lastindex=src.lastIndexOf("/");if(lastindex==-1){lastindex=src.lastIndexOf("\\");}
|
||||
if(lastindex==-1){source.form.ecmfkvatkind_name.value=src;source.form.escaped_document_name.value=src;}else{source.form.document_name.value=src.substr(++lastindex,src.length);source.form.escaped_document_name.value=src.substr(lastindex,src.length);}}}
|
||||
function toggle_template_type(istemplate){template_type=ecmfkvatkind.getElementById('template_type');if(istemplate.checked){template_type.disabled=false;}else{template_type.disabled=true;}}
|
||||
Reference in New Issue
Block a user