<?php
error_reporting(0);
// The function header by sending raw excel
header("Content-type: application/vnd-ms-excel");
 
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=data-ujian-susulan.xls");
 
// Add data table
	include "php_class/class_mysql.php";
	include "php_class/class_surat.php";
	
	$DataSurat = new DataSurat;
	?>
          <table>
             <thead>
                <tr>
                    <th>Nomer Surat</th>
                    <th>Nama Dosen</th>
                    <th>NIP/NIK</th>
                    <th>Pekerjaan</th>
                    <th>Sandi Mata Kuliah</th>
                    <th>Mata Kuliah</th>
                    <th>Nama Mahasiswa</th>
                    <th>NPM</th>
                    <th>Semester</th>
                    <th>Alamat</th>
                    <th>Semester Akademik</th>
                    <th>Tahun</th>
                    <th>Tanggal</th>
                    <th>Alasan</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataSurat->get_susulan_all('',$a,'jumlah');
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $DataSurat->get_susulan_all('id',$a,'');
						$dosen = $DataSurat->get_susulan_all('dosen',$a,'');
						$matakuliah = $DataSurat->get_susulan_all('matakuliah',$a,'');
						$nama = $DataSurat->get_susulan_all('nama',$a,'');
						$npm = $DataSurat->get_susulan_all('npm',$a,'');
						$pekerjaan = $DataSurat->get_susulan_all('pekerjaan',$a,'');
						$sandimk = $DataSurat->get_susulan_all('sandimk',$a,'');
						$smt = $DataSurat->get_susulan_all('smt',$a,'');
						$alamat = $DataSurat->get_susulan_all('alamat',$a,'');
						$semester = $DataSurat->get_susulan_all('semester',$a,'');
						$tahun = $DataSurat->get_susulan_all('tahun',$a,'');
						$alasan = $DataSurat->get_susulan_all('alasan',$a,'');
						$tanggal = $DataSurat->get_susulan_all('tanggal',$a,'');
						$nik = $DataSurat->get_susulan_all('nik',$a,'');
						$nomer = $DataSurat->get_susulan_all('nomer',$a,'');
						
						echo "<tr>";
						echo "<td>".$nomer."</td>";
						echo "<td>".$dosen."</td>";
						echo "<td>".$nik."</td>";
						echo "<td>".$pekerjaan."</td>";
						echo "<td>".$sandimk."</td>";
						echo "<td>".$matakuliah."</td>";
						echo "<td>".$nama."</td>";
						echo "<td>".$npm."</td>";
						echo "<td>".$smt."</td>";
						echo "<td>".$alamat."</td>";
						echo "<td>".$semester."</td>";
						echo "<td>".$tahun."</td>";
						echo "<td>".$tanggal."</td>";
						echo "<td>".$alasan."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
