<?php

if(session_id()=="") 
	session_start();
$com="AS";
require_once("DMMYSQLG.php");

$resultado=[];

  
	  $textBus=mysqli_real_escape_string($con,$_REQUEST['term']);
	  if(trim($textBus)!=''){

$sq_invent=mysqli_query($con ,$sq="SELECT np_desc1, nparte1,cve_uni_com FROM dginventp WHERE np_desc1 like '$textBus%' or
    		 nparte1 like '$textBus%'  order by nparte1");

}
		  @$sql = mysqli_query($con ,$sq_retrieve);
		  while(@$reg = mysqli_fetch_array($sql)){
                      $row["label"]="(".$reg['np_desc1'].")".$reg['nparte1'];
                       $row["nparte1"]=$reg['nparte1'];
                       $row["np_desc1"]=$reg['np_desc1'];
                      $row["id"]=$reg['nparte1'];
                      $row["value"]=$reg['np_desc1'];
                        $row["cod_var"]=$reg['cod_var'];
                       $row["cve_uni_com"]=$reg['cve_uni_com'];
              $resultado[]=$row;  
                  }
  echo json_encode($resultado);
//session_start(); 
//$com="AS";
//include("DMMYSQLG.php");
////include("DSA1000.php");
//include("DMMYSQLG.php");
//
//$q = mysqli_real_escape_string($con,$_GET["q"]);
//$limit= mysqli_real_escape_string($con,$_GET["limit"]);
//if($_GET['tipBus']=='d')
//	$sq_invent=mysqli_query($con ,$sq="SELECT np_desc1,nparte1,cod_var,cve_uni_com FROM dginventp WHERE dginventp.np_desc1 like '$q%' order by np_desc1 limit $limit");
//elseif($_GET['tipBus']=='c')
//		$sq_invent=mysqli_query($con ,$sq="SELECT * FROM dginventp WHERE dginventp.nparte1 like '$q%' OR dginventp.cod_var='$q' order by nparte1 limit $limit");
//		//echo $sq;
//		//echo mysqli_error($con);
//while($dt_invent=mysqli_fetch_array($sq_invent)){
////	$dt_basico=mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM dggruposp WHERE cve_uni='".$dt_invent['cve_uni_com']."'"));
//	echo "$dt_invent['np_desc1']|$dt_invent['nparte1']|$dt_basico['des_uni']|$dt_invent['cve_uni_com']|\n";
//}
?>