<?php
session_start();
include "connect.php";
if(!isset($_SESSION['nim'])){
    die("Anda belum <a href=floginmhs.php>Login</a>");//jika belum login jangan lanjut..
}

$idset="DIREKTUR";
	$hset=mysqli_query($koneksi,"select * from staf where jabatan='$idset'");
	$pset=mysqli_fetch_array($hset);
$nim= $_POST['nim'];

$mhssql = mysqli_query($koneksi,"select * from mhs where nim='$nim'");
$hasilmhs=mysqli_fetch_row($mhssql);
if ($hasilmhs)
{
if ($hasilmhs[2]=='1')
	$tingkat='I';
	else if ($hasilmhs[2]=='2')
	$tingkat='II';
	else
	$tingkat='III';
if ($hasilmhs[4]=='1')
	$smt='I';
	else if ($hasilmhs[4]=='2')
	$smt='II';
	else if ($hasilmhs[4]=='3')
	$smt='III';
	else if ($hasilmhs[4]=='4')
	$smt='IV';
	else if ($hasilmhs[4]=='5')
	$smt='V';
	else
	$smt='VI';
echo"<table border=0 width=700>
	<tr><td align=center><h2><u>TRANSKRIP NILAI</u></h2></td></tr></table>";
echo"<table border=0>";
echo"<tr><td>NIM</td>  <td width=400>: $nim</td> </tr>";
echo"<tr><td>Nama</td> <td width=400>: $hasilmhs[1]</td> <td>Angkatan</> <td>: $hasilmhs[14]</td></tr>";
echo"<tr><td>Semester</td> <td width=400>: $hasilmhs[4]</td> <td>Tingkat</td> <td>: $hasilmhs[2]<br></td</tr></table>";
}
?>
<table border="1" width="700">
<tr><th>No.</th>
 <th>Kode</th>
 <th>Mata Kuliah</th>
 <th>SKS</th>
 <th>Nilai</th>
 <th>Huruf</th>
 <th>Bobot</th>
</tr>
<?php
include"connect.php";
$sqlkrs = mysqli_query($koneksi,"SELECT * FROM krs, mtk WHERE nim='$nim'
 AND krs.kd_mtk = mtk.kd_mtk");
$jumsks = 0;
$i = 1;
$totbot=0;
while($datakrs = mysqli_fetch_array($sqlkrs)){
 echo "<tr><td align=center>$i</td>";
 echo "<td align=center>$datakrs[kd_mtk]</td>";
 echo "<td>$datakrs[nm_mtk]</td>";
 echo "<td align=center>$datakrs[jsks]</td>";
 echo "<td align=center>$datakrs[nilai]</td>";
 
 if ($datakrs['nilai']>3.50)
 $lambang="A";
 else if ($datakrs['nilai']>2.75)
 $lambang="B";
 else if ($datakrs['nilai']>1.99)
 $lambang="C";
 else if ($datakrs['nilai']>0.99)
 $lambang="D";
 else
 $lambang="E";
 
 echo "<td align=center>$lambang</td>";
 $bobotnilai = $datakrs['jsks'] * $datakrs['nilai'];
 $fbobotnilai= number_format($bobotnilai,2,'.','');
 echo "<td align=right>$fbobotnilai</td>";
 $jumsks = $jumsks + $datakrs['jsks'];
 $totbot = $totbot + $bobotnilai;
 $ftotbot= number_format($totbot,2,'.','');
 $i++;
}
echo "<tr><td colspan=6>Jumlah SKS</td><td align=right>$jumsks</td></tr>";
echo "<tr><td colspan=6>Jumlah Bobot</td><td align=right>$ftotbot</td></tr>";
$ips = $totbot / $jumsks;
$fips= number_format($ips,2,'.','');
?>
<tr><td colspan=6>IPK s/d semester <? echo "$hasilmhs[4]"; ?> </td><td align=right><? echo "$fips"; ?></td></tr>
<a href=menumhs.php><strong>[X]Tutup</strong></a>
</table>