


<?php 
include("../../include/dbconnect.php");
?>
<title> Invoice  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 >Invoice  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?trans_id=<?=$trans_id?>">
<?php 

$result = mysqli_query($conn,"SELECT distinct spurch.record, compcode, bcode, prodcode, qty, rate, discount_percent,taxtype,stainer_rate,specification FROM spurch WHERE spurch.record = '$record'  ") or die(mysqli_error());
$row1=mysqli_fetch_row($result);
$bcode = $row1[2];
$accthead = $row1[3];
$specification = $row1[7];

	$bresult  = mysqli_query($conn,"select name from bill_patient where inv_no = '$inv_no' and inv_date = '$inv_date'  ") 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">Quantity </font></td><td  bgcolor="#FFFFFF">
<input type="text" onKeyPress="return event.keyCode!=13"     id="h1" onChange="addone()" 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" onChange="addone()" size="40" name="rate" value = <?php echo("'$row1[5]'");?>>  </td></tr>



<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Colour</font></td><td  bgcolor="#FFFFFF">
<input type="text" onKeyPress="return event.keyCode!=13"     id="h2" onChange="addone()" size="40" name="specification" value = <?php echo("'$row1[9]'");?>>  </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" onChange="addone()" size="40" name="discount_percent" value = <?php echo("'$row1[6]'");?>>  </td></tr>

																																																																								
 <?php

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


$bankQuery=mysqli_query($conn,"select taxtype, description, tax from salestax   where reserved_word != 'INPUT' 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>



<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>
