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

echo buscar();

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

	# QUERYS
	$sDescu = "SELECT *, TRIM(tipodesc.td_desc) AS td_desc 
				FROM descuentos LEFT JOIN tipodesc ON descuentos.d_codd=tipodesc.td_cod  WHERE d_cod = '$numCodDescu' ORDER BY d_codd,d_feci,d_fecf";
	# EJECUCION DE QUERYS
	$db = new dbExec();
	$resp["descuentos"] = $db->sFetchAll($sDescu);
	$db->close();

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