<?php
 
 header("Content-type: application/vnd-ms-excel");
 
 header("Content-Disposition: attachment; filename=calonsiswa.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>Nomor Pendaftaran</th>
							<th>Tanggal Pendaftaran</th>
							<th>Nama</th>
							<th>NIK</th>
							<th>Tempat Lahir</th>
							<th>Tanggal Lahir</th>
							<th>Jenis Kelamin</th>
							<th>Agama</th>
							<th>Alamat</th>
							<th>No HP</th>
							<th>Cita-Cita</th>
							<th>Hobi</th>
							<th>Transportasi</th>
							<th>Jarak Rumah</th>
							<th>Waktu Tempuh</th>
							<th>Nomor KK</th>
							<th>Nama Kepala Keluarga</th>
							<th>Pekerjaan Kepala Keluarga</th>
							<th>Anak Ke</th>
							<th>Jumalh Saudara</th>
							<th>Nama Ayah</th>
							<th>Status Ayah</th>
							<th>NIK Ayah</th>
							<th>Tempat Lahir Ayah</th>
							<th>Tanggal Lahir Ayah</th>
							<th>Pendidikan Ayah</th>
							<th>Pekerjaan Ayah</th>
							<th>Penghasilan Ayah</th>
							<th>Nomor HP Ayah</th>
							<th>Alamat Ayah</th>
							<th>Nama Ibu</th>
							<th>Status Ibu</th>
							<th>NIK Ibu</th>
							<th>Tempat Lahir Ibu</th>
							<th>Tanggal Lahir Ibu</th>
							<th>Pendidikan</th>
							<th>Pekerjaan Ibu</th>
							<th>Penghasilan Ibu</th>
							<th>Nomor HP Ibu</th>
							<th>Alamat Ibu</th>
							<th>Nama Wali</th>
							<th>NIK Wali</th>
							<th>Pekerjaan Wali</th>
							<th>Penghasilan Wali</th>
							<th>Nomor HP Wali</th>
							<th>Alamat Wali</th>
							<th>KIP</th>
							<th>KKS</th>
							<th>PKH</th>
							<th>NISN</th>
							<th>Asal Sekolah</th>
							<th>Alqur'an Hadist Smt 1</th>
							<th>Alqur'an Hadist Smt 2</th>
							<th>Alqur'an Hadist Smt 3</th>
							<th>Alqur'an Hadist Smt 4</th>
							<th>Alqur'an Hadist Smt 5</th>
							<th>SKI Smt 1</th>
							<th>SKI Smt 2</th>
							<th>SKI Smt 3</th>
							<th>SKI Smt 4</th>
							<th>SKI Smt 5</th>
							<th>Fiqih Smt 1</th>
							<th>Fiqih Smt 2</th>
							<th>Fiqih Smt 3</th>
							<th>Fiqih Smt 4</th>
							<th>Fiqih Smt 5</th>
							<th>Aqidah Akhlak Smt 1</th>
							<th>Aqidah Akhlak Smt 2</th>
							<th>Aqidah Akhlak Smt 3</th>
							<th>Aqidah Akhlak Smt 4</th>
							<th>Aqidah Akhlak Smt 5</th>
							<th>Agama Semester 1</th>
							<th>Agama Semester 2</th>
							<th>Agama Semester 3</th>
							<th>Agama Semester 4</th>
							<th>Agama Semester 5</th>
							<th>Bahasa Indonesia Semester 1</th>
							<th>Bahasa Indonesia Semester 2</th>
							<th>Bahasa Indonesia Semester 3</th>
							<th>Bahasa Indonesia Semester 4</th>
							<th>Bahasa Indonesia Semester 5</th>
							<th>Matematika Semester 1</th>
							<th>Matematika Semester 2</th>
							<th>Matematika Semester 3</th>
							<th>Matematika Semester 4</th>
							<th>Matematika Semester 5</th>
							<th>Bahasa Inggris Semester 1</th>
							<th>Bahasa Inggris Semester 2</th>
							<th>Bahasa Inggris Semester 3</th>
							<th>Bahasa Inggris Semester 4</th>
							<th>Bahasa Inggris Semester 5</th>
							<th>IPA Semester 1</th>
							<th>IPA Semester 2</th>
							<th>IPA Semester 3</th>
							<th>IPA Semester 4</th>
							<th>IPA Semester 5</th>
							<th>IPS Semester 1</th>
							<th>IPS Semester 2</th>
							<th>IPS Semester 3</th>
							<th>IPS Semester 4</th>
							<th>IPS Semester 5</th>
							<th>Jurusan Pilihan #1</th>
							<th>Jurusan Pilihan #2</th>
							<th>Jurusan Yang Diterima</th>
							<th>Hasil Wawancara</th>
							<th>Skor Wawancara</th>
							<th>Status</th>
						</tr>
					</thead>
					<tbody>
						<?php
							if($calonsiswa != NULL)
							{
								foreach($calonsiswa as $c)
								{
									?>
									<tr>
										<td><?php echo $c['nomor_pendaftaran'];?></td>
										<td><?php echo $c['tanggal_submit'];?></td>
										<td><?php echo $c['nama'];?></td>
										<td><?php echo "'".$c['nik'];?></td>
										<td><?php echo $c['tempat_lahir'];?></td>
										<td><?php echo $c['tanggal_lahir'];?></td>
										<td><?php echo $c['jen_kel'];?></td>
										<td><?php echo $c['agama'];?></td>
										<td><?php echo $c['alamat'];?></td>
										<td><?php echo "'".$c['no_hp'];?></td>
										<td><?php echo $c['cita_cita'];?></td>
										<td><?php echo $c['hoby'];?></td>
										<td><?php echo $c['transportasi'];?></td>
										<td><?php echo $c['jarak'];?></td>
										<td><?php echo $c['waktu_tempuh'];?></td>
										<td><?php echo "'".$c['no_kk'];?></td>
										<td><?php echo $c['nama_kk'];?></td>
										<td><?php echo $c['pekerjaan_kk'];?></td>
										<td><?php echo $c['anak_ke'];?></td>
										<td><?php echo $c['jumlah_saudara'];?></td>
										<td><?php echo $c['nama_ayah'];?></td>
										<td><?php echo $c['status_ayah'];?></td>
										<td><?php echo "'".$c['nik_ayah'];?></td>
										<td><?php echo $c['tempat_lahir_ayah'];?></td>
										<td><?php echo $c['tanggal_lahir_ayah'];?></td>
										<td><?php echo $c['pendidikan_ayah'];?></td>
										<td><?php echo $c['pekerjaan_ayah'];?></td>
										<td><?php echo $c['hasilayah'];?></td>
										<td><?php echo "'".$c['no_hp_ayah'];?></td>
										<td><?php echo $c['alamat_ayah'];?></td>
										<td><?php echo $c['nama_ibu'];?></td>
										<td><?php echo $c['status_ibu'];?></td>
										<td><?php echo "'".$c['nik_ibu'];?></td>
										<td><?php echo $c['tempat_lahir_ibu'];?></td>
										<td><?php echo $c['tanggal_lahir_ibu'];?></td>
										<td><?php echo $c['pendidikan_ibu'];?></td>
										<td><?php echo $c['pekerjaan_ibu'];?></td>
										<td><?php echo $c['hasilibu'];?></td>
										<td><?php echo "'".$c['no_hp_ibu'];?></td>
										<td><?php echo $c['alamat_ibu'];?></td>
										<td><?php echo $c['nama_wali'];?></td>
										<td><?php echo $c['nik_wali'];?></td>
										<td><?php echo $c['pekerjaan_wali'];?></td>
										<td><?php echo $c['hasilwali'];?></td>
										<td><?php echo "'".$c['no_hp_wali'];?></td>
										<td><?php echo $c['alamat_wali'];?></td>
										<td><?php echo "'".$c['kip'];?></td>
										<td><?php echo "'".$c['kks'];?></td>
										<td><?php echo "'".$c['pkh'];?></td>
										<td><?php echo "'".$c['nisn'];?></td>
										<td><?php echo $c['asal_sekolah'];?></td>
										<td><?php echo $c['aqh_smt1'];?></td>
										<td><?php echo $c['aqh_smt2'];?></td>
										<td><?php echo $c['aqh_smt3'];?></td>
										<td><?php echo $c['aqh_smt4'];?></td>
										<td><?php echo $c['aqh_smt5'];?></td>
										<td><?php echo $c['ski_smt1'];?></td>
										<td><?php echo $c['ski_smt2'];?></td>
										<td><?php echo $c['ski_smt3'];?></td>
										<td><?php echo $c['ski_smt4'];?></td>
										<td><?php echo $c['ski_smt5'];?></td>
										<td><?php echo $c['fqh_smt1'];?></td>
										<td><?php echo $c['fqh_smt2'];?></td>
										<td><?php echo $c['fqh_smt3'];?></td>
										<td><?php echo $c['fqh_smt4'];?></td>
										<td><?php echo $c['fqh_smt5'];?></td>
										<td><?php echo $c['akh_smt1'];?></td>
										<td><?php echo $c['akh_smt2'];?></td>
										<td><?php echo $c['akh_smt3'];?></td>
										<td><?php echo $c['akh_smt4'];?></td>
										<td><?php echo $c['akh_smt5'];?></td>
										<td><?php echo $c['agm_smt1'];?></td>
										<td><?php echo $c['agm_smt2'];?></td>
										<td><?php echo $c['agm_smt3'];?></td>
										<td><?php echo $c['agm_smt4'];?></td>
										<td><?php echo $c['agm_smt5'];?></td>
										<td><?php echo $c['bind_smt1'];?></td>
										<td><?php echo $c['bind_smt2'];?></td>
										<td><?php echo $c['bind_smt3'];?></td>
										<td><?php echo $c['bind_smt4'];?></td>
										<td><?php echo $c['bind_smt5'];?></td>
										<td><?php echo $c['mtk_smt1'];?></td>
										<td><?php echo $c['mtk_smt2'];?></td>
										<td><?php echo $c['mtk_smt3'];?></td>
										<td><?php echo $c['mtk_smt4'];?></td>
										<td><?php echo $c['mtk_smt5'];?></td>
										<td><?php echo $c['bing_smt1'];?></td>
										<td><?php echo $c['bing_smt2'];?></td>
										<td><?php echo $c['bing_smt3'];?></td>
										<td><?php echo $c['bing_smt4'];?></td>
										<td><?php echo $c['bing_smt5'];?></td>
										<td><?php echo $c['ipa_smt1'];?></td>
										<td><?php echo $c['ipa_smt2'];?></td>
										<td><?php echo $c['ipa_smt3'];?></td>
										<td><?php echo $c['ipa_smt4'];?></td>
										<td><?php echo $c['ipa_smt5'];?></td>
										<td><?php echo $c['ips_smt1'];?></td>
										<td><?php echo $c['ips_smt2'];?></td>
										<td><?php echo $c['ips_smt3'];?></td>
										<td><?php echo $c['ips_smt4'];?></td>
										<td><?php echo $c['ips_smt5'];?></td>
										<td><?php echo $c['jurusan'];?></td>
										<td>
											<?php 
												foreach($jurusan as $j)
												{
													if($c['id_jurusan2'] == $j['id_jurusan'])
													{
														echo $j['jurusan'];
													}
												}
											?>
										</td>
										<td>
											<?php 
												foreach($jurusan as $j)
												{
													if($c['id_jurusan_diterima'] == $j['id_jurusan'])
													{
														echo $j['jurusan'];
													}
												}
											?>
										</td>
										<td><?php echo $c['hasil_wawancara'];?></td>
										<td>
											<?php
												$nilai = 0;
												foreach($jawaban as $j)
												{
													if($c['id_calon_siswa'] == $j['id_calon_siswa'])
													{
														$nilai = $nilai + $j['nilai'];
													}
												}
												echo $nilai;
											?>
										</td>
										<td><?php echo $c['status'];?></td>
									</tr>
									<?php
								}
							}
						?>
					</tbody> 
				</table>
			</div>
		</div>
	</div>
</div>