<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?php echo $file_pdf;?></title>
		<style>
			body {
			  background-image: url('<?php echo base_url();?>assets/images/bg_pdf.png');
			  background-repeat: no-repeat;
			  background-attachment: fixed;
			  background-position: center;
			}
			.kemenag {
			  background-image: url('<?php echo base_url();?>assets/images/kemenag2.png');
			  background-repeat: no-repeat;
			  background-position: 5% 50%;
			  background-size: contain;
			}
		</style>
    </head>
    <body>
		<table style="border-collapse: collapse; width:700px; font-size: 85%; margin: 2%;">
			<tr>
				<td style="width:5%;">&nbsp;</td>
				<td style="width:11%;">&nbsp;</td>
				<td style="width:21%;">&nbsp;</td>
				<td style="width:21%;">&nbsp;</td>
				<td style="width:21%;">&nbsp;</td>
				<td style="width:21%;">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="6" class="kemenag">
					<center>
					<span style="font-size:12px;">KEMENTERIAN AGAMA REPUBLIK INDONESIA</span><br>
					<span style="font-size:12px;">KANTOR KEMENTERIAN AGAMA KABUPATEN MAGELANG</span><br>
						<strong>MADRASAH ALIYAH NEGERI 1</strong><br>
						<span style="font-size:12px;">Jl. Sunan Bonang No.17 Telp/Fax (0293) 362928 PO Box 141 Magelang 56123</span>
					</center>
				</td>
			</tr>
			<tr>
				<td colspan="1">
				<td colspan="3">
					<center>
						<span style="font-size:12px;">website : www.man1magelang.sch.id</span>
					</center>
				</td>
				<td colspan="3">
					<center>
						<span style="font-size:12px;">email : mankabma@yahoo.co.id</span>
					</center>
				</td>
			</tr>
			<tr>
				<td colspan="6">
					<hr style="background-color:#000000; height:3px;">
				</td>
			</tr>
			<tr>
				<td colspan="6">
					<center>
						<?php
							$tahun2 = (int)$tahun+1;
						?>
						KARTU PENDAFTARAN<br>
						CALON PESERTA DIDIK BARU MAN 1 MAGELANG<br>
						Tahun Pelajaran <?php echo $tahun."-".$tahun2;?>
					</center>
				</td>
			</tr>
			<tr>
				<td colspan="6">&nbsp;</td>
			</tr>
			<tr>
				<td>1. </td>
				<td colspan="2">No. Pendaftaran</td>
				<td colspan="2">: <strong><?php echo $calon_siswa->nomor_pendaftaran;?></strong></td>
				<td rowspan="6">
					<img src="<?php echo base_url();?>files/calon_siswa/foto/<?php echo $calon_siswa->foto;?>" height="151px" width="113px">
				</td>
			</tr>
			<tr>
				<td>2. </td>
				<td colspan="2">Nama</td>
				<td colspan="2">: <?php echo $calon_siswa->nama;?></td>
			</tr>
			<tr>
				<?php
					$bulan 	= array("","Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
					$pecah 	= explode("-",$calon_siswa->tanggal_lahir);
					$tahun 	= $pecah[0];
					$sasi	= (int)$pecah[1];
					$month	= $bulan[$sasi];
					$tanggal= $pecah[2];
				  ?>
				<td>3. </td>
				<td colspan="2">Tempat, Tanggal Lahir</td>
				<td colspan="2">: <?php echo $calon_siswa->tempat_lahir.", ".$tanggal." ".$month." ".$tahun;?></td>
			</tr>
			<tr>
				<td>4. </td>
				<td colspan="2">Asal Sekolah</td>
				<td colspan="2">: <?php echo $calon_siswa->asal_sekolah;?></td>
			</tr>
			<tr>
				<td>5. </td>
				<td colspan="2">No. HP (Whatsapp)</td>
				<td colspan="2">: <?php echo $calon_siswa->no_hp;?></td>
			</tr>
			<tr>
				<td>6. </td>
				<td colspan="2">Email</td>
				<td colspan="2">: <?php echo $calon_siswa->email;?></td>
			</tr>
			<tr>
				<td style="vertical-align:top;">7. </td>
				<td style="vertical-align:top;" colspan="2">Pilihan Jurusan</td>
				<td colspan="2">: 1. <?php echo $calon_siswa->jurusan;?><br>
				&nbsp;&nbsp;2. <?php echo $jurusan2->jurusan;?>
				</td>
			</tr>
			<tr><td colspan="5">&nbsp;</td></tr>
			<tr>
				<td style="vertical-align:top;">8. </td>
				<td style="vertical-align:top;" colspan="2">Rekap Nilai Raport</td>
				<td colspan="3">
					<?php
						$aqh_rata = number_format((($nilai->aqh_smt1+$nilai->aqh_smt2+$nilai->aqh_smt3+$nilai->aqh_smt4+$nilai->aqh_smt5)/5),2);
						$ski_rata = number_format((($nilai->ski_smt1+$nilai->ski_smt2+$nilai->ski_smt3+$nilai->ski_smt4+$nilai->ski_smt5)/5),2);
						$fqh_rata = number_format((($nilai->fqh_smt1+$nilai->fqh_smt2+$nilai->fqh_smt3+$nilai->fqh_smt4+$nilai->fqh_smt5)/5),2);
						$akh_rata = number_format((($nilai->akh_smt1+$nilai->akh_smt2+$nilai->akh_smt3+$nilai->akh_smt4+$nilai->akh_smt5)/5),2);
						$agm_rata = number_format((($nilai->agm_smt1+$nilai->agm_smt2+$nilai->agm_smt3+$nilai->agm_smt4+$nilai->agm_smt5)/5),2);
						$bind_rata = number_format(($nilai->bind_smt1+$nilai->bind_smt2+$nilai->bind_smt3+$nilai->bind_smt4+$nilai->bind_smt5)/5,2);
						$mtk_rata = number_format(($nilai->mtk_smt1+$nilai->mtk_smt2+$nilai->mtk_smt3+$nilai->mtk_smt4+$nilai->mtk_smt5)/5,2);
						$bing_rata = number_format(($nilai->bing_smt1+$nilai->bing_smt2+$nilai->bing_smt3+$nilai->bing_smt4+$nilai->bing_smt5)/5,2);
						$ipa_rata = number_format(($nilai->ipa_smt1+$nilai->ipa_smt2+$nilai->ipa_smt3+$nilai->ipa_smt4+$nilai->ipa_smt5)/5,2);
						$ips_rata = number_format(($nilai->ips_smt1+$nilai->ips_smt2+$nilai->ips_smt3+$nilai->ips_smt4+$nilai->ips_smt5)/5,2);
						if($calon_siswa->kode_asal_sekolah == "M")
						{
							$all_rata = number_format(($aqh_rata + $ski_rata + $fqh_rata + $akh_rata + $bind_rata + $mtk_rata + $bing_rata + $ipa_rata + $ips_rata)/9,2);
						}
						else
						{
							$all_rata = number_format(($agm_rata + $bind_rata + $mtk_rata + $bing_rata + $ipa_rata + $ips_rata)/6,2);
						}
					?>
					<table style="border-collapse: collapse;">
						<tr>
							<td style="border: 1px solid #000; width:150px;"><center>Mapel</center></td>
							<td style="border: 1px solid #000; width:150px;"><center>Rata-rata</center></td>
						</tr>
						<?php
							if($calon_siswa->kode_asal_sekolah == "M")
							{
								if($nilai->agm_smt1 == NULL)
								{
									?>
									<tr>
										<td style="border: 1px solid #000;">Al Qur'an Hadits</td>
										<td style="border: 1px solid #000;"><center><?php echo $aqh_rata;?></center></td>
									</tr>
									<tr>
										<td style="border: 1px solid #000;">Sejarah Kebudayaan Islam</td>
										<td style="border: 1px solid #000;"><center><?php echo $ski_rata;?></center></td>
									</tr>
									<tr>
										<td style="border: 1px solid #000;">Fiqih</td>
										<td style="border: 1px solid #000;"><center><?php echo $fqh_rata;?></center></td>
									</tr>
									<tr>
										<td style="border: 1px solid #000;">Akidah Akhlak</td>
										<td style="border: 1px solid #000;"><center><?php echo $akh_rata;?></center></td>
									</tr>
									<?php
								}
								else
								{
									?>
									<tr>
										<td style="border: 1px solid #000;">Agama</td>
										<td style="border: 1px solid #000;"><center><?php echo $agm_rata;?></center></td>
									</tr>
									<?php
								}
							}
							else
							{
								?>
								<tr>
									<td style="border: 1px solid #000;">Agama</td>
									<td style="border: 1px solid #000;"><center><?php echo $agm_rata;?></center></td>
								</tr>
								<?php
							}
						?>
						<tr>
							<td style="border: 1px solid #000;">Bahasa Indonesia</td>
							<td style="border: 1px solid #000;"><center><?php echo $bind_rata;?></center></td>
						</tr>
						<tr>
							<td style="border: 1px solid #000;">Matematika</td>
							<td style="border: 1px solid #000;"><center><?php echo $mtk_rata;?></center></td>
						</tr>
						<tr>
							<td style="border: 1px solid #000;">Bahasa Inggris</td>
							<td style="border: 1px solid #000;"><center><?php echo $bing_rata;?></center></td>
						</tr>
						<tr>
							<td style="border: 1px solid #000;">IPA</td>
							<td style="border: 1px solid #000;"><center><?php echo $ipa_rata;?></center></td>
						</tr>
						<tr>
							<td style="border: 1px solid #000;">IPS</td>
							<td style="border: 1px solid #000;"><center><?php echo $ips_rata;?></center></td>
						</tr>
						<tr>
							<td style="border: 1px solid #000;">Rata-rata Keseluruhan</td>
							<td style="border: 1px solid #000;"><center><?php echo $all_rata;?></center></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr><td colspan="5">&nbsp;</td></tr>
			<tr>
				<td style="vertical-align:top;">9. </td>
				<td style="vertical-align:top;">Prestasi<td>
				<td colspan="3">&nbsp;</td>
			</tr>
			<tr>
				<td style="vertical-align:top;">&nbsp;</td>
				<td colspan="4">
					<table style="border-collapse: collapse;">
						<tr>
							<td style="border: 1px solid #000; width:20px;"><center>No</center></td>
							<td style="border: 1px solid #000; width:250px;"><center>Nama Kejuaran / Lomba</center></td>
							<td style="border: 1px solid #000; width:200px;"><center>Tingkat</center></td>
							<td style="border: 1px solid #000; width:120px;"><center>Prestasi / Juara</center></td>
							<td style="border: 1px solid #000; width:50px;"><center>Tahun</center></td>
						</tr>
						<?php
							$no = 0;
							foreach($prestasi as $p)
							{
								$no++;
								?>
								<tr>
									<td style="border: 1px solid #000;"><?php echo $no;?></td>
									<td style="border: 1px solid #000;"><?php echo $p['nama_kejuaraan'];?></td>
									<td style="border: 1px solid #000;"><?php echo $p['tingkat'];?></td>
									<td style="border: 1px solid #000;"><?php echo $p['juara'];?></td>
									<td style="border: 1px solid #000;"><?php echo $p['tahun'];?></td>
								</tr>
								<?php
							}							
						?>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="6">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="6">&nbsp;</td>
			</tr>
			<tr>
				<?php
					$pecah3 	= explode("-",$hari_ini);
					$tahun3 	= $pecah3[0];
					$sasi3		= (int)$pecah3[1];
					$month3		= $bulan[$sasi3];
					$tanggal3	= $pecah3[2];
				?>
				<td rowspan="6" colspan="3">
					<center>
						<img src="<?php echo base_url();?>assets/images/no_korupsi.jpeg" height="100px" width="100px">
					</center>
				</td>
				
				<td colspan="1">&nbsp;</td>
				<td colspan="2">Magelang, <?php echo $tanggal3." ".$month3." ".$tahun3;?> </td>
			</tr>
			<tr>
				<td colspan="1">&nbsp;</td>
				<td colspan="2">Calon Siswa,</td>
			</tr>
			<tr>
				<td colspan="3">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="3">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="1">&nbsp;</td>
				<td colspan="2"><?php echo $calon_siswa->nama;?></td>
			</tr>
		</table>

		<center>
		    <img style="margin: -30px;" src="<?php echo base_url();?>assets/images/wa_group.jpeg" height="80px" width="80px">
			<p style="font-size:10px; margin:25px 0 0px 0;"><a href="https://chat.whatsapp.com/IXvGa0WHgWNIX7DyVOhZbi">bit.ly/groupwappdbmponpes2526</a>  </p>
			<p style="font-style: italic; font-size:12px; margin:0px 0 0px 0;">Silahkan Scan QR Code ini untuk masuk Group WA PPDB MAN 1 Magelang</p>
		</center>
		
		
    </body>
</html>