format('Y-m-d')); } if (is_numeric($value) && (float)$value > 0) { // Serial date Excel (1900 system) $unix = ((float)$value - 25569) * 86400; return (new DateTimeImmutable('@' . (string)(int)$unix))->setTimezone(new DateTimeZone('America/Bogota'))->setTime(0, 0); } if (is_string($value) && trim($value) !== '') { $value = trim($value); foreach (['Y-m-d', 'd/m/Y', 'd-m-Y', 'Y/m/d'] as $format) { $date = DateTimeImmutable::createFromFormat('!' . $format, $value); if ($date instanceof DateTimeImmutable) return $date; } try { return (new DateTimeImmutable($value))->setTime(0, 0); } catch (Throwable $e) {} } return null; } function dateLabel(?DateTimeImmutable $date): string { return $date ? $date->format('d/m/Y') : '—'; } function dateIso(?DateTimeImmutable $date): string { return $date ? $date->format('Y-m-d') : ''; } /** * Lector XLSX sin Composer ni PhpSpreadsheet. * Lee directamente la estructura ZIP/XML del libro usando funciones PHP estándar * (file_get_contents, gzinflate, preg_match), incluida en ZIP la hoja y sharedStrings. */ function xlsxReadEntry(string $xlsxBytes, string $entryName): ?string { $eocd = strrpos($xlsxBytes, "PK\x05\x06"); if ($eocd === false || strlen($xlsxBytes) < $eocd + 22) return null; $end = unpack('vdisk/vcdisk/vdiskEntries/ventries/VcdSize/VcdOffset/vcommentLen', substr($xlsxBytes, $eocd + 4, 18)); $offset = (int)$end['cdOffset']; $entries = (int)$end['entries']; for ($i = 0; $i < $entries; $i++) { if (substr($xlsxBytes, $offset, 4) !== "PK\x01\x02") return null; $meta = unpack('Vsig/vmade/vneed/vflag/vmethod/vmtime/vmdate/Vcrc/Vcsize/Vusize/vnameLen/vextraLen/vcommentLen/vdisk/vint/Vext/VlocalOffset', substr($xlsxBytes, $offset, 46)); $nameLen = (int)$meta['nameLen']; $extraLen = (int)$meta['extraLen']; $commentLen = (int)$meta['commentLen']; $name = substr($xlsxBytes, $offset + 46, $nameLen); if ($name === $entryName) { $localOffset = (int)$meta['localOffset']; if (substr($xlsxBytes, $localOffset, 4) !== "PK\x03\x04") return null; $local = unpack('vneed/vflag/vmethod/vmtime/vmdate/Vcrc/Vcsize/Vusize/vnameLen/vextraLen', substr($xlsxBytes, $localOffset + 4, 26)); $dataOffset = $localOffset + 30 + (int)$local['nameLen'] + (int)$local['extraLen']; $compressed = substr($xlsxBytes, $dataOffset, (int)$meta['csize']); if ((int)$meta['method'] === 0) return $compressed; if ((int)$meta['method'] === 8) { $result = @gzinflate($compressed); return $result === false ? null : $result; } return null; } $offset += 46 + $nameLen + $extraLen + $commentLen; } return null; } function xmlDecode(string $value): string { return html_entity_decode($value, ENT_QUOTES | ENT_XML1, 'UTF-8'); } function xlsxSharedStrings(string $xml): array { $strings = []; if ($xml === '') return $strings; preg_match_all('/]*)?>(.*?)<\\/si>/s', $xml, $items); foreach ($items[1] as $item) { // Supports regular and rich-text shared strings by concatenating all runs. preg_match_all('/]*)?>(.*?)<\\/t>/s', $item, $runs); $text = ''; foreach ($runs[1] as $run) $text .= xmlDecode(strip_tags($run)); $strings[] = $text; } return $strings; } function xlsxCellMap(string $sheetXml, array $sharedStrings): array { $map = []; preg_match_all('/]*)?>(.*?)<\\/row>/s', $sheetXml, $rowMatches); foreach ($rowMatches[1] as $rowXml) { preg_match_all('/]*?)(?:\\/>|>(.*?)<\\/c>)/s', $rowXml, $cellMatches, PREG_SET_ORDER); foreach ($cellMatches as $cell) { $attrs = $cell[1]; $inner = $cell[2] ?? ''; if (!preg_match('/\\br="([A-Z]+\\d+)"/', $attrs, $refMatch)) continue; $ref = $refMatch[1]; $type = ''; if (preg_match('/\\bt="([^"]+)"/', $attrs, $typeMatch)) $type = $typeMatch[1]; $value = ''; if ($type === 'inlineStr') { preg_match_all('/]*)?>(.*?)<\\/t>/s', $inner, $runs); foreach ($runs[1] as $run) $value .= xmlDecode(strip_tags($run)); } elseif (preg_match('/]*)?>(.*?)<\\/v>/s', $inner, $vMatch)) { $rawValue = xmlDecode($vMatch[1]); if ($type === 's') { $index = (int)$rawValue; $value = $sharedStrings[$index] ?? ''; } else { $value = $rawValue; } } $map[$ref] = $value; } } return $map; } function excelColumnNumber(string $letters): int { $n = 0; for ($i = 0; $i < strlen($letters); $i++) $n = $n * 26 + (ord($letters[$i]) - 64); return $n; } function lowerUtf8(string $value): string { return function_exists('mb_strtolower') ? mb_strtolower($value, 'UTF-8') : strtolower($value); } function normalizeHeader(string $value): string { $value = lowerUtf8(trim($value)); $value = strtr($value, ['á'=>'a','é'=>'e','í'=>'i','ó'=>'o','ú'=>'u','ü'=>'u','ñ'=>'n']); return preg_replace('/[^a-z0-9]+/', '', $value) ?? ''; } if (!file_exists($excelFile)) { $error = 'No se encontró el archivo Excel. Debe estar en la misma carpeta de index.php con el nombre: ' . basename($excelFile); } else { try { $xlsxBytes = file_get_contents($excelFile); if ($xlsxBytes === false) throw new RuntimeException('No se pudo abrir el archivo Excel para lectura.'); $sharedXml = xlsxReadEntry($xlsxBytes, 'xl/sharedStrings.xml') ?? ''; $sheetXml = xlsxReadEntry($xlsxBytes, 'xl/worksheets/sheet1.xml'); if ($sheetXml === null) throw new RuntimeException('No fue posible leer la hoja principal del XLSX. Verifique que sea un archivo .xlsx válido.'); $sharedStrings = xlsxSharedStrings($sharedXml); $cells = xlsxCellMap($sheetXml, $sharedStrings); // Identificar columnas por el encabezado para soportar el nuevo campo único "Responsables". // Las posiciones de respaldo corresponden al Excel actualizado (sin Líder responsable / Equipo participante). $headerLookup = []; foreach ($cells as $cellRef => $value) { if (preg_match('/^([A-Z]+)1$/', $cellRef, $m)) { $headerLookup[normalizeHeader((string)$value)] = excelColumnNumber($m[1]); } } $columnAliases = [ 'execution' => ['ejecucion', 'ejecuciones'], 'evidenceId' => ['idevidencia', 'idevidencias', 'id'], 'detail' => ['detalle', 'actividad', 'descripcion'], 'evidence' => ['evidenciarequerida', 'evidenciaaentregar', 'evidencia'], 'requirement' => ['req', 'requisito'], 'subrequirement' => ['subrequisito', 'subrequisitodelanorma'], 'responsible' => ['responsables', 'responsable'], 'periodicity' => ['periodicidad'], 'cycle' => ['ciclo'], 'periodFrom' => ['periododesde', 'periodoinicio', 'fechainicioperiodo'], 'periodTo' => ['periodohasta', 'periodofin', 'fechafinperiodo'], 'executionStart' => ['inicioejecucion', 'fechainicioejecucion'], 'executionEnd' => ['finejecucion', 'fechafinejecucion'], 'due' => ['fechacumplimientoplaneado', 'fechacumplimiento', 'fechalimite', 'vencimientointerno'], ]; $fallbackColumns = [ 'execution'=>1, 'evidenceId'=>2, 'detail'=>3, 'evidence'=>4, 'requirement'=>5, 'subrequirement'=>6, 'responsible'=>7, 'periodicity'=>8, 'cycle'=>9, 'periodFrom'=>10, 'periodTo'=>11, 'executionStart'=>12, 'executionEnd'=>13, 'due'=>14, ]; $columnMap = $fallbackColumns; foreach ($columnAliases as $field => $aliases) { foreach ($aliases as $alias) { if (isset($headerLookup[$alias])) { $columnMap[$field] = $headerLookup[$alias]; break; } } } // Leer filas de datos usando el mapa de encabezados, no posiciones fijas. $highestRow = 1; foreach (array_keys($cells) as $cellRef) { if (preg_match('/\\d+$/', $cellRef, $rowNumber)) $highestRow = max($highestRow, (int)$rowNumber[0]); } for ($r = 2; $r <= $highestRow; $r++) { $raw = []; foreach ($columnMap as $field => $columnNumber) { $letters = ''; $n = $columnNumber; while ($n > 0) { $rem = ($n - 1) % 26; $letters = chr(65 + $rem) . $letters; $n = intdiv($n - 1, 26); } $raw[$field] = $cells[$letters . $r] ?? ''; } if (trim((string)$raw['execution']) === '' && trim((string)$raw['evidenceId']) === '') continue; $startPeriod = excelDate($raw['periodFrom']); $endPeriod = excelDate($raw['periodTo']); $startExec = excelDate($raw['executionStart']); $endExec = excelDate($raw['executionEnd']); $dueDate = excelDate($raw['due']); // El estado de entrega se calcula exclusivamente con los estados // individuales incluidos junto a cada responsable. No se lee la columna O. $deliveryState = 'Pendiente'; // Cada responsable puede tener un estado independiente dentro de la celda: // David Ceron "Pendiente",Jesus Moscoso "Finalizado". $responsibleRaw = trim((string)$raw['responsible']); $responsibleAssignments = []; if ($responsibleRaw !== '') { preg_match_all('/([^,]+?)\s*["“]([^"”]+)["”]\s*(?=,|$)/u', $responsibleRaw, $assignmentMatches, PREG_SET_ORDER); foreach ($assignmentMatches as $assignment) { $personName = trim($assignment[1]); $personStateRaw = lowerUtf8(trim($assignment[2])); $personState = [ 'pendiente' => 'Pendiente', 'en curso' => 'En Curso', 'finalizado' => 'Finalizado', ][$personStateRaw] ?? 'Pendiente'; if ($personName !== '') $responsibleAssignments[] = ['name' => $personName, 'state' => $personState]; } // Compatibilidad con filas que aún tengan un solo responsable sin estado entre comillas. if (!$responsibleAssignments) { foreach (preg_split('/\s*[,;]\s*/u', $responsibleRaw) as $personName) { $personName = trim($personName); if ($personName !== '') $responsibleAssignments[] = ['name' => $personName, 'state' => 'Pendiente']; } } // Estado general de la ejecución: solo finaliza cuando todos sus responsables finalizaron. if ($responsibleAssignments) { $assignmentStates = array_column($responsibleAssignments, 'state'); if (count(array_filter($assignmentStates, fn($state) => $state === 'Finalizado')) === count($assignmentStates)) { $deliveryState = 'Finalizado'; } elseif (in_array('En Curso', $assignmentStates, true)) { $deliveryState = 'En Curso'; } else { $deliveryState = 'Pendiente'; } } } $status = 'Sin fecha'; $statusClass = 'neutral'; $daysToDue = null; if ($dueDate) $daysToDue = (int)$today->diff($dueDate)->format('%r%a'); if ($deliveryState === 'Finalizado') { $status = 'Finalizado'; $statusClass = 'success'; } elseif ($dueDate) { if ($daysToDue < 0) { $status = 'Vencido'; $statusClass = 'danger'; } elseif ($daysToDue <= 3) { $status = 'Vence en 3 días'; $statusClass = 'danger'; } elseif ($daysToDue <= 7) { $status = 'Vence en 7 días'; $statusClass = 'warning'; } elseif ($daysToDue <= 15) { $status = 'Próximo (15 días)'; $statusClass = 'warning'; } else { $status = 'Programado'; $statusClass = 'success'; } } $rows[] = [ 'execution' => trim((string)$raw['execution']), 'evidenceId' => trim((string)$raw['evidenceId']), 'detail' => trim((string)$raw['detail']), 'evidence' => trim((string)$raw['evidence']), 'requirement' => trim((string)$raw['requirement']), 'subrequirement' => trim((string)$raw['subrequirement']), 'responsible' => $responsibleRaw, 'responsibleAssignments' => $responsibleAssignments, 'periodicity' => strtoupper(trim((string)$raw['periodicity'])), 'cycle' => trim((string)$raw['cycle']), 'periodFrom' => dateLabel($startPeriod), 'periodTo' => dateLabel($endPeriod), 'executionStart' => dateLabel($startExec), 'executionEnd' => dateLabel($endExec), 'due' => dateLabel($dueDate), 'dueIso' => dateIso($dueDate), 'daysToDue' => $daysToDue, 'status' => $status, 'statusClass' => $statusClass, 'deliveryState' => $deliveryState, 'overdue' => ($dueDate !== null && $dueDate < $today && $deliveryState !== 'Finalizado'), ]; } unset($xlsxBytes, $sharedXml, $sheetXml, $sharedStrings, $cells); } catch (Throwable $e) { $error = 'No fue posible leer el Excel: ' . $e->getMessage(); } } $total = count($rows); $overdue = 0; $next15 = 0; $dueThisMonth = 0; $responsibles = []; $requirements = []; $periodicities = []; $cycles = []; foreach ($rows as $item) { if ($item['overdue']) $overdue++; if ($item['daysToDue'] !== null && $item['daysToDue'] >= 0 && $item['daysToDue'] <= 15 && $item['deliveryState'] !== 'Finalizado') $next15++; if ($item['dueIso'] !== '' && substr($item['dueIso'], 0, 7) === $today->format('Y-m')) $dueThisMonth++; foreach (($item['responsibleAssignments'] ?? []) as $assignment) { if ($assignment['name'] !== '') $responsibles[$assignment['name']] = true; } if ($item['requirement'] !== '') $requirements[$item['requirement']] = true; if ($item['periodicity'] !== '') $periodicities[$item['periodicity']] = true; if ($item['cycle'] !== '') $cycles[$item['cycle']] = true; } ksort($responsibles, SORT_NATURAL | SORT_FLAG_CASE); ksort($requirements, SORT_NATURAL | SORT_FLAG_CASE); ksort($periodicities, SORT_NATURAL | SORT_FLAG_CASE); ksort($cycles, SORT_NATURAL | SORT_FLAG_CASE); // Datos para JS con codificación segura. $jsonRows = json_encode($rows, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); if ($jsonRows === false) $jsonRows = '[]'; ?> Dashboard PCI DSS | INCOCRÉDITO
PCI

Seguimiento & Control PCI DSS

INCOCRÉDITO · Cronograma 2026–2027 · Evidencias, recurrencias y vencimientos
No se pudo cargar el dashboard.


Verificación: coloque el archivo Excel junto a index.php y confirme que PHP tenga habilitada la extensión zlib y permisos de lectura sobre el archivo.

Resumen ejecutivo

Indicadores calculados a partir de las fechas programadas del Excel fuente.

Fecha de corte: format('d/m/Y')) ?>
Ejecuciones programadas▤
Total de filas de ejecución · Clic para ver todas
Vencidas por fecha!
Fecha planeada vencida y control no finalizado
Vencen próximos 15 días◷
Actividades con vencimiento entre hoy y 15 días · Clic para filtrar
Vencen este mes▦
Según la fecha de cumplimiento planeado · Clic para filtrar

Distribución de ejecuciones por estado de fecha

Automático
Programado Próximo vencimiento Vencido / crítico Finalizado Sin fecha

Próximos vencimientos

Top 10

Avance de cumplimiento por Q

Porcentaje de ejecuciones finalizadas frente al total de cada trimestre.
Q1 – Q4
Calculando avance trimestral…
Las actividades de recurrencia anual (Ciclo 1) se administran por separado y no hacen parte de este indicador.

¿Cómo se calcula el estado de entrega?

El estado general de cada ejecución se determina a partir del estado individual de sus responsables:

Finalizado

Todos están Finalizados.

En Curso

Al menos uno está En Curso, pero no todos están Finalizados.

Pendiente

Ninguno está En Curso y no todos están Finalizados.

Matriz de control de evidencias

Use los filtros para consultar las ejecuciones por requisito, responsable, periodicidad, ciclo y estado de entrega o vencimiento.
Fuente: Excel
Cargando registros…
Ver ficha ID Responsables Periodicidad Ciclo Inicio ejecución Fin ejecución Vencimiento interno ESTADO ENTREGA

Seguimiento de cumplimiento por responsable

Consolidado de controles asignados, estado de entrega y vencimientos. Se actualiza con los filtros aplicados en la matriz.
Por responsable
ResponsableTotal controlesPendientesEn cursoFinalizadosVencidosCumplimiento

Distribución porcentual del estado de cumplimiento

El gráfico se actualiza automáticamente con los registros visibles según los filtros de la matriz.
Dinámico
Creditos por Juan C Parra  |  Seguridad Informática