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

echo buscar();

function buscar() {
	$txtNom=utf8_decode(TRIM($_POST['txtNom']));
	$txtApe=utf8_decode(TRIM($_POST['txtApe']));
    $empCod=$_SESSION['empCod'];

	# QUERYS
	$sEmpleado = "SELECT 
					TRIM(mae_cod) AS mae_cod,
					TRIM(mae_nom) AS mae_nom,
					TRIM(mae_ape) AS mae_ape,
					mae_fing,
					trim(mae_stat) AS mae_stat
				FROM maestro WHERE mae_emp='$empCod' AND mae_nom LIKE '%$txtNom%' AND mae_ape LIKE '$txtApe%' ORDER BY mae_nom,mae_ape";

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

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