<?php include("../../include/dbconnect.php");?>
<?php 
if ($submit == "Submit")
{
  $cdt = substr($sdt,6,4).'/'.substr($sdt,3,2).'/'.substr($sdt,0,2);
  $query= "update custledger set crnoteno = '$crnoteno', crnotedt = '$cdt', crnoteamt = '$crnoteamt', drnoteno='$drnoteno', drnotedt='$cdt', drnoteamt='$drnoteamt' where invno='$invno' and date='$invdt'";
  mysql_query($query) or die ("Error in query: $query");

$insertquery ="update crnote set crnoteno='$crnoteno', crnotedt='$cdt', crnoteamt='$crnoteamt', invno='$invno', invdt='$invdt', invamt='$invamt', narration='$narration', drnoteno='$drnoteno', drnotedt='$cdt', drnoteamt='$drnoteamt' where record='$record'"; 
mysql_query($insertquery) or  die (mysql_error());
}

if ($submit == "Delete")
{
  $cdt = substr($sdt,6,4).'/'.substr($sdt,3,2).'/'.substr($sdt,0,2);
  $query= "update custledger set crnoteno = '', crnotedt = '', crnoteamt = '' where invno='$invno' and date='$invdt'";
  mysql_query($query) or die ("Error in query: $query");

$insertquery ="Delete from crnote where record='$record'"; 
mysql_query($insertquery) or  die (mysql_error());
}
?>

<meta http-equiv="refresh" content="0 url=index.html">
</body></form>


