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

echo "=== Resumen de datos por periodo ===\n\n";

echo "Planillas creadas:\n";
$sql = "SELECT id, anno, periodo FROM planilla ORDER BY id";
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res)){
    echo "  Planilla ID " . $row['id'] . ": Año " . $row['anno'] . ", Periodo " . $row['periodo'] . "\n";
}

echo "\nDatos en planilla_detalle:\n";
$sql2 = "SELECT planilla, COUNT(*) as total FROM planilla_detalle GROUP BY planilla ORDER BY planilla";
$res2 = mysql_query($sql2);
while($row2 = mysql_fetch_assoc($res2)){
    echo "  Planilla ID " . $row2['planilla'] . ": " . $row2['total'] . " registros\n";
}

echo "\nDatos en planilla_consulta:\n";
$sql3 = "SELECT periodo, COUNT(*) as total FROM planilla_consulta GROUP BY periodo ORDER BY periodo";
$res3 = mysql_query($sql3);
while($row3 = mysql_fetch_assoc($res3)){
    echo "  Periodo " . $row3['periodo'] . ": " . $row3['total'] . " registros\n";
}

echo "\n=== CONCLUSION ===\n";
echo "Para generar PDF necesitas datos en AMBAS tablas:\n";
echo "1. planilla_detalle (para las materias del pensum)\n";
echo "2. planilla_consulta (para las notas)\n";
echo "\nSolo existe data para Periodo 1 (planilla ID 9).\n";
echo "Los periodos 2, 3, 4 no tienen datos cargados aun.\n";
?>