$(document).ready(function(){ $(".rowShowHide").hide(); $(".tablesShowHide").hide(); // Listener odpowiadający za akcje po kliknięciu na przycisk "Exportuj do programu Excel" $("#excelEksport").click( excelExport ); $(".showTables").bind("click",function(){ if($(this).attr("class")=="plusStyle showTables") { //pobieramy następny wiersz tabeli którą chcemy pokazac po czym go wyswietlamy var nextTBody = $(this).parent().parent().parent().next(); while($(nextTBody).attr("id")!="stopTables") { //sprawdzamy czy kategoria if($(nextTBody).attr("class")=="tablesorter-infoOnly tablesShowHide") { $(nextTBody).show(); } nextTBody=$(nextTBody).next(); } $(this).html("[-]"); $(this).attr("class","plusStyle hideTables"); }else if($(this).attr("class")=="plusStyle hideTables") { //pobieramy następny wiersz tabeli którą chcemy schowac po czym go chowamy var nextTBody = $(this).parent().parent().parent().next(); while($(nextTBody).attr("id")!="stopTables") { //tu chowamy wszystko więc nie sprawdzamy kategori $(nextTBody).hide(); var changePlusMinus = $(nextTBody).children().children(); if($(changePlusMinus[0]).children("a").attr("class")=="hideRows") { $(changePlusMinus[0]).children("a").attr("class","showRows"); $(changePlusMinus[0]).children("a").html("[+]"); } nextTBody=$(nextTBody).next(); } $(this).html("[+]"); $(this).attr("class","plusStyle showTables"); } }); $(".showRows").bind("click",function(){ if($(this).attr("class")=="showRows") { //pobieramy następny wiersz tabeli którą chcemy pokazac po czym go wyswietlamy var nextTBody = $(this).parent().parent().parent().next(); while($(nextTBody).attr("id")!="stopRows") { $(nextTBody).show(); nextTBody=$(nextTBody).next(); } $(this).html("[-]"); $(this).attr("class","hideRows"); }else if($(this).attr("class")=="hideRows") { //pobieramy następny wiersz tabeli którą chcemy schowac po czym go chowamy var nextTBody = $(this).parent().parent().parent().next(); while($(nextTBody).attr("id")!="stopRows") { $(nextTBody).hide(); nextTBody=$(nextTBody).next(); } $(this).html("[+]"); $(this).attr("class","showRows"); } }); //dodatkowe dane dla kontrahenta $(".showProducts").click(function(){ if($(this).attr("class")==="showProducts") { var parent = $(this).parent(); var children = $(parent).children(); var contractor = $(children[1]).attr("contractor"); var category = $(this).attr("category"); var subcategory = $(this).attr("subcategory"); var date_from = $("#date_from").attr("value"); var date_to = $("#date_to").attr("value"); var type = $("#type option:selected").attr("value"); var user = $("#user option:selected").attr("value"); var Con = { contractor: contractor, date_from: date_from, date_to: date_to, type: type, category: category, subcategory: subcategory, user: user }; $(this).attr("class","hideProducts"); var ajax_url = "index.php?module=EcmReports&action=ReportSalesByProducts&to_pdf=1"; $.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: "Proszę czekać..." }); $.ajax({ type : "POST", url : ajax_url, dataType : "text", success : function(data) { var parparent = $(parent).parent(); parparent.after("