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

echo buscar();

function buscar() {
    $empCod=$_SESSION['empCod'];
    $numCodPresta=$_SESSION['numCodPresta'];

	# QUERYS
	$sPresta = "SELECT *, TRIM(pm_noprest) AS pm_noprest, TRIM(tipopres.tp_nom) AS tp_nom 
				FROM pres_mae LEFT JOIN tipopres ON pres_mae.pm_tipopre=tipopres.tp_cod  WHERE pm_cod = '$numCodPresta' ORDER BY pm_tipopre,pm_desde,pm_hasta";
	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["pres_mae"] = $db->sFetchAll($sPresta);
	$db->close();

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