fetch_data('no');
         function fetch_data(is_date_search, start_date='', end_date='')
         {
             $.ajaxSetup({

				  headers: {
			 
					'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

				  } 

				}); 
				
				if(is_date_search=='yes'){
				  $.ajax({
						url:url_exportFromCPQData+'?selectedStart='+start_date+'&selectedEnd='+end_date,

						method:"get",
						success:function(data){
							location.reload();
						 }
				});
		 }
}			
               var t1 =$('#exportfromttb1').DataTable({
					"processing": true,
                    
                	"pageLength": 10,
                	"scrollX": true,
					destroy: true,
					searching: false,
                	"ajax": {
                              "url": exportUrl,
                              "type": 'GET',
                              dataType : "json",
                              contentType: "application/json; charset=utf-8",
                              dataSrc:""
                          },
                    columns: [

					
						{ data: 'id' },
                        { data: 'filename' },
                        {
							className: 'url',
							data: 'path',
							render: function(data) {
									return '<a href="' + data + '" class="url" download>' + 'Download' + '</a> ';
							}
                        }
                        
            
                    ],
					 "order": [[ 1, 'desc' ]]
                });
				t1.on( 'order.dt search.dt', function () {
					t1.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
						cell.innerHTML = i+1;
					} );
				} ).draw();
				
                
         
         
var selectedStart = "" , selectedEnd ;
    $('#daterange-btn-for-export-invoice').daterangepicker(
      {
        ranges   : {
          'Today'       : [moment(), moment()],
          'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
          'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
          'Last 30 Days': [moment().subtract(29, 'days'), moment()],
          'This Month'  : [moment().startOf('month'), moment().endOf('month')],
          'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        startDate: moment().subtract(29, 'days'),
        endDate  : moment()
      },
      function (start, end) {
        $('#daterange-btn-for-export-invoice span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
        selectedStart,selectedStart = start.format('MMMM D, YYYY');
        selectedEnd = end.format('MMMM D, YYYY');
       fetch_data('yes',selectedStart,selectedEnd)
      }
    )
    
// $('#daterange-btn-for-export-invoice').on('çhange',function(){
//     console.log('dfsdfs');
//     exportfromttb1.draw();
// });