<?
session_start();
include("../opendb.php");
$brcode=$_SESSION['brcode'];
$partcode=$_GET['key'];
$re=mysqli_query($db,"select distinct invno,customer,entrydate from sap_einvoice a where invno like '%$partcode%' and brcode = '$brcode' order by invno limit 10");
$json="";
while($row=mysqli_fetch_array($re))
{
    $df=implode('-', array_reverse(explode('-', $row['entrydate'])));
	$json.= '{"partcode":"'.$row[0].'","partname":"'.addslashes($row[1]).'","date":"'.$df.'"},';
}
echo '['.trim($json,',').']';
?>
