<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<script type="text/javascript">
	window.jQuery || document.write("<script src='<?php echo base_url('assets')?>/ace/js/jquery.js' >"+"<"+"/script>");
</script>
<script src="<?php echo base_url('assets')?>/ace/js/jquery.table2excel.js"></script>
<body><table width="100%" border="1" id="capaian">
  <tbody>
    <tr>
      <td>Sales</td>
      <td>Aktivitas</td>
      <td>Customer</td>
      <td>Tanggal</td>
      <td>Status</td>
      <td>Nilai</td>
      <td>Platform</td>
    </tr>
	<?php
       // print_mz($lastq);
        foreach($lastq as $isi){?>
    <tr>
      <td><?php echo $isi['sales'] ?></td>
      <td><?php echo $isi['aktivitas'] ?></td>
      <td><?php echo $isi['pelanggan'] ?></td>
      <td><?php echo $isi['created_on'] ?></td>
      <td><?php echo $isi['status'] ?></td>
      <td><?php echo $isi['nilai'] ?></td>
      <td><?php echo $isi['platform'] ?></td>
    </tr><?php }?>
  </tbody>
</table>
    <button id="export">Export to Excel</button>
</body>
</html>
<script>
    $(document).ready(function(e){
        
$("#export").click(function(){
  $("#capaian").table2excel({

    // exclude CSS class

    exclude: ".noExl",

    name: "Worksheet Name",

    filename: "hasil-export-<?php echo date('YmdHis') ?>" //do not include extension

  });
 
});       
    });
    </script>