<?php 
include("../../include/dbconnect.php");
?>
<title> Account Head Edit</title>
<body background="../../images/blater01.gif" topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=744>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Arial, Helvetica, sans-serif" ><b>Account Head edit</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="744"><td width="205">

<form name="form1" method="POST"  action="update.php?<?echo($record);?>">
  <? 	

$result=mysqli_query($conn,"select * from acctmast where record = '$record' ");
$row = mysqli_fetch_assoc($result);
?>
  <tr>
    <td><font face="Arial, Helvetica, sans-serif" class="sbd"><b>Account Head</b></font></td>
    <td width="515"> <font face="Arial, Helvetica, sans-serif"> 
      <input type="text" onKeyPress="return event.keyCode!=13" size="40" name="description" value = <?php echo("'$row[description]'");?>>
      </font></td>
  </tr>
   <tr>
    <td><font face="Arial, Helvetica, sans-serif" class="sbd"><b>Active Account</b></font></td>
    <td> <font face="Arial, Helvetica, sans-serif"> 
      <input type="text" onKeyPress="return event.keyCode!=13" size="40" name="active" value = <?php echo("'$row[active]'");?>>
      ' No' if not active</font></td>
  </tr>
  
  <tr>
    <td><font face="Arial, Helvetica, sans-serif" class="sbd"><b>Reserved Word</b></font></td>
    <td width="515"> <font face="Arial, Helvetica, sans-serif"> 
      <input type="text" onKeyPress="return event.keyCode!=13" size="40" name="reserved_word" value = <?php echo("'$row[reserved_word]'");?>>
      </font></td>
  </tr>  
  
    <tr>
    <td><font face="Arial, Helvetica, sans-serif" class="sbd"><b>Opening Stock (For Products only)</b></font></td>
    <td width="515"> <font face="Arial, Helvetica, sans-serif"> 
      <input type="text" onKeyPress="return event.keyCode!=13" size="40" name="opb" value = <?php echo("'$row[opening_balance]'");?>>
      </font></td>
  </tr> 
	<?
	$jresult = mysqli_query($conn,"select acctcode,groupname from acctgroup where acctcode = '$row[acctgroup]'");
	$jrow = mysqli_fetch_row($jresult); 
	?>
	
  <tr> 
    <td > <font face="Arial, Helvetica, sans-serif" class="sbd"><b>Account Group</b></font> 
    </td>
    <td colspan=2> <font face="Arial, Helvetica, sans-serif"> 
      <select name=acgroup>
	<option  value="<?=$jrow[0]?>" selected><? echo $jrow[1];?>
 
        <?php

	  
$query = "select acctcode,groupname  from acctgroup order by groupname";
$query = stripslashes($query);
$result= mysqli_query($conn,$query) or       die (mysqli_error() );
     while($row=mysqli_fetch_row($result) )
       {
        echo "<option value='$row[0]'>";
	echo $row[1];
	echo "\n";
	}
?>
      </select>
      </font></td>
  </tr>	
	
  <?
  /*
    <tr>
    <td><font face="Arial, Helvetica, sans-serif" class="sbd"><b>Type Debit / Credit</b></font></td>
    <td width="515"> <font face="Arial, Helvetica, sans-serif"> 
      <input type="text" onKeyPress="return event.keyCode!=13" size="40" name="db_cr" value = <?php echo("'$result[db_cr]'");?>>
      </font></td>
  </tr> 
  */

  ?>
  
  <input type="hidden" name="record" value="<?=$record?>">
<input type="hidden" name="acctcode" value="<?=$row['acctcode']?>">

  <table cellpading=0 cellspacing=10 width= 50>
    <tr> <blockquote>
      <td>  <input type =submit name=submit value = "Update"></td>
      <td><input type ="submit" name="submit" value = "Delete"></blockquote>
        
  </table>
</table>
<br><br><font size=1><center>
  <font face="Arial, Helvetica, sans-serif"><a href= "../../index.html">Return to index 
  page</font>
</center>
</font> 
                                                                             
</body>
</form>
