<?php

include"connect.php";
include"indo.php";
include"indo2.php";
$idset="DIREKTUR";
	$hset=mysqli_query($koneksi,"select * from staf where jabatan='$idset'");
	$pset=mysqli_fetch_array($hset);
$pudir="PUDIR I";
	$hset=mysqli_query($koneksi,"select * from staf where jabatan='$pudir'");
	$setpu=mysqli_fetch_array($hset);
$nim= $_POST['nim'];
$krssql = mysqli_query($koneksi,"select * from krs where nim='$nim'");
$hasil=mysqli_num_rows($krssql);
if($hasil > 0 )
{
$mhssql = mysqli_query($koneksi,"select * from mhs where nim='$nim'");
$hasilmhs=mysqli_fetch_row($mhssql);
$transsql = mysqli_query($koneksi,"select * from transkrip where nim='$nim'");
$hasiltrans=mysqli_fetch_row($transsql);
echo"<table border=0 width=900>
		<tr><td align=center><font size=-3>$hasiltrans[1]</font></td></tr></table>";
echo"<table border=0>";
if ($hasilmhs[12]=='D3 KEPERAWATAN')
	{
	$prodi='D3 KEPERAWATAN';
	}else{
	$prodi='D3 KEBIDANAN';
	}
$tgl_trans = $hasiltrans[3];
$ftrans=TanggalIndo($tgl_trans);
//$ftrans= date("d-m-Y", strtotime($tgl_trans));
echo"<tr>
<td><strong><font size=-1>NIM/</font></strong><font color=#006633 size=-1><em>Student Registered Number</em></font></td>  <td width=265><strong><font size=-1>: $nim</td></strong></font>
<td><strong><font size=-1>Program Studi/</font></strong><font color=#006633 size=-1><em>Student Program</em></font></td>  <td><strong><font size=-1>: $prodi <font color=#006633 size=-1><em>
</tr>";
echo"<tr>
<td><strong><font size=-1>Nama/</font></strong><font color=#006633 size=-1><em>Name</font></td> <td><strong><font size=-1>: $hasilmhs[1]</em></td></strong></font>
<td>  <td><strong><font color=#ffffff size=-1>:<font color=#006633 size=-1><em> <font color=#006633 size=-1><em> Diploma in Nursing</em></font></td> 
</tr>";
echo"<tr><td><strong><font size=-1>Tempat Lahir/</font></strong><font color=#006633 size=-1><em>Place Of Birth</font></td> <td><strong><font size=-1>: $hasilmhs[5]</em></td></strong></font>
<td> <strong><font size=-1>Tanggal Lulus/</font></strong><font color=#006633 size=-1><em>Graduate On</font></td> <td><strong><font size=-1>: $ftrans</em></td></strong></font>
</tr>";
				$tgl_asli = $hasilmhs[6];
				//$ftgl= date("d-m-Y", strtotime($tgl_asli));
				$ftgl=TanggalIndo($tgl_asli);
echo"<tr><td><strong><font size=-1>Tanggal Lahir/</font><font color=#006633 size=-2><em>Date Of Birth</font></td> <td><strong><font size=-1>: $ftgl</em></td></strong></font>
<td><strong><font size=-1>No Ijazah/</font></strong><font color=#006633 size=-1><em>Certificate Number</font></td> <td><strong><font size=-1>: $hasiltrans[2]</em></td></strong></font>
</tr>";
				if ($hasilmhs[8]=='L')
				{
				$sex='LAKI-LAKI';
				}else{
				$sex='PEREMPUAN';
				}
echo"<tr><td><strong><font size=-1>Jenis Kelamin/</font></strong><font color=#006633 size=-1><em>Sex</font></td> <td><strong><font size=-1>: $sex</em></td></strong></font></tr>";
}

?>
<table width="905" border="1" cellpadding="0" style="border-collapse:collapse;" > 
<tr><th width="20"><font size="-1">No</font></th>
 <th width="54"><font size="-1">Kode</font>
 <br><font color="#006633"size="-2"><em>Code</em></font></br></th>
 <th colspan="2">Mata Kuliah/<font color="#006633"><em>Title</em></font><font color="#006633"></font></th>
 <th width="36"><font size="-1">SKS </font>
 <br><font color="#006633" size="-2"><em>C,U</em></font></br></th>
 <th width="50"><font size="-1"> Nilai </font>
 <br><font color="#006633" size="-2"><em>Score</em></font></br></th>
 <th width="37"><font size="-1">Huruf</font>
   <font color="#006633" size="-2"><em>Mark</em></font></br></th>
 <th width="50"><font size="-1">Bobot</font>
   <font color="#006633" size="-2"><em>Point</em></font></br></th>
</tr>
<?php
include"connect.php";
$sqlkrs = mysqli_query($koneksi,"SELECT * FROM krs, mtk WHERE nim='$nim'
 AND krs.kd_mtk = mtk.kd_mtk ORDER BY krs.semester, krs.kd_mtk ASC");
$warnaGenap = "#FFFFFF";   // warna kuning
$warnaGanjil = "#FFFFFF";  // warna putih
$jumsks = 0;
$i = 1;
$totbot=0;
$counter = 1;
while($datakrs = mysqli_fetch_array($sqlkrs)){
if ($counter % 2 == 0) $warna = $warnaGenap;
else $warna = $warnaGanjil;
 echo "<tr bgcolor='".$warna."'><td height=18 align=center><font size=-2>$i</font></td>";
 echo "<td align=center><font size=-2> $datakrs[kd_mtk]</font></td>";
 echo "<td colspan=2><font size=-2>&nbsp $datakrs[nm_mtk] /</font><font size=-4> <em> $datakrs[en_mtk]</em></font></td>";
 //echo "<td><font color=#006633 size=-2><em>&nbsp $datakrs[en_mtk]</em></font></td>";
 echo "<td align=center><font size=-1>$datakrs[jsks]</font></td>";
 echo "<td align=center><font size=-1>$datakrs[nilai]</font></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=-1>$lambang</font></td>";
 $bobotnilai = $datakrs['jsks'] * $datakrs['nilai'];
 $fbobotnilai= number_format($bobotnilai,2,'.','');
 echo "<td align=center><font size=-1>$fbobotnilai</td></font></tr>";
 $counter++; // menambah counter

 $jumsks = $jumsks + $datakrs['jsks'];
 $totbot = $totbot + $bobotnilai;
 $ftotbot= number_format($totbot,2,'.','');
 $i++;
}

$ipk = $totbot / $jumsks;
$fipk= number_format($ipk,2,'.','');
//$ipk = $ips*60/100 + $hasiltrans[4]*40/100;
//$fipk= number_format($ipk,2,'.','');

if ($fipk>3.50)
 $yud="Cum Laude";
 else if ($fipk>2.75)
 $yud="Sangat Memuaskan";
 else if ($fipk>1.99)
 $yud="Memuaskan";
 else if ($fipk>0.99)
 $yud="-";
 else
 $yud="";


if ($fipk>3.50)
 $yudi="Excellent";
 else if ($fipk>2.75)
 $yudi="Highly";
 else if ($fipk>1.99)
 $yudi="Safisfactory";
 else if ($fipk>0.99)
 $yudi="";
 else
 $yudi="";

?>
<tr>
  <td height="90" colspan="3" rowspan="4" valign="top">
    <table width="400" border="0" align="center">
      <tr>
        <td width="400"><div align="justify"><font size="-2">JUDUL KTI :</font> <font size="-2"><br>
        </font> <font size="-2"> <? echo $hasiltrans[5]; ?> /<font color="#006633"><em> <? echo $hasiltrans[6]; ?></em></font></font> </div> </td>
      </tr>
    </table>
    </td>
  <td width="311" height="21" colspan="1"><font size="-2">&nbsp JUMLAH SKS /</font><font color="#006633" size="-1"><em> Total C,U</em></font><br>        </td>
  <td colspan="4" align="right">  
    <div align="center"><font size="-1"><strong><? echo $jumsks; ?></strong></font></div></td>
  </tr>
<tr>
  <td colspan="1"><font size="-2">&nbsp JUMLAH BOBOT /</font><font color="#006633" size="-1"><em> Total Point</em></font></td>
  <td colspan="4" align="right"><div align="center"><font size="-1"><strong><? echo $ftotbot; ?></strong></font></div></td>
</tr>

<tr>
  <td colspan="1"><font size="-2">&nbsp INDEKS PRESTASI KOMULATIF /</font><font color="#006633" size="-1"><em> Grade Point Average</em></font></td>
  <td colspan="4" align="right"><div align="center"><font size="-1"><strong><? echo $fipk; ?></strong></font></div></td>
</tr>
<tr>
  <td colspan="1"><font size="-2">&nbsp YUDISIUM KELULUSAN /</font><font color="#006633" size="-1"><em> Level Of Proficiency</em></font></td>
  <td colspan="4" align="right"><div align="center"><font size="-2"><strong><? echo $yud; ?>/<font color="#006633"><em><? echo $yudi; ?></em></font></strong></font></div></td>
</tr>
</table>

<table border="0" width="904">
<tr>
<td width="230" height="167" valign="bottom"><div align="center"><font size="-1">Wakil Ketua Bidang Akademik
</font><br>
<font size="-1" color="#006633"><em>Vice of Academic Development ,</em></font><font color="#006633"></br>
</font><font color="#00FF66"></font>  </div>
  <br>
  <p align="center">&nbsp;</p>
  <div align="center"><u><font size="-1"><? echo " $setpu[1]"; ?></font></u> <font size="-1"><br>
    NIK.<? echo " $setpu[0]"; ?> </font></div></td>
<td width="320" align="center"><table width="110" height="143" border="1" align="right" style="border-collapse:collapse;">
  <tr>
    <td height="137">&nbsp;</td>
  </tr>
</table></td>


<!-- <td width="340" align="center" valign="bottom"><font size="-1">Cikarang ,<? echo " $tgl $bln $thn"; ?></font><br> -->

 <td width="280" align="center" valign="bottom"><font size="-1">Cikarang , 25 November 2024<br> 
  <font size="-1">STIKes Bhakti Husada Cikarang <br>
Ketua,
  </font><br>
  <font size="-1" color="#006633"><em>Chairwomen,</em></font></br>
  <br>
<p>&nbsp;</p>
<u><font size="-1"><? echo " $pset[1]"; ?></font></u>
<font size="-1"><br>
NIK.<? echo " $pset[0]"; ?>
</font></td>
</tr>
</table>


