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

echo "=== Verificar TODAS las tablas relacionadas con planilla ===\n\n";

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

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

echo "\n3. 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";
}
?>