$(document).ready(function () {
    var reportValue=[];
    $("#calender").click(function () {
      $(".spindis").show();
      var fromd = $("#input_from").val();
      var tod = $("#input_to").val();
      var customer = $("#customer").val();
      var product = $("#product").val();
      var timeFrom = $("#timefrom").val();
      var timeTo = $("#timeto").val();
      var tktFrom = $("#tktfrom").val();
        var vehicle = $("#vehicle").val();
        $.ajax({
          type: "POST",
          url: "ajaxreport1/fetch_full_report.php",
          dataType:"json",
          data: { customer: customer, tod: tod, fromd: fromd, product: product,vehicle:vehicle,timefrom:timeFrom,timeto:timeTo,ticket:tktFrom },
          success: function (data) {
            console.log(data);
            data.map((list)=>{
                reportValue.push(list);
           });
          let limitedReport= data.splice(0,1000);
         console.log(data);
        var tbodyValue ="";
        limitedReport.map((data,index)=>{
                tbodyValue +=`<tr><td>${index+1}</td><td>${data.exitdate}</td><td>${data.exittime}</td><td>${data.vehicleno}</td><td>${data.customername}</td><td>${data.productname}</td><td>${data.salescode}</td><td>${data.netqty}</td><td>${data.price}</td><td>${data.totalamount}</td><td>${data.delivery}</td><td>${data.editby}</td><td>${data.remark}</td></tr>`;
            });
            $("#tbodyReport").append(tbodyValue);
            $(".spindiv").hide();
             $("#input_from").val("");
            $("#input_to").val("");
           $("#customer").val(null).trigger("change");
            $("#product").val(null).trigger("change");
            $("#timefrom").val("");
           $("#timeto").val("");
           $("#tktfrom").val(null).trigger("change");
           $("#vehicle").val("");
          },
        });
        $("#modaldis").click();
    });
    $("#excel").click(function(){
        JSONToCSVConvertor(reportValue, "Full-Report", true);
       });
  });
  