<?
session_start();
include("../opendb.php");
include("../test.php");
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
//	tr{background-color:white}
	th{background-color:steelblue;color:white}
.right{text-align:right};
</style>
<center>
<h3>SPARE - PURCHASE RETURN</H3>
<?
$res=mysqli_query($db,"select * from sparepurreturn where brcode='$brcode' order by retno");
print "<table border=0 cellpadding=3> <th>Ret No <th>Supplier <th>Ret Date ";
print "<th>Item Code <th>Item Name <th>Ret Qty";
while($row=mysqli_fetch_array($res))
{
  $supres=mysqli_query($db,"select supname from sup_master where code='$row[suplier]'")or die('err'.mysqli_error($db));
  if(mysqli_num_rows($supres)>0)
    $suprow=mysqli_fetch_array($supres);
  else
  {
   $supres1=mysqli_query($db,"select brname,brcode from branch where brcode='$row[suplier]'")or die('err'.mysqli_error($db));
    $suprow=mysqli_fetch_array($supres1);
  }
print "<tr bgcolor='aliceblue'><td>$row[0]</td><td>$row[suplier]</td><td>".datetohtml($row[entrydate])."</td>";
  print "<td>$row[partcode]</td><td>$row[partname]</td><td align=right>$row[retqty]</td></tr>";
}
print "</table>";
?>

