<?php
 
 header("Content-type: application/vnd-ms-excel");
 
 header("Content-Disposition: attachment; filename=data_pegawai.xls");
 
 header("Pragma: no-cache");
 
 header("Expires: 0");
 
 ?>
<div id="page-wrapper">
	<div class="main-page">
		<div class="tables">
			<div class="table-responsive bs-example widget-shadow" data-example-id="hoverable-table">
				<table class="table table-bordered table-hover" style="font-size:10px !important;">
					<thead>
						<tr style="background:#cbcbcb;">
							<th>No</th>
							<th>NPP</th>
							<th>Nama</th>
							<th>Alamat</th>
							<th>Jenis Kelamin</th>
							<th>Email</th>
							<th>No HP</th>
							<th>Tempat Lahir</th>
							<th>Tanggal Lahir</th>
							<th>Gol Darah</th>
							<th>Tahun Masuk</th>
							<th>Unit Kerja</th>
							<th>Status Kepegawaian</th>
						</tr>
					</thead>
					<tbody>
						<?php
							if($pegawai == NULL)
							{
								?>
								<tr>
									<td colspan="13"><center>Tidak ada data pegawai.</center></td>
								</tr>
								<?php
							}
							else
							{
								$i=0;
								foreach($pegawai as $p)
								{
									$i++;
									?>
									<tr>
										<td><?php echo $i;?></td>
										<td><?php echo $p['no_pegawai'];?></td>
										<td><?php echo ($p['gelar_depan'] != NULL ? $p['gelar_depan']." " : "").$p['nama'].($p['gelar_belakang'] != NULL ? " ".$p['gelar_belakang'] : "");?></td>
										<td><?php echo $p['alamat'];?></td>
										<td><?php echo ($p['jenkel'] == "L" ? "Laki-Laki" : "Perempuan");?></td>
										<td><?php echo $p['email'];?></td>
										<td><?php echo "'".$p['nohp'];?></td>
										<td><?php echo $p['tempat_lahir'];?></td>
										<td><?php echo $p['tanggal_lahir'];?></td>
										<td><?php echo $p['gol_darah'];?></td>
										<td><?php echo $p['tahun_masuk'];?></td>
										<td><?php echo $p['unit_kerja'];?></td>
										<td><?php echo $p['status_kepegawaian'];?></td>
									</tr>
									<?php
								}
							}
						?>
					</tbody> 
				</table>
			</div>
		</div>
	</div>
</div>