Add JS files

This commit is contained in:
2025-05-12 15:45:17 +00:00
parent 7ddd15c4fa
commit 967007b0c7
3239 changed files with 1157078 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
//START:
$(document).ready(
function() {
// confirm exit
window.onbeforeunload = confirmExit;
// prevent submit by enter press
lockEnter();
// parent info
$('#parent_id').on('inputchange',
function() {
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), $(
"#parent_type :selected").val());
}, 1000);
});
// categories
getCategoriesList();
// its vat free change
$("#no_tax").change(function() {
// calculate totals
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 -
// thead row
for (var index = 0; index != count; index++)
calculateRow(index);
});
// language channge
$("#ecmlanguage").change(function() {
changeLanguage();
});
// searchProductInput change
$('#searchProductsInput').keyup(function() {
searchProducts();
});
DrawHeaders();
if (($("#new_number").val() == true)
&& ($("#duplicate").val() != true) && ($("#ecmquote_id").val() =='')) {
generateNumber();
//sale from subpanel??
if ($("#parent_id").val()!='') {
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), $(
"#parent_type :selected").val());
}, 1000);
}
} else if (($("#new_number").val() == true)
&& ($("#duplicate").val() == true)) {
generateNumber();
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
} else if (($("#new_number").val() == true)
&& ($("#ecmquote_id").val() != '')) {
generateNumber();
getParentInfo($("#parent_id").val(),
'Accounts');
getItemsFromSale();
} else {
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
}
// handle setItems
setITEMS = function() {
var formname = 'EditView';
if (check_form_(formname) == true) {
SetTab('ITEMS');
}
};
});
// handle save
var check_form_ = check_form;
check_form = function(formname) {
window.onbeforeunload = null;
if (items.length == 0) {
alert("Brak produktów");
return false;
}
$(".loading_panel").css("display", "block");
// calculate totals
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
for (var index = 0; index != count; index++) {
calculateRow(index);
if (validation.recipient_code == true)
console.log('Sprawdzić kody trzeba');
}
console.log(validation);
$("#total_netto").val($("#t_netto").val());
$("#total_brutto").val($("#t_brutto").val());
$("#discount").val($("#disc").val());
$("#position_list").val(JSON.stringifyNoSecurity(items));
if (check_form_(formname) == false) {
window.onbeforeunload = confirmExit;
$(".loading_panel").css("display", "none");
return false;
} else {
return true;
}
};
function confirmExit() {
return "";
}
function lockEnter() {
// prevent default
$(window).keydown(function(event) {
if (event.keyCode == 13 && $(":focus").prop('tagName')!='TEXTAREA') {
event.preventDefault();
return false;
}
});
}

View File

@@ -0,0 +1,7 @@
//START:
$(document).ready(
function() {
DrawHeaders();
getItems(false);
});

View File

@@ -0,0 +1,150 @@
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmSales&action=ProductSummary&ids='+$('#idss').val());
}
function getList2() {
window.open('index.php?module=EcmSales&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
$('.tablesorter').tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
2: {
sorter: 'rangesort'
},
3: {
// disable it by setting the property sorter to false
sorter: false
},
7: {
sorter: 'rangesorttota'
},
8: {
sorter: 'rangesorttotav'
},
9: {
sorter: 'rangesorttotan'
},
10: {
sorter: 'rangesorttotai'
}
}
});
});

View File

@@ -0,0 +1,171 @@
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmSales&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall2').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall3').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
$("#myTable").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable2").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable3").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Kod',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : 'quantity',
'label' : 'Ilość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>początkowa',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total
//begin: recipient_code
columns[10] = {
'name' : 'recipient_code',
'label' : 'Kod Odbiorcy',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[10]['content'][0] = {'name' : '', 'type': 'text'};
//end: recipient_code

View File

@@ -0,0 +1,122 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Kod',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : 'quantity',
'label' : 'Ilość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>pocz.',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total
//begin: recipient_code
columns[10] = {
'name' : 'recipient_code',
'label' : 'Kod Odbiorcy',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[10]['content'][0] = {'name' : '', 'type': 'text'};
//end: recipient_code
//begin: options
columns[11] = {
'name' : 'options',
'label' : 'Opcje',
'width' : 3,
'content' : new Array(),
};