<html>
<head>
<title>Edit Stock</title>
</head>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<?php include('link.php');?>

</center>
<center><h1>Admin View Kitchen Stock Transaction</h1></center>
<center><a href='http://www.wauhaha.com/karaoke/kitstock.php'><img src=back.jpg width=40 height=40></a>&nbsp;
<?php


$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
mysql_selectDB("wauhaha_karaoke",$login);
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 5; 
$result = mysql_query("SELECT * FROM kstocktran order by TNum DESC LIMIT $start_from,5");

echo "<table border=1 align=center style ='font-family:Arial, Helvetica, sans-serif;font-size:1em' color='blue' bordercolorlight='tan' cellspacing=0 cellpadding=4>
 <tr bgcolor=lightblue ><th>Tran ID</th>	
				
						<th>Invoice</th>
 						<th>Sup Name</th>
					
						<th>ProName</th>
					
						<th>Quantity</th>
				
						<th>ProPrice</th>
				
						<th>ProTPrice</th>
						<th>Date</th>";
		
						

while($row2 = mysql_fetch_array($result)){
$q = $row2['ProAddQuan'];
$p = $row2['ProPrice'];
$tp = $q * $p;
  echo"<tr align='center' border=1>";
	
  echo "<td border=1>".$row2['TNum']."</td>";

  echo "<td border=1>".$row2['Inv']."</td>";
  echo "<td border=1>".$row2['SupName']."</td>";

  echo "<td border=1>".$row2['ProName']."</td>";

  echo "<td border=1>".$row2['ProAddQuan']."</td>";

  echo "<td border=1>RM".$row2['ProPrice']."</td>";

  echo "<td border=1>RM $tp</td>";
  echo "<td border=1>".$row2['Date']."</td>";

	


  
  echo "</tr>";
 
  }
  $sql = mysql_query("select COUNT(*) From kstocktran");  

$row=mysql_fetch_array($sql);
$total_records = $row[0];
$total_pages = ceil($total_records / 5);
echo "<center>";
for ($i=1; $i<=$total_pages; $i++) { 
	echo "<a href='kviewtrans.php?page=".$i."'>&nbsp;" .$i. "&nbsp;</a>"; 
}; 
echo "</center>";
  echo "</table>";

mysql_close($login);
?>