Files
crm.twinpol.com/modules/EcmReports/javascript/ReportSalesByGroup.js

81 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2025-05-12 15:45:17 +00:00
var data = {};
function SeachTable() {
$.each($("#SearchTable").find('input, select'), function (key,input){
data[$(input).prop('name')] = $(input).val();
});
}
function generateXLS(){
Loader(true);
//console.log(data);
setTimeout(function () {
XLSAjax(data);
}, 100);
}
function generatePDF(){
Loader(true);
setTimeout(function () {
PDFAjax(data)
}, 100);
}
function XLSAjax(data) {
if(data.document_sales_type== null){
console.debug(data.document_sales_type);
data['document_sales_type[]']=['invoice','invoice_correct','recipe','recipe_correct'];
}
$.ajax({
type: "POST",
url: 'index.php?module=EcmReports&action=ReportSalesByGroup&to_pdf=1&to_xls=1',
dataType: "html",
data: data,
async: false,
success: function(response){
var new_window = window.open(response);
Loader(false);
},
error: function(err) {
Loader(false);
}
});
}
function PDFAjax(data) {
if(data.document_sales_type== null){
console.debug(data.document_sales_type);
data['document_sales_type[]']=['invoice','invoice_correct','recipe','recipe_correct'];
}
$.ajax({
type: "POST",
url: 'index.php?module=EcmReports&action=ReportSalesByGroup&to_pdf=1&to_pdf_gen=1',
dataType: "html",
data: data,
async: false,
success: function(response){
var new_window = window.open(response);
Loader(false);
},
error: function(err) {
Loader(false);
}
});
}
function Loader(status) {
if(status) {
$('#search-form').css('opacity', '0.3').css('pointer-events', 'none');
} else {
$('#search-form').css('opacity', '1').css('pointer-events', 'auto');
}
}
function init() {
SeachTable();
}
init();