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

echo buscar();

function buscar() {
	$empCod=$_SESSION['empCod'];
	$txtNom=utf8_decode(TRIM($_POST['txtNom']));
	
	# QUERYS
	$sBod = "SELECT 
					TRIM(bod_cod) AS bod_cod,
					TRIM(bod_nom) AS bod_nom
				FROM bodegas WHERE bod_emp='$empCod' AND bod_nom LIKE '%$txtNom%'";

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

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