<?php


$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
mysql_selectDB("wauhaha_karaoke",$login);
$SupID = $_GET['SupID'];
$time = date("Y-m-d");


$total=$_POST['total'];
$time=date('Y-m-d');
$c = $_POST['c'];

$PoID = $_POST['po'];
$TID =$_POST['TID'];
$result2=mysql_query("select * from ksupplier where SupID='$SupID'");
$row3 = mysql_fetch_array($result2);
$SupName = $row3['SupName'];
$Price = $row3['ProPrice'];





echo "<form  method='post'  action=http://www.wauhaha.com/karaoke/addnewkstockaction1.php?SupID=$SupID >
<input type=hidden name=c value=".$c.">
<br>
<table align=center width=1300>
<tr>
	<td align=center  width=><u>Karaoke Company</td>
	<td align=center width=650><u>Supplier Company</td>
</tr>
<tr>
<td>
<table align=center>
<tr>
	<td width=140>Company Name </td>
	<td width=1>:</td>
	<td>LoudSpeaker Karaoke</td>

</tr>
<tr>
	<td width=110>Company Address</td>
	<td width=1>:</td>
	<td>Sutera Utama</td>
</tr>
<tr>
	<td width=110>Company Phone</td>
	<td width=1>:</td>
	<td>07-559 9998</td>
</tr>


</table>
</td>
<td>
<table align=center>
<tr>
	<td width=140>Company Name </td>
	<td width=1>:</td>
	<td>".$row3['SupName']."</td>

</tr>
<tr>
	<td width=110>Company Address</td>
	<td width=1>:</td>
	<td>".$row3['SupAdd']."</td>
</tr>
<tr>
	<td width=110>Company Phone</td>
	<td width=1>:</td>
	<td>".$row3['SupContact']."</td>
</tr>

<tr>
	<td width=110>Company HPhone</td>
	<td width=1>:</td>
	<td>".$row3['SupHp']."</td>
</tr>
<tr>
	<td width=110>Company Fax</td>
	<td width=1>:</td>
	<td>".$row3['SupFax']."</td>
</tr>
</table>
</td>
</tr>
</table>
<hr>
<table align=center>
<tr>
	<td>PoID :</td>
	<td>"; include('kpoid.php');echo "</td>
</tr>
<tr>
	<td>Date :</td>
	<td>$time</td>
</tr>
</table>
<br>
<br>

<table  style='font-size:14pt;font-family;verdana' cellspacing=0 width=100% cellpadding=0 > 

<tr> 
<td width=300 align=center>Product Name</td> 
<td width=300 align=center>Quantity</td> 
<td width=300 align=center>Unit Price(RM)</td> 
<td width=300 align=center>Total Price(RM)</td> 


</tr>";

for ($a=1; $a <$c; $a++)
{
$q=$_POST['q'.$a];
$p=$_POST['p'.$a];
$t=$_POST['t'.$a];
$pr = $_POST['pr'.$a];
$result = mysql_query("select ProPrice From kstock Where ProName = '$p' ");
$row=mysql_fetch_array($result);

	
echo "<tr>
			<td align=center>$p <input type=hidden name=p$a value=$p></td>
			<td align=center>$q <input type=hidden name=q$a value=$q></td>
			<td align=center> $pr<input type=hidden name=pr$a value=$pr></td>
			<td align=center> $t <input type=hidden name=t$a value=$t></td>
</tr>";



}


echo "<tr>
	<td></td>
	<td></td>
	<td align=right>Total</td>
	<td align=center>RM $total</td>

</tr>";



echo "<tr>

<td colspan=4 align=center><input type=submit value=OK style='width:100;height:50'> </td>

</tr></table>
</form>
<center><button onclick='window.print()' style='width:100;height:50'>Print</button></center>";
?>