<html>
<head>
<title>LAP Keu</title>
</head>
<body>
<?
include "connect.php";
include "rp.php";
include "indo.php";
$kd_byr = $_POST['kd_byr'];
$sqlkeu = mysql_query("SELECT temp.nim,mhs.nm_mhs,mhs.tingkat,mhs.kelas,mhs.semester,jns_byr.nm_byr,jns_byr.jum_byr,temp.temp_byr FROM temp,jns_byr,mhs WHERE temp.kd_byr=jns_byr.kd_byr and mhs.nim=temp.nim and temp.kd_byr='$kd_byr'order by mhs.nim ASC ") or die("Query failed with error: ".mysql_error());
$total= mysql_num_rows($sqlkeu);
$sqljum=mysql_query("select sum(temp_byr) from temp where kd_byr='$kd_byr'");
$datajum=mysql_fetch_row($sqljum);

$sqlkeu1=mysql_query("select jum_byr from Jns_byr where kd_byr='$kd_byr'");
$datajum1=mysql_fetch_row($sqlkeu1);
$jumsisa=$datajum1[0]*$total;
$qjumsisa=$jumsisa-$datajum[0];
?>
<h3><center>
<a href="index.php"> LAPORAN ADMINISTRASI KEUANGAN </a></h3>

<table align="center" width="1197" border="0">
			<tr bgcolor="#000000">
				<td width="122" align="center"><b><font face="verdana" size="2" color="#FFFFFF">NIM</font></b></td>
				<td width="238" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Nama</font></b></td>
				<td width="70" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Tingkat</font></b></td>
				<td width="64" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Smtr</font></b></td>
				<td width="281" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Biaya</font></b></td>
				<td width="125" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Jumlah</font></b></div></td>
				<td width="127" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Jum Byr</font></b></td>
				<td width="136" align="center"><b><font face="verdana" size="2" color="#FFFFFF">Sisa Byr </font></b></td>
			</tr>
	<?
	if ($total){
		while ($row=mysql_fetch_array($sqlkeu))
		{
		$sisa= $row[6]-$row[7];
		?>
			<tr>
				<td valign="top"><font face="verdana" size="2"><font face="verdana" size="2"><a href="detailbyr.php?id=<? echo $row[0]; ?> " style="text-decoration:none"><font size="2" face="verdana" color="#009900"><? echo $row[0]; ?></font></td>
				<td valign="top"><font face="verdana" size="2"><? echo $row[1]; ?></font></td>
			    <td valign="top"><div align="center"><font face="verdana" size="2"><? echo $row[2]; ?> <? echo $row[3]; ?></font></div></td>
				<td valign="top"><div align="center"><font face="verdana" size="2"><? echo $row[4]; ?></font></div></td>
				<td valign="top"><div align="center"><font face="verdana" size="2"><? echo $row[5]; ?></font></div></td>
				<td valign="top"><div align="center"><font face="verdana" size="2"><? echo rp($row[6]); ?></font></div></td>
				<td valign="top"><div align="center"><? echo rp($row[7]); ?></div></td>
				<td valign="top" align="center"><font face="verdana" size="2"><? echo rp($sisa); ?></font></td>
			</tr>
		<?	
		} 
	}else{
		?><p align="center"><font color="#FF0000" face="verdana" size="2"><b>Belum ada data yang Regist!!</b></font></p><?
	}
	?>
		<tr>
		<td align="left"><font face="verdana" size="2">JUMLAH: <? echo $total; ?></font></td>
		<td colspan="4" align="left">&nbsp;</td>
		<td align="left"><div align="center"><strong><? echo rp($jumsisa); ?></strong></div></td>
		<td align="left"><div align="center"><strong><? echo rp($datajum[0]); ?></strong></div></td>
		<td align="left"><div align="center"><strong><? echo rp($qjumsisa); ?></strong></div></td>
		</tr>

</table>
</body>
</html>
