<?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 ="SELECT DISTINCT(gclave), gdescrip, gtotal, manual
							FROM ftarifas 
							WHERE gclave like '$textBus%' 
                                                        OR  gdescrip like '$textBus%'
							ORDER BY gclave";
		
		  }
		  @$sql = mysqli_query($con ,$sq_retrieve);
		  while(@$reg = mysqli_fetch_array($sql)){
			
                      $row["label"]="(".$reg['gclave'].")".$reg['gdescrip'];
                       $row["gdescrip"]=$reg['gdescrip'];
                      $row["id"]=$reg['gclave'];
                      $row["value"]=$reg['gclave'];
                        $row["gtotal"]=$reg['gtotal'];
                       $row["manual"]=$reg['manual'];
              $resultado[]=$row;  
		  }
	  
          
  echo json_encode($resultado);
?>