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

echo buscar();

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

	# QUERYS
	$sCuentas = "SELECT TRIM(cta) AS cta, 
				TRIM(cta_nom) AS cta_nom,
				cta_con
				FROM cuentas WHERE cta_nom LIKE '%$txtNom%' AND cta LIKE '$txtCod%' AND cta_emp='$empCod'";

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

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