<?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_retrieve=mysqli_query($con ,"SELECT DISTINCT(n_reg), pclave, descripcion,pmontomax 
                          FROM valeryus09 WHERE pclave like '$textBus%' or 
                         descripcion like '$textBus%'  order by n_reg ");
}
		 
		  while(@$reg = mysqli_fetch_array($sq_retrieve)){
			
                      $row["label"]="(".$reg['pclave'].")".$reg['descripcion'];
                       $row["descripcion"]=$reg['descripcion'];
                      $row["id"]=$reg['n_reg'];
                      $row["value"]=$reg['descripcion'];
                        $row["pmontomax"]=$reg['pmontomax']; 
                       $row["pclave"]=$reg['pclave'];
              $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 ,"SELECT valeryus09.descripcion,valeryus09.n_reg,valeryus09.cod_var,valeryus09.pmontomax,valeryus09.pclave FROM valeryus09 WHERE valeryus09.modulo='".$_SESSION['mod_sis']."' AND   descripcion like '$q%' order by descripcion limit $limit");
//elseif($_GET['tipBus']=='c')
//		$sq_invent=mysqli_query($con ,"SELECT * FROM valeryus09 WHERE valeryus09.modulo='".$_SESSION['mod_sis']."' AND pclave like '$q%' OR cod_var='$q' order by pclave limit $limit");
//while($dt_invent=mysqli_fetch_array($sq_invent)){
//	if($dt_invent['descripcion']!=''){
//        echo '.$dt_invent["descripcion"].' ;}
//         if($dt_invent['n_reg']!=''){
//            echo'. $dt_invent["n_reg"].' ;
//            $dt_invent['pmontomax']|$dt_invent['pclave']\n";
//}
?>
