<?
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 TRANSFER OUT - <?print $tr_no?></H3>
<?
$re1=mysqli_query($db,"select * from sparetransout where brcode='$brcode' and tr_no='$tr_no'")or die(mysqli_error());
$row1=mysqli_fetch_array($re1);
print "<table><tr><td>Date </td><td>".datetohtml($row1[entrydate])."</td></tr>";

$br=mysqli_query($db,"select * from branch where brcode='$row1[to_branch]'");
  $br_row=mysqli_fetch_row($br);
 print "<tr><td>To Branch</td><td>$br_row[1]</td>";
 print "<tr><td>Pur Ord No</td><td>$row1[pord_no]</td>";

$re=mysqli_query($db,"select * from sparetransout where brcode='$brcode' and tr_no='$tr_no'")or die(mysqli_error());
$i=1;
$t=0;
print "<table border=1><th>No <th>PartCode <th>Part Name <th>Qty";
while($row=mysqli_fetch_array($re))
{
 print "<tr><td>".$i++."</td><td>$row[partcode]</td><td>$row[partname]</td><td align=right>$row[qty]</td></tr>";
 $t+=$row[qty];
}
print "<tr><td colspan=3>Total </td><td align=right>".putComa($t)."</td></tr>";
?>
</table>
<br>
<input type=button value='Close' onClick=window.close()>

