<?php
header("Content-type: application/vnd-ms-excel");
 
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=data-agenda-surat.xls");

	error_reporting(0);

	include "php_class/class_mysql.php";
	include "php_class/class_agenda.php";
	$dataAgenda = new dataAgenda;
	
	$beranda = $_POST['beranda'];
	$status = $_POST['status'];
	$tglAwal = $_POST['tglAwal'];
	$tglAkhir = $_POST['tglAkhir'];

?>
          <table border="1">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Tanggal Surat</th>
                    <th>Asal Surat</th>
                    <th>No Surat</th>
                    <th>Prihal</th>
                    <th>Tujuan/Kepada</th>
                    <th>Disposisi</th>
                </tr>
            </thead>
            <tbody>
            <?php
				
            	$JumlahData = $dataAgenda->get_data_agenda('',$a,'jumlah', $beranda, $status, $tglAwal, $tglAkhir);
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $dataAgenda->get_data_agenda('id',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						$tgl = $dataAgenda->get_data_agenda('tgl', $a, '', $beranda, $status, $tglAwal, $tglAkhir);
						$nosurat = $dataAgenda->get_data_agenda('nosurat',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						$asal = $dataAgenda->get_data_agenda('asal',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						$tujuan = $dataAgenda->get_data_agenda('tujuan',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						$prihal = $dataAgenda->get_data_agenda('prihal', $a, '', $beranda, $status, $tglAwal, $tglAkhir);
						$disposisi = $dataAgenda->get_data_agenda('disposisi',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						$dokumen = $dataAgenda->get_data_agenda('dokumen',$a,'', $beranda, $status, $tglAwal, $tglAkhir);
						
						echo "<tr id='".$id."' beranda = '".$beranda."' class='odd gradeX'>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$a."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$tgl."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$asal."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$nosurat."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$prihal."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$tujuan."</td>";
						echo "<td id='".$id."' beranda = '".$beranda."' class='context'>".$disposisi."</td>";
						echo "</tr>";
					}
			?>
        	</tbody>
          </table>
