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

echo "=== Planillas con datos en planilla_detalle ===\n";
$sql = "SELECT DISTINCT pd.planilla, p.anno, p.periodo, COUNT(*) as total
FROM planilla_detalle pd 
JOIN planilla p ON pd.planilla = p.id
GROUP BY pd.planilla
ORDER BY pd.planilla";
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res)){
    echo "Planilla ID: " . $row['planilla'] . ", Año: " . $row['anno'] . ", Periodo: " . $row['periodo'] . ", Registros: " . $row['total'] . "\n";
}
?>