<?php
error_reporting(E_ERROR | E_PARSE);
include '../conector.php';

echo "=== Verificar planilla_consulta por periodo ===\n";
echo "(La tabla planilla tiene: id=9(periodo1), 10(periodo2), 11(periodo3), 15(periodo4)\n\n";

// Test with different "periodo" values as used in queries
echo "Verificar si hay datos en planilla_consulta para los periodos 10, 11, 15:\n";

$sql = "SELECT COUNT(*) as total FROM planilla_consulta WHERE periodo = 10";
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
echo "Periodo 10: " . $row['total'] . " registros\n";

$sql2 = "SELECT COUNT(*) as total FROM planilla_consulta WHERE periodo = 11";
$res2 = mysql_query($sql2);
$row2 = mysql_fetch_assoc($res2);
echo "Periodo 11: " . $row2['total'] . " registros\n";

$sql3 = "SELECT COUNT(*) as total FROM planilla_consulta WHERE periodo = 15";
$res3 = mysql_query($sql3);
$row3 = mysql_fetch_assoc($res3);
echo "Periodo 15: " . $row3['total'] . " registros\n";

$sql4 = "SELECT DISTINCT periodo FROM planilla_consulta";
$res4 = mysql_query($sql4);
echo "\nPeriodos con datos en planilla_consulta: ";
while($row4 = mysql_fetch_assoc($res4)){
    echo $row4['periodo'] . " ";
}
echo "\n";

echo "\n=== Verificar pensum para curso 12 (Sexto A) ===\n";
$sql5 = "SELECT p.subject_id, p.nombre, a.nombre as nombre_asignatura
FROM pensum p 
JOIN asignatura a ON p.asignatura_id = a.subject_id
WHERE p.class_id = 12 AND p.estado = 'A'";
$res5 = mysql_query($sql5);
echo "Materias en pensum para curso 12:\n";
while($row5 = mysql_fetch_assoc($res5)){
    echo "   ID: " . $row5['subject_id'] . ", Nombre: " . $row5['nombre'] . " - " . $row5['nombre_asignatura'] . "\n";
}
?>