<?php
include('../../../php/sessionStart.php');
include('../../../php/db/dbExec.php');
include('../../../php/functions.php');

echo buscar();

function buscar() {
	$txtNom=utf8_decode(TRIM($_POST['txtNom']));
	
    $empCod=$_SESSION['empCod'];
	
	# QUERYS
	$sGruposi = "SELECT 
					TRIM(gru_cod) AS gru_cod,
					TRIM(gru_nom) AS gru_nom
				FROM gruposi WHERE gru_emp='$empCod' AND gru_nom LIKE '%$txtNom%'";

	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["gruposi"] = $db->sFetchAll($sGruposi);
	$db->close();

	$func = new functions();
	return $func->jsonEncodeArray($resp, "gruposi");
}
?>