<?php
include_once('../../../php/sessionStart.php');
include_once('../../../php/db/dbExec.php');
include_once('../../../php/functions.php');
include_once('../../../php/timezone.php');
include_once('../../../php/privileges.php');
include_once('../../../php/maxExecTime.php');

$bitForm = "ban1100";
$bitMod = "ban";
$empCod = $_SESSION['empCod'];
$usuCod = utf8_decode($_SESSION['usuCod']);
$usuNom = utf8_decode($_SESSION['usuNom']);

switch ($_POST['action']) {
	case 'consultar':
		echo consultar();
		break;

}

function consultar() {
	global $empCod, $usuNom;

	$priv = new privileges();
	if (!$priv->consult($_SESSION['usuPriv'])) {
		return json_encode($priv->rErrorConsult());
	}

	$func = new functions();

	$tipoCod="004";
	$numNum=$_POST['numNum'];
	$selBanCod=$_POST['selBanCod'];

	# QUERYS
	$sCheques = "SELECT * FROM cheques WHERE ch_emp='$empCod' AND ch_ban='$selBanCod' AND ch_tipo='$tipoCod' AND ch_num='$numNum'";

	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp = $db->sEx($sCheques, "cheques");
	$db->close();
	$func = new functions();
	return $func->jsonEncodeArray($resp, 'cheques');
}
?>