<?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
	$sProvcp = "SELECT 
					TRIM(pro_cod) AS pro_cod,
					TRIM(pro_nit) AS pro_nit,
					TRIM(pro_nom) AS pro_nom
				FROM provcp WHERE pro_emp='$empCod' and pro_nom LIKE '%$txtNom%' AND pro_nit LIKE '$txtNit%' ORDER BY pro_emp,pro_nom";

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

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