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

echo buscarexi();

function buscarexi() {
	$func = new functions();

	$empCod=$_SESSION['empCod'];
	$txtCod=utf8_decode(TRIM($_POST['txtCod']));

	# QUERYS
	$sExiart =  "SELECT e.*, TRIM(b.bod_nom) AS bod_nom
				FROM mp_exiart e 
				LEFT JOIN mp_bodegas b ON e.ea_emp=b.bod_emp AND e.ea_bod=b.bod_cod
				WHERE e.ea_emp='$empCod' AND e.ea_cod='$txtCod'";

	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["exiart"] = $db->sFetchAll($sExiart);
	$resp["imgBusArtic"] = "imgArticulos/$empCod"."_".$func->imgCharacters($txtCod).".jpeg?".rand(1,9999);
	$db->close();

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