<header id="fh5co-header" class="fh5co-cover fh5co-cover-sm" role="banner" style="background-image:url(images/blog.jpg);" data-stellar-background-ratio="0.5">
	<div class="overlay"></div>
	<div class="container">
		<div class="row">
			<div class="col-md-8 col-md-offset-2 text-center">
				<div class="display-t">
					<div class="display-tc animate-box" data-animate-effect="fadeIn">
						<h1>Biaya Perkuliahan</h1>
						<h2>Berikut Adalah Biaya Perkuliahan Di Kampus Kami</h2>
					</div>
				</div>
			</div>
		</div>
	</div>
</header>

<div id="fh5co-blog">
	<div class="container">
		<div class="row">
			<div class="col-lg-12 col-md-4">
				<div class="fh5co-blog animate-box">
				    <div class='table-responsive'>
				        <div class='panel-body'>
				            <ul class='nav nav-tabs'>
				            <?Php
				            $tc = mysqli_fetch_array(mysqli_query($conn,"SELECT deskripsi FROM sys_setting WHERE keydata = 'tahun_ajar_current'"));
				            $thn_current = $tc[deskripsi];
				            $tahun_ajar = mysqli_query($conn,"SELECT 
															c.tahun_ajar,h.kd_semester,g.biaya,sum(h.tarif) as tarif
														FROM 
															m_biaya_tarif h 
														    inner join m_tahun_ajar c on h.tgl_berlaku=c.kd_tahun_ajar
														    inner join m_semester d on h.kd_semester=d.kd_semester
														    inner join m_jurusan e on h.kd_jurusan=e.kd_jurusan
														    inner join m_biaya g on h.kd_biaya=g.kd_biaya
														WHERE
															h.tgl_berlaku='$thn_current' AND h.kd_semester NOT IN ('99')
														GROUP BY c.tahun_ajar,h.kd_semester");
				            WHILE($ta = mysqli_fetch_array($tahun_ajar)){
				            ?>
				                <li><a href='#<?Php echo$ta[kd_semester];?>' data-toggle='tab'><?Php echo"$ta[tahun_ajar] - Smt: $ta[kd_semester]";?></a></li>	
				            <?php
				            }
				            ?>
				            </ul>
				            <div class='tab-content'>
				            <?Php
				            $tahun_ajar_detail = mysqli_query($conn,"SELECT 
															h.tgl_berlaku,c.tahun_ajar,h.kd_semester,g.biaya,sum(h.tarif) as tarif
														FROM 
															m_biaya_tarif h 
														    inner join m_tahun_ajar c on h.tgl_berlaku=c.kd_tahun_ajar
														    inner join m_semester d on h.kd_semester=d.kd_semester
														    inner join m_jurusan e on h.kd_jurusan=e.kd_jurusan
														    inner join m_biaya g on h.kd_biaya=g.kd_biaya
														WHERE
															h.tgl_berlaku='$thn_current' AND h.kd_semester NOT IN ('99')
														GROUP BY c.tahun_ajar,h.kd_semester");
				            
				            WHILE($tad = mysqli_fetch_array($tahun_ajar_detail)){
				            ?>
				                <div class='tab-pane fade in' id='<?Php echo$tad[kd_semester];?>'>
				                	<table class='table table-striped table-bordered table-hover' id='dataTables-example'>
				                        <thead>
				                            <tr><th>no</th><th>Rincian Biaya</th><th>Nilai</th><th>Keterangan</th></tr>
				                        </thead>
				                        <tbody>
				                        <?Php
				                        $detail = mysqli_query($conn,"SELECT 
															h.kd_semester,g.biaya,g.deskripsi,h.tarif
														FROM 
															m_biaya_tarif h 
														    inner join m_tahun_ajar c on h.tgl_berlaku=c.kd_tahun_ajar
														    inner join m_semester d on h.kd_semester=d.kd_semester
														    inner join m_jurusan e on h.kd_jurusan=e.kd_jurusan
														    inner join m_biaya g on h.kd_biaya=g.kd_biaya
														WHERE
															h.tgl_berlaku='$tad[tgl_berlaku]' AND h.kd_semester='$tad[kd_semester]'
														");
				                        $i=1;
							            WHILE($d = mysqli_fetch_array($detail)){
							             //   $total_tarif = $total_tarif + $d[tarif];
							                $total_tarifRp = number_format(($tad[tarif]),0,",",".");
							                $tarifRp = number_format(($d[tarif]),0,",",".");
												  echo "<tr>
															<td>$i</td>
															<td>$d[biaya]</td>
															<td>IDR. $tarifRp</td>
															<td>$d[deskripsi]</td>
														</tr>";
														$i++;
										}
										          echo "<tr>
										                    <td  colspan='2'>Total Biaya</td>
															<td>IDR. $total_tarifRp</td>
														</tr>";
										
										?>
										</tbody>
									</table>
				                </div>
				            <?Php
				            }
					        ?>
				            </div>
				        </div>
				    </div>
						 
				</div>
			</div>	
		</div>
	</div>
</div>