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

echo buscar();

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

	# QUERYS
	$sCliencc = "SELECT 
					TRIM(cli_cod) AS cli_cod,
					TRIM(cli_nit) AS cli_nit,
					TRIM(cli_nom) AS cli_nom
				FROM cliencc WHERE cli_emp='$empCod' and cli_nom LIKE '%$txtNom%' AND cli_nit LIKE '$txtNit%' ORDER BY cli_emp,cli_nom";

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

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