<?php include('includes/head.php'); 
$id = $_GET['id'];
$anhoL = $_GET['anho'];

$sqlAlumno = "SELECT * FROM alumno AL INNER JOIN persona PS ON AL.Persona_id = PS.Persona_id WHERE PS.Persona_id = '$id'";
$queryAlumno = mysqli_query($con, $sqlAlumno);
$fetchAlumno = mysqli_fetch_assoc($queryAlumno);

$sqlCurso = "SELECT * FROM curso";
$queryCurso = mysqli_query($con, $sqlCurso);
$queryCurso1 = mysqli_query($con, $sqlCurso);

$sqlMeses1 = "SELECT * FROM mesescuotas";
$queryMeses1 = mysqli_query($con, $sqlMeses1);

?>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <?php include('includes/header.php'); ?>
  
  <!-- Left side column. contains the logo and sidebar -->
  <?php include('includes/menu_lateral.php')?>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <?php include('includes/paginacion.php');?>
      
    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-lg-12 col-12">
        <div class="box">
            <div class="box-header with-border">
              <h4 class="box-title">Estado de cuenta de Alumno: <strong><?php echo $fetchAlumno['Nombre'].' '.$fetchAlumno['Apellido'] ?></strong></h4>
            </div>
            
              <!-- /.box-header -->
              <div class="box-body" id="tablasPagos">
                <div class="row">
                  <div class="col-lg-3 col-md-6">   
                      <div class="form-group">
                          <h5>Reporte de Matriculas</h5>
                          <div class="controls">
                              <select id="opcion_reporte_mat" name="opcion_reporte_mat" class="form-control select2" onchange="return reporteMatricula(this.value)" required>
                                  <option value="" ><b>Selecciona el curso</b></option>
                                  <?php while($fetchCurso = mysqli_fetch_assoc($queryCurso) ){ ?>
                                    <option value="<?php echo $fetchCurso['Curso_id'] ?>"><b><?php echo $fetchCurso['Descripcion'].' '.$fetchCurso['cicloCurso'] ?></b></option>
                                  <?php } ?>
                              </select>
                          </div>
                      </div>
                  </div>

                </div>
                  <img src="images/cargando.gif" alt="Cargando reporte" class="d-none" id="carg_reporte_matr">

                <div class="table-responsive" id="cuadro_tabla_matr">
                    <table id="reporte_cuenta_matr" class="table table-striped table-bordered dataTable no-footer"></table>
                </div>				
              </div>
          </div>


          <div class="box">
            <div class="box-header with-border">
              <h4 class="box-title">Estado de cuenta en cuotas</strong></h4>
            </div>
            
              <!-- /.box-header -->
              <div class="box-body" id="tablasPagos">
                <div class="row">
                  <div class="col-lg-3 col-md-6">   
                      <div class="form-group">
                          <h5>Reporte por curso</h5>
                          <div class="controls">
                              <select id="opcion_reporte" name="opcion_reporte" class="form-control select2" onchange="return cambiaReporte(this.value, 'curso')" required>
                                  <option value="" ><b>Selecciona</b></option>
                                  <?php while($fetchCurso = mysqli_fetch_assoc($queryCurso1) ){ ?>
                                    <option value="<?php echo $fetchCurso['Curso_id'] ?>"><b><?php echo $fetchCurso['Descripcion'].' '.$fetchCurso['cicloCurso'] ?></b></option>
                                  <?php } ?>
                              </select>
                          </div>
                      </div>
                  </div>
                  
                  <div class="col-lg-3 col-md-6">   
                      <div class="form-group">
                          <h5>Reporte por Mes</h5>
                          <div class="controls">
                              <select id="mes_reporte" name="mes_reporte" class="form-control select2" onchange="return cambiaReporte(this.value, 'mes')" required>
                                  <option value="" ><b>Selecciona</b></option>
                                  
                                  <?php while($fetchMes = mysqli_fetch_assoc($queryMeses1) ){ ?>
                                    <option value="<?php echo $fetchMes['nombreMes'] ?>"><b><?php echo $fetchMes['nombreMes'] ?></b></option>
                                  <?php } ?>

                              </select>
                          </div>
                      </div>
                  </div>
                </div>
                  <img src="images/cargando.gif" alt="Cargando reporte" class="d-none" id="carg_reporte">
                  <input type="hidden" id="idAlum" value="<?php echo $id;?>">
                  <input type="hidden" id="anhoL" value="<?php echo $anhoL;?>">

                <div class="table-responsive" id="cuadro_tabla">
                    <table id="reporte_cuenta" class="table table-striped table-bordered dataTable no-footer"></table>
                </div>				
              </div>
          </div>
         </div> 	
          <?php include('includes/alertas.php')?>
      </div>
          
    </section>
      
  </div>
  	
<?php 
    include('formularios/alumno_cuota.php');
    include('includes/footer.php');
    ?>
