<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='inde.php'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
date_default_timezone_set("Asia/Kolkata");
$recrdid=$_REQUEST['recrdid'];
?>
<html>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../jquery/jquery-1.7.min.js"></script>
<script type="text/javascript" src="../jquery/jquery-ui.min.js"></script>
<link type="text/css" href="../jquery/jquery-ui.min.css" rel="stylesheet" />	
<link rel="stylesheet" href="../css/form.css" type="text/css" /> 

<script type="text/javascript">
$(function(){
  $(".exphd").live("keydown.autocomplete",function(){
  $led = $(this);
  $row = $led.parent().parent();
  $(this).autocomplete({
    source: function( request, response ) {
    $.ajax({
      url: "../searchled_new.php",
      dataType: "json",
      data: "key="+$led.val(),
      success: function( data ) {
        response( $.map( data, function( item ) {
          return {
            label: '<span class="la-code">'+item.led+' </span><span class="la-name">'+  item.partname + '</span>',
            value: item.led,
            name:item.partname,
            }
        }));
      }
    });
  }
  ,
  minLength: 2,
  select: function( event, ui ) {
  $row.find('.led').val(ui.item.value);
  $row.find('.stok').val(ui.item.stock);
  $row.find('.qty').focus();
  /*log( ui.item ?
  "Selected: " + ui.item.label :
  "Nothing selected, input was " + this.value);
  */
   }

  }).data("ui-autocomplete")._renderItem = function (ul, item) {
         return $("<li></li>")
             .data("item.autocomplete", item)
             .append( item.label )
             .appendTo(ul);
     };
  });
});
</script>
<?
if(isset($_POST['save']))
{
    $recrdid=$_REQUEST['recrdid']; 
    //print "delete from psnindia_gen4psnauto_psn_psndb.upentry where id='$recrdid'";
    mysqli_query($db,"delete from psnindia_gen4psnauto_psn_psndb.upentry where id='$recrdid'") or die(mysqli_error($db));
    //log_entry($brcode,$user,$REMOTE_ADDR,"Bank Statement Entry JVNo: $jvno, ID No:$recrdid",$db);
    print "<script>window.close()</script>";
    header("Refresh:0; url=bankstate.php");
}
$invres1=mysqli_query($db,"select * from psnindia_gen4psnauto_psn_psndb.upentry where brcode='PSN236' and id='$recrdid' and jvno=0");
$invrow=mysqli_fetch_array($invres1);
$narrationdat=$invrow['partic'];
$invnnum=mysqli_num_rows($invres1);
if($invnnum>0)
{
    if($invrow['dramt']>0)
    {
        $invvalue=$invrow['dramt'];
    }
    if($invrow['cramt']>0)
    {
        $invvalue=$invrow['cramt'];
    }
    ?>
    <style>
    body,td 
    {
        margin: 0 auto;
    	font-family: Arial, Verdana, Sans-Serif;
    	font-size: 0.8em;
    }
    th{font-family:verdana;font-size:11;color:white;background-color:#5b5858}
    body{background-color:ivory}
    </style>
    <center>
    <div class="w3-container w3-pale-red">
    <h4>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp DETAILS OF ACCOUNTS</h4> 
    <th colspan=12 ><h4></h4></th>
    </div>
    <table cellspacing=1 cellpadding=5 border=0 class="form">
    <form name='f1' action='<?print $PHP_SELF?>' method='post' onSubmit="return valid()">
    </th>
    <input type='hidden' name='recrdid' id='recrdid' value='<? echo $recrdid ?>'>
    </table>
    <th colspan=2><input type=submit value='Delete' name='save'>
    </form>
    </div>
    <?
}
?>
</html>