fix: actualizar tipos de acción a 'sustitución' en InscriptionController

This commit is contained in:
Juan Felipe Zapata Moreno 2026-01-20 10:41:23 -06:00
parent 2411ff1eab
commit ea4e3fc607
2 changed files with 48 additions and 8 deletions

View File

@ -182,7 +182,20 @@ public function constanciasSustituidas(Request $request)
$sheet->getStyle('B9')->getFont()->setBold(false)->setSize(14);
Carbon::setLocale('es');
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
// Formato completo para manejar diferentes meses/años
if ($fechaInicio->format('m/Y') === $fechaFin->format('m/Y')) {
// Mismo mes y año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} elseif ($fechaInicio->format('Y') === $fechaFin->format('Y')) {
// Diferente mes, mismo año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} else {
// Diferente año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' ' . $fechaInicio->format('Y') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
}
// Fechas
$sheet->mergeCells('C9:F9');
@ -197,7 +210,7 @@ public function constanciasSustituidas(Request $request)
// Año
$sheet->mergeCells('H9:I9');
$sheet->setCellValue('H9', $fechaFin->format('Y'));
$sheet->setCellValue('H9', $anioTexto);
$sheet->getStyle('H9:I9')->applyFromArray($styleBox);
$sheet->getStyle('H9')->getFont()->setSize(14);
@ -448,7 +461,20 @@ public function constanciasCanceladas(Request $request)
$sheet->getStyle('A9')->getFont()->setBold(false)->setSize(14);
Carbon::setLocale('es');
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
// Formato completo para manejar diferentes meses/años
if ($fechaInicio->format('m/Y') === $fechaFin->format('m/Y')) {
// Mismo mes y año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} elseif ($fechaInicio->format('Y') === $fechaFin->format('Y')) {
// Diferente mes, mismo año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} else {
// Diferente año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' ' . $fechaInicio->format('Y') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
}
// Fechas (Movemos a D-G)
$sheet->mergeCells('D9:G9');
@ -463,7 +489,7 @@ public function constanciasCanceladas(Request $request)
// Año (Movemos a I-J)
$sheet->mergeCells('I9:J9');
$sheet->setCellValue('I9', $fechaFin->format('Y'));
$sheet->setCellValue('I9', $anioTexto);
$sheet->getStyle('I9:J9')->applyFromArray($styleBox);
$sheet->getStyle('I9')->getFont()->setSize(14);
@ -750,7 +776,20 @@ public function excelGeneral(Request $request)
$sheet->getStyle('A9')->applyFromArray($styleLabel);
Carbon::setLocale('es');
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
// Formato completo para manejar diferentes meses/años
if ($fechaInicio->format('m/Y') === $fechaFin->format('m/Y')) {
// Mismo mes y año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} elseif ($fechaInicio->format('Y') === $fechaFin->format('Y')) {
// Diferente mes, mismo año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
} else {
// Diferente año
$periodoTexto = 'del ' . $fechaInicio->format('d') . ' de ' . $fechaInicio->translatedFormat('F') . ' ' . $fechaInicio->format('Y') . ' al ' . $fechaFin->format('d') . ' de ' . $fechaFin->translatedFormat('F');
$anioTexto = $fechaFin->format('Y');
}
// Fechas (D-G)
$sheet->mergeCells('D9:G9');
@ -765,7 +804,7 @@ public function excelGeneral(Request $request)
// Año (I-J)
$sheet->mergeCells('I9:J9');
$sheet->setCellValue('I9', $fechaFin->format('Y'));
$sheet->setCellValue('I9', $anioTexto);
$sheet->getStyle('I9:J9')->applyFromArray($styleBox);
$sheet->getStyle('I9')->getFont()->setSize(14);
@ -1169,6 +1208,7 @@ public function exportSearchRecords(Request $request)
$sheet->getStyle("A{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("D{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("I{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("J{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("K{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("L{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle("M{$row}")->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);

View File

@ -167,7 +167,7 @@ public function vehicleInscription(VehicleStoreRequest $request)
VehicleTagLog::create([
'vehicle_id' => $vehicle->id,
'tag_id' => $tag->id,
'action_type' => 'inscripcion',
'action_type' => 'sustitucion',
'performed_by' => Auth::id(),
]);
@ -445,7 +445,7 @@ public function searchRecord(Request $request)
'created_at' => $record->created_at,
// TIPO DE TRÁMITE
'action_type' => $latestLog?->action_type ?? 'inscripcion',
'action_type' => $latestLog?->action_type ?? 'sustitución',
'action_date' => $latestLog?->created_at ?? $record->created_at,
// HISTORIAL DE TAGS