<?php

require_once '../app/model/db.class.php';

//------ Actualizar Grado y Curso con Matriculas  -----

     $obj = new database();
     $obj->conectar(); 
     $obj->consulta("set names 'utf8'");
 
      $alumnos = $obj->consulta("select * from boletin");
     
      while($row = $obj->fetch_assoc($alumnos)){
      
           $obj->consulta("DELETE FROM detalleboletin WHERE boletin='" .$row['numero']. "' and (alumno  not in (select codigo from matriculas where grado='" .$row['grado']."' and curso='" .$row['curso']."'))");

      }

/*
      $repetidos = $obj->consulta("select * from repetidos_2021");
     
      while($row = $obj->fetch_assoc($repetidos)){
      
           $obj->consulta("DELETE FROM detalleboletin 
                           WHERE secuencial='" .$row['secuencial']. "' 
                           and alumno='".$row['alumno']."'");

      }
*/      
      echo "PROCESO TERMINADO**";
?>