init
This commit is contained in:
190
modules/EcmReports/javascript/kosztProdukcji.js
Normal file
190
modules/EcmReports/javascript/kosztProdukcji.js
Normal file
@@ -0,0 +1,190 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$.tablesorter.addParser({
|
||||
// use a unique id
|
||||
id : 'number',
|
||||
is : function(s, table, cell) {
|
||||
// s is the text from the cell
|
||||
// table is the current table (as a DOM element; not
|
||||
// jQuery object)
|
||||
// cell is the current table cell (DOM element)
|
||||
// return false if you don't want this parser to be
|
||||
// auto detected
|
||||
return false;
|
||||
},
|
||||
format : function(s, table, cell, cellIndex) {
|
||||
// s is the text from the cell
|
||||
// table is the current table (as a DOM element; not
|
||||
// jQuery object)
|
||||
// cell is the current table cell (DOM element)
|
||||
// cellIndex is the current cell's column index
|
||||
// format your data for normalization
|
||||
// (i.e. do something to get and/or modify your
|
||||
// data, then return it)
|
||||
return $(cell).attr('data-value');
|
||||
},
|
||||
// flag for filter widget (true = ALWAYS search parsed
|
||||
// values; false = search cell text)
|
||||
parsed : false,
|
||||
// set the type to either numeric or text (text uses a
|
||||
// natural sort function
|
||||
// so it will work for everything, but numeric is faster
|
||||
// for numbers
|
||||
type : 'numeric'
|
||||
});
|
||||
|
||||
$("#myTable").tablesorter({
|
||||
theme: 'blue',
|
||||
// initialize zebra striping of the table
|
||||
widthFixed : false,
|
||||
cssChildRow: 'invisible-table-row',
|
||||
// initialize zebra striping of the table
|
||||
widgets: ['zebra','stickyHeaders'],
|
||||
// change the default striping class names
|
||||
// updated in v2.1 to use widgetOptions.zebra = ["even", "odd"]
|
||||
// widgetZebra: { css: [ "normal-row", "alt-row" ] } still works
|
||||
widgetOptions : {
|
||||
zebra : [ "normal-row", "alt-row" ]
|
||||
},
|
||||
headers : {
|
||||
|
||||
2 : { sorter: 'number' },
|
||||
3 : { sorter: 'number' },
|
||||
|
||||
},
|
||||
sortList: [[0,0]]
|
||||
});
|
||||
});
|
||||
|
||||
function pdfExport() {
|
||||
var url = $(location).attr('href');
|
||||
url = url + "&toPDF=1&to_pdf=1";
|
||||
window.open(url);
|
||||
}
|
||||
function xlsExport() {
|
||||
var url = $(location).attr('href');
|
||||
url = url + "&toPDF=1&to_pdf=1&to_xls=1";
|
||||
window.open(url);
|
||||
}
|
||||
function excelExport() {
|
||||
var url = $(location).attr('href').replace("ReportStocks", "ReportStocksToExcelFile");
|
||||
url = url + "&to_pdf=1";
|
||||
|
||||
var fileUrl = url.slice(0, url.indexOf("index")) + "modules/EcmReports/ExcelFiles/ReportStocks.xls";
|
||||
|
||||
|
||||
$.blockUI({css: {
|
||||
border: 'none',
|
||||
padding: '15px',
|
||||
backgroundColor: '#000',
|
||||
'-webkit-border-radius': '10px',
|
||||
'-moz-border-radius': '10px',
|
||||
opacity: .5,
|
||||
'font-weight': 'bold',
|
||||
'font-size': '16px',
|
||||
color: '#fff',
|
||||
},
|
||||
message: "Trwa generowanie pliku..."
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function (data) {
|
||||
$.unblockUI();
|
||||
window.location.href = fileUrl
|
||||
},
|
||||
error: function () {
|
||||
$.unblockUI();
|
||||
alert('Eksport zakończony niepowodzeniem!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function selectAccount() {
|
||||
open_popup('Accounts', 600, 400, '', true, false, {'call_back_function': 'set_return', 'form_name': 'ReportStockDocMoves', 'field_to_name_array': {'id': 'accountId', 'name': 'accountName'}}, 'single', true);
|
||||
}
|
||||
|
||||
function selectProductCategory() {
|
||||
open_popup('EcmProductCategories', 600, 400, '', true, false, {'call_back_function': 'set_return', 'form_name': 'ReportStockDocMoves', 'field_to_name_array': {'id': 'productCategoryId', 'name': 'productCategoryName'}}, 'single', true);
|
||||
}
|
||||
|
||||
function clearAccount() {
|
||||
console.log('Czyszczenie zaznaczonego kontrahenta');
|
||||
$('#accountId').val('');
|
||||
$('#accountName').val('');
|
||||
}
|
||||
function clearCat() {
|
||||
console.log('Czyszczenie zaznaczonego kontrahenta');
|
||||
$('#productCategoryId').val('');
|
||||
$('#productCategoryName').val('');
|
||||
}
|
||||
|
||||
function documentsSelectedChange(documentsSelected) {
|
||||
//Sprawdzanie czy wywolano funkcje przez parametr, czy tez przez event onchange
|
||||
if (typeof documentsSelected != 'string') {
|
||||
documentsSelected = $(this).val();
|
||||
clearAccount();
|
||||
//usuwanie zaznaczonych opcji
|
||||
$(".changebox option:selected").removeAttr("selected");
|
||||
}
|
||||
$("#stockSelectedspan").html('Magazyn');
|
||||
$('.changebox').hide();
|
||||
console.log('Przy switchu: ' + documentsSelected);
|
||||
switch (documentsSelected) {
|
||||
case 'EcmStockDocInsideOuts':
|
||||
console.log('Zmieniono dokument na: EcmStockDocInsideOuts');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kartotekamaterialowa').show();
|
||||
break;
|
||||
case 'EcmStockDocInsideIns':
|
||||
console.log('Zmieniono dokument na: EcmStockDocInsideIns');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kartotekamaterialowa').show();
|
||||
break;
|
||||
case 'EcmStockDocCorrects':
|
||||
console.log('Zmieniono dokument na: EcmStockDocCorrects');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kartotekamaterialowa').show();
|
||||
break;
|
||||
case 'EcmStockDocMoves':
|
||||
console.log('Zmieniono dokument na: EcmStockDocMoves');
|
||||
$("#stockSelectedspan").html('Z magazynu:')
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.magazyndocelowy').show();
|
||||
break;
|
||||
case 'EcmStockDocIns':
|
||||
console.log('Zmieniono dokument na: EcmStockDocIns');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kontrahent').show();
|
||||
break;
|
||||
case 'EcmStockDocOuts':
|
||||
console.log('Zmieniono dokument na: EcmStockDocOuts');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kontrahent').show();
|
||||
$('.kategoriawz').show();
|
||||
break;
|
||||
case 'EcmInvoiceOuts':
|
||||
console.log('Zmieniono dokument na: EcmInvoiceOuts');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kontrahent').show();
|
||||
break;
|
||||
case 'EcmReceipts':
|
||||
console.log('Zmieniono dokument na: EcmReceipts');
|
||||
$("#myTable").show();
|
||||
$("#info").hide();
|
||||
$('.kontrahent').show();
|
||||
break;
|
||||
default:
|
||||
console.log('Zmieniono dokument na: default');
|
||||
$("#myTable").hide();
|
||||
$("#info").show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user