<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Invalid Login') </script>";
 return;
}

include("opendb.php");
/*$tbl2c="chmaster";
mysqli_query($db,"drop table $tbl2c");
mysqli_query($db,"CREATE TABLE $tbl2c (chasis varchar(200))");
mysqli_query($db,"delete from $tbl2c");

$sqqc="insert into $tbl2c (chasis) select chasis from psn_amplvehicle.veh_invoice where brcode='aut141' order by chasis";
$ree=mysqli_query($db,$sqqc)or die('ERr spareopstock'.mysqli_error($db));
*/

print"<script>alert(hi)</script>";
if(@$_GET['type']=='name')
{
//$partname=$_GET['key'];
//$re=mysqli_query($db,"select acname,brcode,code,addr1,cst,cramt from customer where  acname like '%$partname%'  order by acname asc limit 50");
//print "select acname,brcode,code,addr1,cst,cramt from customer where  acname like '%$partname%'  order by acname asc limit 50";
 
}
else
{
$partcodec=$_GET['key'];
print"<script>alert(hi)</script>";
//$sql="select acname,brcode,code,addr1,cst,cramt,state1 from customer where   acname like '$partcode%' and brcode='$brcode' order by acname asc limit 50";
//echo $sql;
//$re=mysqli_query($db,"select chasis from psn_amplvehicle.veh_invoice where chasis like '%$partcodec%'  order by chasis asc limit 16");

$re=mysqli_query($db,"select acname,brcode,code,addr1,cst,state1 from customer where acname like '%$partcodec%'  order by acname asc limit 16");



}
$json="";
while($row=mysqli_fetch_array($re))
{
//    $sql="select msno from minput where cust='$row[code]' and brcode='$brcode'";
    //$result = mysqli_query($db,$sql);
    //$rowdt=mysqli_fetch_array($result);
	 //echo $row[0];
	 
	 $json.= '{"ordertoch":"'.$row[0].'"},';
	 
}
echo '['.trim($json,',').']';
?>