<?php
include('../includes/validador.php');
include('../includes/funciones.php');
include('../conexiones/conex.php');

$id = $_POST['id'];

$anho = date("Y");
$mesesC = "";

//OBTENEMOS LOS VALORES DEL PRODUCTO

$sql= sprintf ("SELECT * FROM alumno AL INNER JOIN matricula MT ON AL.Persona_id = MT.Persona_id WHERE AL.Persona_id = '$id'");
$valores=mysqli_query($con,$sql);
$valcatnoti = mysqli_fetch_array($valores);

$imagen = $valcatnoti['portada_alumno'];

$sqlMes = "SELECT * FROM mesescuotas MC WHERE NOT EXISTS (SELECT * FROM pagos_cuotas PC WHERE MC.nombreMes = PC.mesPago AND INTAnhoLect = $anho AND PC.monto_cuota = PC.monto_pago AND estadoPago IS NULL AND PC.intPersona = '$id')";
$queryMes = mysqli_query($con, $sqlMes);

$mesesC =  $mesesC.'<option>Selecciona</option>';
while($fetchMes = mysqli_fetch_assoc($queryMes)){
	$mesesC =  $mesesC.'<option>'.$fetchMes['nombreMes'].'</option>';
}

$datos = array(
	0 => $valcatnoti['Matricula_id'],
	1 => $valcatnoti['Curso_id'],
	2 => $valcatnoti['Turno'],
	3 => $valcatnoti['AhoLectivo'],
	4 => $valcatnoti['Obs_Matricula'],
	5 => $mesesC,
	6 => $sqlMes
	);

echo json_encode($datos);
?>