<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Invalid Login'); parent.document.location='ind.php' </script>";
 return;
}
include("../opendb.php");
include("../test.php");
?>
<title>Assest Report</title>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
body,td{font-family:arial narrow;font-size:14}
th{background-color:silver}
tr{background-color:white}
</style>
<CENTER>
<h2>ASSET MASTER - REPORT</H2>
<table cellspacing=1 cellpadding=1 bgcolor=gray>
<th>Group <th>Count
<?
$rest=mysqli_query($db,"select agroup,count(agroup) from asset group by agroup");
while($r1=mysqli_fetch_row($rest))
{
 print "<tr bgcolor='white'><td>$r1[0]</td><td align=right>$r1[1]</td></tr>";
}
?>
</table>
<br>
<table cellspacing=1 cellpadding=1 bgcolor='gray'>
<th>No<th> Code <th> Name<th>Group <th>Description <th>Cost <th>Current Value <th>Supplier 
<th>P Date <th>Branch<th>Insure <th>Edit
<?
$re=mysqli_query($db,"select * from asset where brcode='$brcode' order by agroup,aname")or die(mysqli_error($db));
$i=1;
while($row=mysqli_fetch_array($re))
{
 print "<tr bgColor='white'><td>".$i++."</td><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td>";
 print "<td>$row[3]</td><td align=right>$row[4]</td><td align=right>$row[5]</td><td>$row[6]</td><td>$row[7]</td>";
 print "<td>$row[location]</td><td>$row[insure]</td><td>\n<input type=button value='Edit' onClick=fun('".str_replace(' ','*',$row[0])."')></td>\n</form>";
}
?>
<script>
 function fun(x)
 {
  window.open('editamast.php?code='+x)
 }
</script>
