
<script language="javascript">
function addone()
{
var a = parseFloat(document.getElementById("h1").value);
var b=parseFloat(document.getElementById("h2").value);
var e = a * b ;
document.getElementById("h3").value=e;
}
</script>

<?php 
include("../../include/dbconnect.php");
?>
<title> Purchase Order details edit</title>
<body bgcolor="#ffffff"  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font ><b>Purchase  details edit</font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="590">
<form  name="abc" method="POST"  action="pupdate1.php?record=<?echo($record);?>&mypono=<?=$mypono?>&account_year=<?=$account_year?>&trans_id=<?=$trans_id?>">
<?php 

$result = mysqli_query($conn,"SELECT distinct tpurch.record, compcode, bcode, accthead, qty, rate, amount, mrp,batch_no,exp_date,manufact,discount_percent,tax_type FROM tpurch WHERE tpurch.record = '$record'  ") or die(mysqli_error());
$row1=mysqli_fetch_row($result);
$bcode = $row1[2];
$accthead = $row1[3];
	$bresult  = mysqli_query($conn,"select name from buy where bcode = '$bcode' ") or die(mysqli_error());
	$brow = mysqli_fetch_row($bresult);
	$bname = $brow[0];

	$bresult  = mysqli_query($conn,"select prodname from product where prodcode = '$accthead' ") or die(mysqli_error());
	$brow = mysqli_fetch_row($bresult);
	$pname = $brow[0];

?>

<table border="0" cellspacing="1" cellpadding="4" align="center" width="500" bgcolor="#999999">
        

<input type="hidden" name="record" value="<? echo($row1[0]); ?>">
<input type="hidden" name="bcode" value="<? echo($row1[2]); ?>">
<input type="hidden" name="accthead" value="<? echo($row1[3]); ?>">



<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Company Code </font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"   size="40" name="compcode" value = <?php echo("'$row1[1]'");?>readonly>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Buyer Name </font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"   size="40"  value = <?php echo("'$bname'");?> readonly>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Product Name </font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"   size="40"  value = <?php echo("'$pname'");?> readonly>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Batch No</font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"  id="h2"  size="40" name="batch_no" value = <?php echo("'$row1[8]'");?>>  </td></tr>



<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Quantity </font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"  id="h1"  size="40" name="qty" value = <?php echo("'$row1[4]'");?>>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Rate</font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"  id="h2"  size="40" name="rate" value = <?php echo("'$row1[5]'");?>>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">MRP</font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"  id="h2"  size="40" name="mrp" value = <?php echo("'$row1[7]'");?>>  </td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Discount %</font></td><td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13"  id="h2"  size="40" name="discount_percent" value = <?php echo("'$row1[11]'");?>>  </td></tr>




 <?php

$bq=mysqli_query($conn,"select taxtype, description, tax from salestax where taxtype = '$row1[12]' ") or die(mysqli_error());
$br = mysqli_fetch_row($bq);


$bankQuery=mysqli_query($conn,"select taxtype, description, tax from salestax  where reserved_word != 'OUTPUT' order by description") or die(mysqli_error());
?>
<tr>
  <td width="74" height="31" align="left" ><strong><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Sales Tax</font></strong></td>
<td> <SELECT name='ttype' onChange="javascript:submit();" >
<?php
    echo "<option selected value=$br[0]> $br[1]&nbsp;$br[2]%";
    while($row = mysqli_fetch_row($bankQuery))
    {
   		$temp = $row[1].'&nbsp;' .$row[2].'%';
		echo "<option value=\"$row[0]\">$temp";
	 }
?>
    </SELECT></td>


<tr>
<td align=right>
 <blockquote>  <input  type =submit name=submit value = "Update"></td> <td><input type =submit name=submit value = "Delete"></blockquote>
</table>


                                                                             
</body>
</form>
