<?php $PageSecurity = 11;
//echo $_SERVER['QUERY_STRING'];exit;
include('includes/DefineSuppTransClass.php');
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
include('includes/function_lib.php');

  include('includes/session.inc');
$sqlitem_details = "select * from addmrnqty  where id='".$_GET['addmrn']."'";
$result = DB_query($sqlitem_details, $db);
$myrow=DB_fetch_array($result);
?>
<script language="javascript">
function update_amount()
{
   document.getElementById("item_total_rate").value= parseFloat(document.getElementById("reciveqty").value) * parseFloat(document.getElementById("itemprice").value);
 }
</script> 
<?php 
 if($_REQUEST['item_details_save']){
   	$dataArray['itemprice']=$_REQUEST['itemprice'];
	$dataArray['reciveqty']=$_REQUEST['reciveqty'];
	$dataArray['item_total_rate']=$_REQUEST['itemprice'] * $_REQUEST['reciveqty'];
	$cond="id='".$_GET['addmrn']."'";
	$sql_updatedetails = $s->EditRecord('addmrnqty', $dataArray, $cond);
	$result = DB_query($sql_updatedetails, $db);
     $sqlitem_details = "select * from addmrnqty  where id='".$_REQUEST['id']."'";
	 ?>
	 <script language="javascript">
	 var me = window.self;
            me.opener = window.self;
            me.close();
			</script>
	 <?php 
}
?>
 <form action="" method="post">
<table width="100%" border="0" >
 <tr>
    <td>Item Description</td>
    <td>Quantity</td>
    <td>Rate</td>
     <td>Amount</td>
</tr>
<tr>
<td>
<input name="update_item_details_save" type="hidden" value="<?php $_GET['addmrn'] ?>" />
<input type="text" name="desc" size="50" value="<?php echo $myrow['desc']  ?>"></td>
<td><input type="text" name="reciveqty" id="reciveqty"  value="<?php echo $myrow['reciveqty']  ?>" /></td>
<td><input type="text" name="itemprice" id="itemprice"  value="<?php echo $myrow['itemprice']  ?>" onblur="update_amount()" />
</td>
<td><input type="text" name="item_total_rate"  id="item_total_rate"  value="<?php echo $myrow['item_total_rate']  ?>" /> </td>
<td><input name="item_details_save" type="submit" value="Edit"   />
</td>
</tr>  
</table>
</form>