<?php
include "connect.php";
$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><font size=+1>TRANSKRIP NILAI</u></h2></td></tr></table>";
echo"<table border=0>";
echo"<tr><td><font size=-1>NIM</td>  <td width=400><font size=-1>: $nim</td> </tr>";
echo"<tr><td><font size=-1>Nama</td> <td width=400><font size=-1>: $hasilmhs[1]</td> <td><font size=-1>Angkatan</> <td><font size=-1>: $hasilmhs[14]</td></tr>";
echo"<tr><td>S<font size=-1>emester</td> <td width=400><font size=-1>: $hasilmhs[4]</td> <td><font size=-1>Tingkat</td> <td><font size=-1>: $hasilmhs[2]<br></td</tr></table>";
}
?>
<table border="1" width="700" cellpadding="2" style="border-collapse:collapse;">
<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 AND krs.nilai != 0");
$jumsks = 0;
$i = 1;
$totbot=0;
while($datakrs = mysqli_fetch_array($sqlkrs)){
 echo "<tr><td align=center><font size=-2>$i</td>";
 echo "<td align=center><font size=-2>$datakrs[kd_mtk]</td>";
 echo "<td><font size=-2>&nbsp $datakrs[nm_mtk]</td>";
 echo "<td align=center><font size=-2>&nbsp $datakrs[jsks]</td>";
 echo "<td align=center><font size=-2>&nbsp $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><font size=-2>$lambang</td>";
 $bobotnilai = $datakrs['jsks'] * $datakrs['nilai'];
 $fbobotnilai= number_format($bobotnilai,2,'.','');
 echo "<td align=center><font size=-2>$fbobotnilai</td>";
 $jumsks = $jumsks + $datakrs['jsks'];
 $totbot = $totbot + $bobotnilai;
 $ftotbot= number_format($totbot,2,'.','');
 $i++;
}
echo "<tr><td colspan=6><font size=-2>Jumlah SKS</td><td align=center><font size=-2>$jumsks</td></tr>";
echo "<tr><td colspan=6><font size=-2>Jumlah Bobot</td><td align=center><font size=-2>$ftotbot</td></tr>";
$ips = $totbot / $jumsks;
$fips= number_format($ips,2,'.','');
?>
<tr><td colspan=6><font size="-2">IPK sampai dengan semester <font size="-2"><? echo "$hasilmhs[4]"; ?> </td><td align=center> <font size="-2"> <strong><? echo "$fips"; ?></strong></td></tr>
</table>
<table border="0" width="700">
<tr>
<td width="417"><p>&nbsp;</p>
</td>
<?
$namabulan = array("","Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
$tgl= date("j");
$bln= $namabulan[date("n")];
$thn= date("Y");
?>
<td width="273" align="center"><p><font size="-1">Cikarang ,<? echo " $tgl $bln $thn"; ?> <br>
  STIKes BHakti Husada Cikarang <br>
  Ketua, </p>
  <p>&nbsp;</p>
  <p>
      <u><? echo " $pset[1]"; ?></u>
      <br>
    NIK.<? echo " $pset[0]"; ?></p></td></tr>
</table>
