<?php  
//export.php  
include('../class/Appointment.php');

$object = new Appointment;

$output = '';

if(isset($_GET["id"]))
{
	//$output = array();
	//SELECT * FROM arsip_dimanis WHERE unit_kerja='".$_GET["unit"]."' AND ruang is not null
	$main_query = "
	SELECT * FROM tatausaha ";
	
	$object->query = $main_query;

	$object->execute();
	$result = $object->get_result();
	
	$output .= '
	<table class="table" bordered="1">  
		<tr> 
			<th>Nomor Arsip</th> 
			<th>Unit Kerja</th> 
			<th>Kode Klasifikasi</th>
			<th>Kode Pelaksana</th>
			<th>Uraian</th>  
			<th>Kurun Waktu</th>
			<th>Tingkat Perkembangan</th> 
			<th>Media</th> 
			<th>Kondisi</th> 
			<th>Box</th>
		</tr>
	  ';
	
	foreach($result as $row)
	{
		$output .= '
		<tr>
			<td>'.$row["no_urut"].'</td>
			<td>'.$row["unit_kerja"].'</td>
			<td>'.$row["kode_klasifikasi"].'</td>
			<td>'.$row["kode_pelaksana"].'</td>
			<td>'.$row["uraian"].'</td>
			<td>'.$row["kurun_waktu"].'</td>
			<td>'.$row["asli_copy"].'</td>
			<td>'.$row["media"].'</td>
			<td>'.$row["kondisi"].'</td>
			<td>'.$row["box"].'</td>
		</tr>
		';
	}
	  $output .= '</table>';
	  
	  header('Content-Type: application/xls');
	  header('Content-Disposition: attachment; filename=download.xls');
	  echo $output;
}
?>