<? 
session_start();
include("../opendb.php");
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$dbno=$_REQUEST['dbno'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

?>
<link type="text/css" href="cal/jquery-ui.min.css" rel="stylesheet" />	
<script type="text/javascript" src="cal/jquery.js"></script>
<script type="text/javascript" src="cal/jquery-ui1.js"></script>
<script type="text/javascript" src="cal/jquery-1.7.min.js"></script>
<script type="text/javascript" src="cal/jquery-ui.min.js"></script>
<script type="text/javascript" src="cal/jquery.jqEasyCharCounter.min.js"></script>
<script type="text/javascript">
  
$(function() {

    $("#rec_date").datepicker({
	dateFormat: "yy-mm-dd"
   });

 });
  </script>

<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
th{background-color:green;color:white}
.mnu{margin-left:5}
</style>
<body bgcolor='ivory'>
<CENTER>
<form name='f1' action='upd_dbnote.php' onSubmit="return valid()">
<br><br><br><br><br><br>
<table cellspacing=1 cellpadding=1 bgcolor=green>
<tr  bgColor='c1d7bb'><td align=center>
<table cellspacing=1 cellpadding=2>
<tr bgColor='c1d7bb'><td colspan=4 align=center bgcolor='green'>
<font color='ivory'><STRONG>DEBITNOTE UPDATE</TD></TR>
<tr><td>Debit Note No:</td><td colspan=3>
<?
$re=mysqli_query($db,"select dbno,date,partic,sum(dramt),dbto,recv_date,recv_rem,recv_amt,status from dbnote  where dbno='$dbno' and brcode='$brcode'")or die(mysqli_error());
$ro=mysqli_fetch_array($re);

?>

<input type=text name='dbno' readonly size=6 value='<?echo $ro[dbno]?>'></td></tr>
<td>Date </td><td><input type=text readonly name="nor_date" size=10 value='<?print $ro[date]?>'></td></tr>
<tr><td>Ledger Name</td><td colspan=3><input type=text name="partic" readonly size=50 value='<?print $ro[partic]?>'>
</td></tr>
<tr><td>Amount </td><td><input type=text readonly size=15 value='<?print $ro[3]?>'></td></tr>
<tr><td>Debit To</td><td><input type=text readonly size=20 value='<?print $ro[dbto]?>'></td></tr>
<tr><td>Recieved Date</td><td><input type=text id='rec_date' name='recv_date' size=10 value='<?print $ro[recv_date]?>'></td></tr>
<tr><td>Remarks</td><td><input type=text  name='recv_rem' size=15 value='<?print $ro[recv_rem]?>'></td></tr>
<tr><td>Recieved Amount</td><td><input type=text size=15  name='recv_amt' value='<?print $ro[recv_amt]?>'></td></tr>

<tr><td>Status</td><td><select name='status'>

<option value="P"<?php if ($ro[status] == 'P') echo ' selected="selected"'; ?>>Pending</option>
<option value="R"<?php if ($ro[status] == 'R') echo ' selected="selected"'; ?>>Rejected</option>
<option value="A"<?php if ($ro[status] == 'A') echo ' selected="selected"'; ?>>Accepted</option>
</select></td></tr>
<tr><td colspan=5 align=right><input type=submit value='   Update   ' name='save'>
 <input type=button value='   Cancel   ' onClick=document.location='dbnote_edit1.php'> </td></tr>
</table>
</form>
</table>


