<?php
include "header.php";
?>

    
<div class="container">
<h2>STATISTIK PENDAFTAR</h2>
<h3>Penerimaan Siswa Baru <a href="https:facebook.com/dp1n2jkt">SMK Dinamika Pembangunan 1 Jakarta</a></h3>
<p>Berdasarkan Jurusan</p>

<div class="block-content collapse in">
							
<?php

$hasil = mysqli_query($db,"SELECT * FROM t_jurusan where id_jur >1");
while ($data = mysqli_fetch_row($hasil))
{
$kodejur= $data[0];
$jurusan= $data[1];
$quota=$data[4];

$hasil2 = mysqli_query($db,"SELECT count(*) as jum FROM master WHERE jrsn_pil1 = '$kodejur'");
$data2 = mysqli_fetch_row($hasil2);
$jumlah = $data2[0]; 
$datapercent= $jumlah / $quota * 100;


echo"			
<div class='span1'>
<div class='chart' data-percent='".substr($datapercent,0,4)."'>".substr($datapercent,0,4)."% <span class='label label-info'>".$jurusan."</span></div>
</div>";

};


?>
</div>


<div class="table-responsive">	  
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" >
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
echo "<tr><th>NO</th><th>JURUSAN</th><th>KELAS</th><th>L</th><th>P</th><th>JUMLAH SISWA</th><th>QUOTA</th><th>KURANG</th>";  

$no = 1;

$totalSiswa = 0;

$hasil = mysqli_query($db,"SELECT * FROM t_jurusan where id_jur >1");
while ($data = mysqli_fetch_row($hasil))
{

$kodejur= $data[0];

$jurusan= $data[1];
$quota=$data[4]; 
$kelas=$data[5]; 
$totalkelas+=$kelas; 
$totalquota+=$quota; 

$hasil2 = mysqli_query($db,"SELECT count(*) as jum FROM master WHERE jrsn_pil1 = '$kodejur'");
$data2 = mysqli_fetch_row($hasil2);
$jumlah = $data2[0]; 

$hasillaki = mysqli_query($db,"SELECT count(*) as laki FROM master WHERE s_jk='1' and jrsn_pil1 = '$kodejur'");
$datalaki = mysqli_fetch_row($hasillaki);
$jumlahlaki = $datalaki[0]; 

$hasilP = mysqli_query($db,"SELECT count(*) as P FROM master WHERE s_jk='2' and jrsn_pil1 = '$kodejur'");
$dataP = mysqli_fetch_row($hasilP);
$jumlahP = $dataP[0]; 

$kurang=$jumlah-$quota;
$totalsiswa += $jumlah; 
$totallaki+= $jumlahlaki; 
$totalP+= $jumlahP; 
$totalkurang+=$kurang;


echo "<tr><td>".$no."</td><td>".$jurusan."</td><td>".$kelas."</td><td>".$jumlahlaki."</td><td>".$jumlahP."</td><td>".$jumlah."&nbsp Siswa</td><td>".$quota."&nbsp Siswa</td><td>".$kurang."&nbsp Siswa</td>";


$no++;
}

echo "<tr><td colspan='2'>JUMLAH</td><td>".$totalkelas."</td><td>".$totallaki."</td><td>".$totalP."</td><td>".$totalsiswa."&nbsp Siswa</td><td>".$totalquota."&nbsp Siswa</td><td>".$totalkurang."&nbsp Siswa</td>";



?>
</table> 
</div>	  
	 
</table> 	 
	  	
<?php
include "footer.php";
?>
    
