var stockreportModule = (function () { 

    $("#fromDate").on("select change blur",function(){
        $('.customerStock').val("");
        
    });
    $("#toDate").on("change blur",function(){
        $('.customerStock').val("");
        
     });

    
    $('.datewise-submit-saleoverall').on('click',function(){


        $('.sale-stockOverreport-excle').show();

        console.log($('.sale-stockOverreport-excle').attr("href"));
        var saleexcle = $('.sale-stockOverreport-excle').attr("data-href");
		
		

        var startDate = $("#fromDate").val();
        var endDate   = $("#toDate").val();

        $('.sale-stockOverreport-excle').attr("href",'');
        $('.sale-stockOverreport-excle').attr("href",saleexcle+'?startDate='+startDate+'&endDate='+endDate);
        console.log($('.sale-stockOverreport-excle').attr("href"));


        if(startDate!= '' && endDate!= '') {

            var dataTable =  $('#salestockDashboardOverAll').DataTable({
                responsive: {
                    details: {
                        renderer: function ( api, rowIdx ) {
                            var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
                                var header = $( api.column( cell.column ).header() );
                                return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
                            } ).toArray().join('');

                            return data ?    $('<table/>').append( data ) :    false;
                        }
                    }
                },
                processing: true,
                serverSide: true,
                destroy: true,
                ajax: {
                    url : "./purchasetaxgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionPrint: 1,
                        customerID  : '',
                        startDate   : startDate,
                        endDate     : endDate
                    }
                }
            });  
                  
        }
    });



})();