$(document).ready(function () {
    var reportValue=[];
    $("#calender").click(function () {
      $(".spindis").show();
      var fromd = $("#input_from").val();
      var tod = $("#input_to").val();
     
      //var timeFrom = $("#timefrom").val();
      //var timeTo = $("#timeto").val();
      //var tktFrom = $("#tktfrom").val();
        var vehicle = $("#vehicle").val();
        var modeTrans = $("#modeTrans").val();
        $.ajax({
          type: "POST",
          url: "ajaxreport1/fetch_gst_return_report.php",
          dataType:"json",
          data: { tod: tod, fromd: fromd},
          success: function (data) {
            console.log(data);
            data.map((list)=>{
                reportValue.push(list);
           });
          
          let limitedReport= data.splice(0,1000);
         console.log(limitedReport);
        var tbodyValue ="";
        limitedReport.map((data,index)=>{
                tbodyValue +=`<tr><td>${index+1}</td><td>${data.salescode}</td><td>${data.date}</td><td>${data.customer}</td><td>${data.gstno}</td><td>${data.state}</td><td>${data.product}</td><td>${data.hsn}</td><td>${data.rate}</td><td>${data.quantity}</td><td>${data.units}</td><td>${data.subtotal}</td><td>${data.tax}</td><td>${data.cgst}</td><td>${data.sgst}</td><td>${data.igst}</td><td>${data.netamount}</td></tr>`;
            });
            $("#tbodyReport").append(tbodyValue);
            $(".spindiv").hide();
             $("#input_from").val("");
            $("#input_to").val("");
          
          },
        });
        $("#modaldis").click();
        console.log(reportValue);
    });
    $("#excel").click(function(){
        JSONToCSVConvertor(reportValue, "Tax-Report", true);
       });
  });
  