<?php
// 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-sempek.xls");
 
// Add data table
?>
<?php
	include "php_class/class_mysql.php";
	include "php_class/class_template.php";
	include "php_class/class_mahasiswa.php";
	include "php_class/class_proposal.php";
	include "php_class/class_semesterpendek.php";
	
	$datasp = new DataSemesterPendek;
	$DataProposal = new DataProposal;
	$DataMahasiswa = new DataMahasiswa;

								$ids = $_SESSION["id"];	
								$tahun = $_POST["tahun"];
								$program = $_POST['program'];
								$tglawal = $_POST['tglawal'];
								$tglakhir = $_POST['tglakhir'];

?>


                          <table border="1">
                             <thead>
                                <tr>
                                    <th>Id Detail</th>
                                    <th>No Transaksi</th>
                                    <th>NPM</th>
                                    <th>Nama</th>
                                    <th>Kode MK</th>
                                    <th>Mata Kuliah</th>
                                    <th>Nama Dosen</th>
                                    <th>SKS</th>
                                    <th>Biaya</th>
                                    <th>Tanggal</th>
                                    <th>Operator</th>
                                    <th>Telepon</th>
                                    <th>Biaya Operasional</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
                                $JumlahData = $datasp->get_trx_sempek_detil_all('', $a, 'jumlah', $program, $tahun, $tglawal, $tglakhir);
                                if ($JumlahData<=0){
                                    echo "<tr class='odd gradeX'>";
                                    echo "<td>No Data</td>";
                                    echo "<td></td>";
                                    echo "<td></td>";
                                    echo "<td></td>";
                                    echo "</tr>";	
                                }else{
                                        $TotalAkhir = 0;
                                    for ($a=1;$a<=$JumlahData;$a++){
                                        $id = $datasp->get_trx_sempek_detil_all('id', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$NoTrx = $datasp->get_trx_sempek_detil_all('NoTrx', $a, '', $program, $tahun, $tglawal, $tglakhir);
                                        $npm = $datasp->get_trx_sempek_detil_all('NPM', $a, '', $program, $tahun, $tglawal, $tglakhir);
                                        $Nama = $datasp->get_trx_sempek_detil_all('Nama', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$matakuliah = $datasp->get_trx_sempek_detil_all('matakuliah', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$tgl = $datasp->get_trx_sempek_detil_all('tglinput', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$namaOperator = $datasp->get_trx_sempek_detil_all('namaOperator', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$sks = $datasp->get_trx_sempek_detil_all('sks', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$biaya = $datasp->get_trx_sempek_detil_all('biaya', $a, '', $program, $tahun, $tglawal, $tglakhir);
										$kode = $datasp->get_trx_sempek_detil_all('kode', $a, '', $program, $tahun, $tglawal, $tglakhir);
                                        $namadosen = $datasp->get_trx_sempek_detil_all('namadosen',$a, '', $program, $tahun, $tglawal, $tglakhir);
										$telp = $datasp->get_trx_sempek_detil_all('alamat',$a, '', $program, $tahun, $tglawal, $tglakhir);
										$biayaoperasional = $datasp->get_trx_sempek_detil_all('biayaoperasional',$a, '', $program, $tahun, $tglawal, $tglakhir);
										
                                        echo "<tr id='".$id."' class='odd gradeX context'>";
                                        echo "<td>".$id."</td>";
										echo "<td>".$NoTrx."</td>";
                                        echo "<td>".$npm."</td>";
										echo "<td>".$Nama."</td>";
										echo "<td>".$kode."</td>";
										echo "<td>".$matakuliah."</td>";
										echo "<td>".$namadosen."</td>";
										echo "<td>".$sks."</td>";
                                        echo "<td>".number_format($biaya)."</td>";
										echo "<td>".$tgl."</td>";
										echo "<td>".$namaOperator."</td>";
										echo "<td>".$telp."</td>";
										echo "<td>".$biayaoperasional."</td>";
                                        echo "</tr>";
                                    }
                                }
                            ?>
                            </tbody>
                          </table>
