<?php 
include("../../include/dbconnect.php");
?>
<title> Trade Invoice details edit</title>
<body bgcolor="#ffffff"  topmargin=0>
<center>
<script language="javascript">
function addone()
{
var a = parseFloat(document.getElementById("h1").value);
var b=parseFloat(document.getElementById("h2").value);
var c=parseFloat(document.getElementById("h3").value);
var d = a * b * c ;
var e=parseFloat(document.getElementById("h4").value);
var f = d * e / 100;
document.getElementById("h5").value=f;
 
}
</script>
<script language="javascript">
function add_one()
{
var a = parseFloat(document.getElementById("h1").value);
var b=parseFloat(document.getElementById("h2").value);
var c=parseFloat(document.getElementById("h3").value);
var d=parseFloat(document.getElementById("h5").value);
var e = ( a * b * c ) - d ;
document.getElementById("h6").value=e;
 
}
</script>

<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font ><b>Trade Items 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);?>">
<?php 
$result = mysqli_query($conn,"select trading.record,   trading.prodcode, product.prodname, trading.quantity, trading.capacity,  trading.rate, trading.discount, trading.discount_amt, trading.value, trading.remarks, trading.trans_id from trading, product where trading.record ='$record' and trading.prodcode != 'TOTAL' and trading.prodcode=product.prodcode ") or die(mysqli_error());
$row1=mysqli_fetch_row($result);
?>

<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="srec" value="<? echo($srecord); ?>">
<input type="hidden" name="trans_id" value="<? echo($row1[10]); ?>">


<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" name="prodname" readonly value = <?php echo("'$row1[2]'");?>>  </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"   maxlength=12 size="10" name="qty" value = <?php echo("'$row1[3]'");?> id="h1" onChange="addone()" ></td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Capacity </font></td><td  bgcolor="#FFFFFF">
<input type="text" onKeyPress="return event.keyCode!=13"   maxlength=20 size="40" name="capacity" value = <?php echo($row1[4]);?> id="h2" readonly></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"   maxlength=20 size="40" name="rate" value = <?php echo($row1[5]);?> id="h3" onChange="addone()"></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"   maxlength=20 size="40" name="discount" value = <?php echo($row1[6]);?> id="h4" onChange="addone()"></td></tr>

<tr><td  bgcolor="#FFFFFF"><font  face="Arial, Helvetica, sans-serif">Remarks </font></td><td  bgcolor="#FFFFFF">
<input type="text" onKeyPress="return event.keyCode!=13"   maxlength=20 size="40" name="remarks" value = <?php echo($row1[9]);?>></td></tr>


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


                                                                             
</body>
</form>
