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

$sqlMatricula = "SELECT 
PS.Nombre AS nomAlumno,
PS.Apellido AS apeAlumno,
AL.FechaNacimiento AS nacimiento,
PS.NroDocumento AS cedula,
PS.Direccion AS direccion,
PS.comentarioDireccion AS obs_direccion,
AL.mailAlumno AS email,
CD.Descripcion AS ciudad,
PS.Barrio AS barrio,
PS.Sexo AS sexo,
AL.TipoSanguineo AS sangre,
AL.informe_adm_institucion_origen AS procedencia,
AL.comentarioEncargado AS comentarioAl,
AL.lineaBaja AS lineabaja,
AL.portada_alumno AS carnet,
AL.nombrePadre AS padre,
AL.mailPadre AS mailPadre,
AL.telefonoPadre AS telefPadre,
AL.nombreMadre AS madre,
AL.telefonoMadre AS telefMadre,
AL.mailMadre AS mailMadre,
AL.nombreEncargado AS nomEnc,
AL.telefonoEncargado,
AL.nombreReferencia AS nomRef,
AL.telefonoReferencia AS telRef,
AL.domicilioReferencia AS dirRef,
AL.fotocopia_cedula AS docCed,
AL.fotocopia_padres_encargado AS docCedPadEnc,
AL.certificado_nacimiento AS certNac,
AL.fotocopia_certi_nac AS fotCertNac,
AL.boletin_calificaciones_informes AS boletinCalif,
AL.libreta_vacunacion AS libVac,
AL.antecedente_academico_visado AS antAca,
AL.informe_adm_institucion_origen AS infInstOr,
AL.Observacion AS obsAl,
CR.Descripcion AS curso,
MT.Turno AS turno,
MT.AhoLectivo AS anho,
PGMT.monto_matricula,
PGMT.monto_abonado,
PGMT.forma_pago,
PGMT.cheque_banco,
PGMT.num_cheque,
PGMT.monto_cheque,
(SELECT PMT0.matricula_INT FROM pagos_matriculas PMT0 WHERE PMT0.idPago = '$idMatricula') AS IDMAT,
(SELECT SUM(monto_abonado) FROM pagos_matriculas PMT INNER JOIN matricula MT2 ON PMT.matricula_INT = MT2.Matricula_id WHERE PMT.matricula_INT = IDMAT) AS totalPG
FROM matricula MT 
INNER JOIN alumno AL ON MT.Persona_id = AL.Persona_id 
INNER JOIN persona PS ON MT.Persona_id = PS.Persona_id 
INNER JOIN ciudad CD ON PS.Ciudad_id = CD.Ciudad_id 
INNER JOIN curso CR ON MT.Curso_id = CR.Curso_id 
INNER JOIN pagos_matriculas PGMT ON MT.Matricula_id = PGMT.matricula_INT 
WHERE PGMT.idPago = '$idMatricula'";
$queryMatricula = mysqli_query($con, $sqlMatricula);
$fetchMatricula = mysqli_fetch_assoc($queryMatricula);
    
$cuota = $fetchMatricula['monto_matricula'];        
$totalPagadoAct = $fetchMatricula['totalPG'];   //MONTO ABONADO EN TOTAL POR LA CUOTA
$difPagar = $cuota - $totalPagadoAct;       //DIFERENCIA FALTANTE POR PAGAR POR LA CUOTA

?>
<body class="hold-transition skin-blue sidebar-mini">
      
    <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">Resumen de Datos Ingresados: <?php echo $fetchMatricula['nomAlumno'].' '.$fetchMatricula['apeAlumno']; ?></h4>			
              <ul class="box-controls pull-right">
              </ul>
            </div>
            <div class="box-body">
              <div class="row">
                <div class="col-3">
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Nombre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo $fetchMatricula['nomAlumno']; ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Apellido</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo $fetchMatricula['apeAlumno']; ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Fecha de Nacimiento</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo strftime('%d, %b %Y', strtotime($fetchMatricula['nacimiento'])); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número de Documento</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo number_format($fetchMatricula['cedula'], 0, ',', "."); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Dirección</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo $fetchMatricula['direccion']; ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Comentario Dirección</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['obs_direccion']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Email</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['email']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Ciudad</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo $fetchMatricula['ciudad']; ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Barrio</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo $fetchMatricula['barrio']; ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Sexo</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php if($fetchMatricula['sexo'] == 'M'){echo 'Masculino';}else{echo 'Femenino';} ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Grupo Sanguíneo</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['sangre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Institución de Procedencia</label>
                      <div class="col-sm-10">
                        <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['procedencia']); ?>" readonly>
                      </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Comentario sobre Alumno</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['comentarioAl']); ?>" readonly>
                    </div>
                  </div>

                </div>

                <div class="col-3">
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Foto Carnet</label>
                    <div class="col-sm-10">
                    <img width="80" src="images/alumnos/<?php if($fetchMatricula['carnet'] == ""){echo 'sombra.png';}else{echo $fetchMatricula[10];} ; ?>">
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Linea Baja</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['lineabaja']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Nombre del Padre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['padre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número del Padre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['telefPadre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Mail del Padre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['mailPadre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Nombre de la Madre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['madre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número de la Madre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['telefMadre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Mail de la Madre</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['mailMadre']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Nombre del Encargado</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['nomEnc']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número del Encargado</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['telefonoEncargado']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número del Encargado</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['nomEnc']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Nombre de Referencia</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['nomRef']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Número de Referencia</label>
                    <div class="col-sm-10">
                    <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['telRef']); ?>" readonly>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label for="example-text-input" class="col-sm-12 col-form-label">Dirección Referencia</label>
                    <div class="col-sm-10">
                      <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['dirRef']); ?>" readonly>
                    </div>
                  </div>
                </div>

                <div class="col-3">
                  <h5>Documentos presentados</h5>
                  <div class="form-group">
                      <div class="box-body">
                          <div class="demo-checkbox">

                              <?php if ($fetchMatricula['docCed'] == 'si'){?>
                                <input type="checkbox" id="fp_cedula_alum" checked disabled class="chk-col-green">
                                <label for="fp_cedula_alum">Fotocopia de Cédula de Identidad del alumno/a</label>
                              
                              <?php } if ($fetchMatricula['docCedPadEnc'] == 'si'){?>
                                <input type="checkbox" id="fp_cedula_pme" checked disabled class="chk-col-green">
                                <label for="fp_cedula_pme">Fotocopia de Cédula de Identidad (Padre, Madre, Encargados)</label>
                              
                              <?php } if ($fetchMatricula['certNac'] == 'si'){?>
                                <input type="checkbox" checked id="cert_nac" disabled class="chk-col-green">
                                <label for="cert_nac">Certificado de Nacimiento Original</label>
                              
                              <?php } if ($fetchMatricula['fotCertNac'] == 'si'){?>
                                <input type="checkbox" checked id="fp_cert_nac" disabled class="chk-col-green">
                                <label for="fp_cert_nac">Fotocopia de Certificado de Nacimiento</label>

                              <?php } if ($fetchMatricula['boletinCalif'] == 'si'){?>
                                <input type="checkbox" id="libreta_calif" checked disabled class="chk-col-green">
                                <label for="libreta_calif">Boletín de calificaciones y/o Informes</label>

                              <?php } if ($fetchMatricula['libVac'] == 'si'){?>
                                <input type="checkbox" id="libreta_vacunacion" checked disabled class="chk-col-green">
                                <label for="libreta_vacunacion">Libreta de Vacunación</label>

                              <?php } if ($fetchMatricula['antAca'] == 'si'){?>
                                <input type="checkbox" id="ant_academico" checked disabled class="chk-col-green">
                                <label for="ant_academico">Antecedente Académico visado por la supervisión de la zona</label>

                              <?php } if ($fetchMatricula['infInstOr'] == 'si'){?>
                                <input type="checkbox" id="inf_administrativo" checked disabled class="chk-col-green">
                                <label for="inf_administrativo">Informe administrativo de la Institución de origen</label>
                              <?php } ?>
                          </div>
                      </div>
                  </div>
                </div>

                <div class="col-3">
                                   
                            <div class="form-group">
                                <h5>Grado/Curso</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo $fetchMatricula['curso']; ?>" readonly>
                                </div>
                            </div>
                                   
                            <div class="form-group">
                                <h5>Turno</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo $fetchMatricula['turno']; ?>" readonly>
                                </div>
                            </div>
                 
                            <div class="form-group">
                                <h5>Observaciones de Alumno</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['obsAl']); ?>" readonly>
                                </div>
                            </div>
                                   
                            <div class="form-group">
                                <h5>Año Lectivo</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo $fetchMatricula['anho']; ?>" readonly>
                                </div>
                            </div>
               
                            <div class="form-group">
                                <h5>Monto Matricula</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="Gs. <?php echo number_format($fetchMatricula['monto_matricula'], 0, ',', "."); ?>" readonly>
                                </div>
                            </div>
                
                            <div class="form-group">
                                <h5>Monto abonado</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="Gs. <?php echo number_format($fetchMatricula['monto_abonado'], 0, ',', "."); ?>" readonly>
                                </div>
                            </div>
               
                            <div class="form-group">
                                <h5>Saldo Matricula</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="Gs. <?php echo number_format($difPagar, 0, ',', "."); ?>" readonly>
                                </div>
                            </div>
                                   
                            <div class="form-group">
                                <h5>Forma de Pago</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo $fetchMatricula['forma_pago']; ?>" readonly>
                                </div>
                            </div>
                            
                            <?php if ($fetchMatricula['cheque_banco'] != ''){?>
                            <div class="form-group">
                                <h5>Nombre de Banco</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['cheque_banco']); ?>" readonly>
                                </div>
                            </div>
                            <?php } if ($fetchMatricula['num_cheque'] != ''){?>
                            <div class="form-group">
                                <h5>Número de Cheque/Transferencia</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="<?php echo checkDatos($fetchMatricula['num_cheque']); ?>" readonly>
                                </div>
                            </div>
                            <?php } if (($fetchMatricula['monto_cheque'] > 0)){?>
                            <div class="form-group">
                                <h5>Monto Movimiento</h5>
                                <div class="controls">
                                  <input class="form-control" type="text" value="Gs. <?php echo number_format($fetchMatricula['monto_cheque'], 0, ',', "."); ?>" readonly>
                                </div>
                            </div>
                            <?php } ?>
                    </div>
              </div>
            </div>
          </div>	
      </div>
    </section>
      
  </div>
                
                <div class="modal-footer">
                    <div class="pull-right">
                        <button type="button" onclick="imprimir()" class="btn btn-info">IMPRIMIR</button>
                        <button type="button" onclick="volver()" class="btn btn-default" >CERRAR</button> 
                    </div>
                </div>
  	
<script>
  function imprimir(){
    window.print();
  }

  function volver(){
    window.close();
  }
</script>
