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

include "rp.php";
$nim=$_POST['nim'];
$kd_byr =$_POST['kd_byr'];
$ta =$_POST['ta'];

echo"<table>";

$sqlmhs=mysql_query("select * from mhs where nim='$nim'");
$datamhs=mysql_fetch_row($sqlmhs);

$sqljns=mysql_query("select * from jns_byr where kd_byr='$kd_byr'");
$datajns=mysql_fetch_row($sqljns);

$sqljum=mysql_query("select sum(jum_byr) from tb_byr where kd_byr='$kd_byr' and nim='$nim'");
$datajum=mysql_fetch_row($sqljum);
$sisa= $datajns[3]-$datajum[0];
$fsisa=rp($sisa);
$fjum=rp($datajns[3]);
$fbyr=rp($datajum[0]);
?>
<?
//set cookie
setcookie("nim",$nim);
setcookie("kd_byr",$kd_byr);
setcookie("ta",$ta);

?>

<table width="732" border="1" align="center">
  <tr>
    <th colspan="4" scope="row" bgcolor="#9966FF">ADMINISTRASI PEMBAYARAN KULIAH </td>
  </tr>
  <tr>
    <td width="160" scope="row" widtd="107"><div align="left">NIM</td>
    <td width="181" widtd="212">
      <input type readonly="text" name="nim" value="<? echo $datamhs[0]; ?>"></t d>
    <td width="133" widtd="164">PEMBAYARAN</td>
    <td width="230" widtd="206" align="right"><? echo $datajns[1]; ?>
  	</td>
  </tr>
  <tr>
    <td scope="row"><div align="left">NAMA</div></td>
    <td><? echo $datamhs[1]; ?></td>
    <td>JUMLAH</td>
    <td align="right"><? echo $fjum; ?>
      <div align="right"></div></td>
  </tr>
  <tr>
    <td scope="row"><div align="left">TINGKAT</div></td>
    <td><? echo $datamhs[2]; ?> <? echo $datamhs[3]; ?></td>
    <td>&nbsp;</td>
    <td><div align="right"></div></td>
  </tr>
  <tr>
    <td height="26" scope="row"><div align="left">SEMESTER</div></td>
    <td><? echo $datamhs[4]; ?></td>
    <td>SUDAH DIBAYAR </td>
    <td align="right"  bgcolor="#CCFFFF"><? echo $fbyr; ?>
      <div align="right"></div></td>
  </tr>
  <tr>
    <td scope="row"><div align="left">ANGKATAN</div></td>
    <td><? echo $datamhs[14]; ?></td>
    <td>SISA</td>
    <th align="right" bgcolor="#FFFFCC"><? echo $fsisa; ?>
      <div align="right"></div></th>
  </tr>
  <tr>
    <td scope="row"><div align="left">TA</div></td>
    <td><? echo $ta; ?></td>
    <td>&nbsp;</td>
    <td><input type="hidden" name="kd_byr" value="<? echo $datajns[0]; ?>"></td>
  </tr>
</table>

<table width="105" border="0" align="center">
  <tr>
    <th width="99" align="left"><a href=menumhs.php>[X]Tutup</a></th>
    </tr>
</table>

</body>
</html>

