<?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><tr><td></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=-2>NIM/</font></strong><font  size=-2><em>Student Registered Number</em></font></td>  <td width=250><strong><font size=-2>: $nim</td></strong></font>
<td><strong><font size=-2>Program Pendidikan/</font></strong><font  size=-2><em>Education Program</em></font></td>  <td><strong><font size=-2>: VOKASI/ VOCATIONAL <font  size=-1><em>
</tr>";
echo"<tr>
<td><strong><font size=-2>Nama/</font></strong><font  size=-2><em>Name</font></td> <td><strong><font size=-2>: $hasilmhs[1]</em></td></strong></font>
<td><strong><font size=-2>Program Studi/</font></strong><font size=-2><em>Student Program</em></font></td>  <td><strong><font size=-2>: $prodi / DIPLOMA IN NURSING <font  size=-1><em> 
</tr>";
				$tgl_asli = $hasilmhs[6];
				//$ftgl= date("d-m-Y", strtotime($tgl_asli));
				$ftgl=TanggalIndo($tgl_asli);
echo"<tr><td><strong><font size=-2>Tempat Tanggal Lahir/</font></strong><font  size=-2><em>Place Date Of Birth</font></td> <td><strong><font size=-2>: $hasilmhs[5], $ftgl</em></td></strong></font>
<td> <strong><font size=-2>No. Pokok Perguruan Tinggi/</font></strong><font size=-2><em>College ID Number</font></td> <td><strong><font size=-2>: 043389</em></td></strong></font>
</tr>";
				if ($hasilmhs[8]=='L')
				{
				$sex='LAKI-LAKI';
				$sex1='MALE';
				}else{
				$sex='PEREMPUAN';
				$sex1='FEMALE';
				}
echo"<tr><td><strong><font size=-2>Jenis Kelamin/</font></strong><font  size=-2><em>Sex</font></td> <td><strong><font size=-2>: $sex / $sex1</em></td></strong></font>
<td> <strong><font size=-2>No. Pokok Program Studi/</font></strong><font size=-2><em>Study Programe ID Number</font></td> <td><strong><font size=-2>: 14401</em></td></strong></font>
</tr>";
echo"<tr><td><strong><font size=-2>Tanggal Lulus/</font></strong><font  size=-2><em>Graduate On</font></td> <td><strong><font size=-2>: $ftrans</em></td></font>
<td><strong><font size=-2>No Ijazah/</font></strong><font  size=-2><em>Certificate Number</font></td> <td><strong><font size=-2>: $hasiltrans[2]</em></td></strong></font>
</tr><tr> <td></td></tr>";

}

?>
<table width="905" border="1" cellpadding="0" style="border-collapse:collapse;" > 
<tr><th width="20"><font size="-1">No</font></th>
 <th width="70"><font size="-1">Kode</font>
 <br><font size="-2"><em>Code</em></font></br></th>
 <th colspan="2">Mata Kuliah/<font ><em>Title</em></font><font ></font></th>
 <th width="36"><font size="-1">SKS </font>
 <br><font  size="-2"><em>C,U</em></font></br></th>
 <th width="50"><font size="-1"> Nilai </font>
 <br><font  size="-2"><em>Score</em></font></br></th>
 <th width="37"><font size="-1">Huruf</font>
   <font  size="-2"><em>Mark</em></font></br></th>
 <th width="50"><font size="-1">Bobot</font>
   <font 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="Dengan Pujian";
 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 ><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 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  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  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 size="-1"><em> Level Of Proficiency</em></font></td>
  <td colspan="4" align="right"><div align="center"><font size="-2"><strong><? echo $yud; ?>/<font ><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" ><em>Vice of Academic Development ,</em></font><font ></br>
</font><font ></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 , 12 September 2025<br> 
  <font size="-1">STIKes Bhakti Husada Cikarang <br>
Ketua,
  </font><br>
  <font size="-1" =><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>


