<? 
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];

if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Khadi</title>
<link type="text/css" href="jquery/jquery-ui.min.css" rel="stylesheet" />	
<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>
<script type="text/javascript" src="jquery/jquery.jqEasyCharCounter.min.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />

<script type="text/javascript">
$(function(){

$(".inno").live("keydown.autocomplete",function(){
$inno = $(this);

$row = $inno.parent().parent();
$(this).autocomplete({
		source: function( request, response ) {

		$.ajax({
			url: "search6.php",
			dataType: "json",
			data: "key="+$inno.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {
					
					
					return { 
						label: '<span class="la-code">'+item.inno+' </span><span class="la-name">'+  item.partname + '</span><span class="la-stok"> '+ item.stock +'</span><span class="la-rate"> '+item.rate +'</span>'    ,
						value: item.inno,
						name:item.partname,
						tax:item.tax,
						
						stock:item.stock,
						rate:item.rate,
						reduct:item.reduct,
							
						
					}
				}));
			}
		});
	}
	
,
	minLength: 2,
	select: function( event, ui ) {
	$row.find('.partname').val(ui.item.name);
	$row.find('.stok').val(ui.item.stock);
	$row.find('.unitprice').val(ui.item.rate);
	
	$row.find('.tax').val(ui.item.tax);
	$row.find('.itmvl').val(ui.item.reduct);
	$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>


<body >

<?
  $qry=mysqli_query($db,"select distinct(invno) from brtransferin where brcode='$brcode' order by invno desc");
?>
<table align='center'>
<form name='f1' action='brnchrcpt_viewinv.php' >
           <tr><td> <b><font style="color:black;">Invoice Number:</font></b></td><td><select id="cid"  name='inno' >
          <option>-Select-</option>
           <?
           while($row=mysqli_fetch_array($qry))
             {
                print "<option>$row[0]</option>"  ;
             }
             ?>

</td> <td ><input type='submit' name='show' value='Show' onclick="viewinv(document.getElementById('cid').value)"></td></tr>

           








</table>




</body>
