<?php require_once __DIR__ . '/../includes/bootstrap.php'; require_login();
$id = (int)($_GET['id'] ?? 0);
db()->prepare("DELETE FROM payroll_items WHERE period_id=?")->execute([$id]);
db()->prepare("DELETE FROM payroll_periods WHERE id=?")->execute([$id]);
audit_log('delete', 'payroll_periods', $id, 'Eliminación período nómina');
set_flash('success','Período eliminado.');
redirect('payroll/index.php');
