<?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 = "nom1080";
$bitMod = "nom";
$empCod = $_SESSION['empCod'];
$usuCod = utf8_decode($_SESSION['usuCod']);
$usuNom = utf8_decode($_SESSION['usuNom']);

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

}

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

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

	$func = new functions();

	$numNum=$_POST['numNum'];

	# QUERYS
	$sCtrpla = "SELECT *
				FROM ctrpla 
				WHERE ctrp_emp='$empCod' AND ctrp_num='$numNum'";

	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["ctrpla"] = $db->sFetchAssoc($sCtrpla);
	$db->close();

	$func = new functions();
	return $func->jsonEncodeArray($resp, 'ctrpla');
}

?>