|
|
@@ -192,8 +192,8 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
|
|
|
Log::info('Job createExcelFile: Setting basic headers');
|
|
|
$activeWorksheet->setCellValue('A1', "Data");
|
|
|
- $activeWorksheet->setCellValue('B1', "Causale");
|
|
|
- $activeWorksheet->setCellValue('C1', "Dettaglio Causale");
|
|
|
+ $activeWorksheet->setCellValue('B1', "Tipologia");
|
|
|
+ $activeWorksheet->setCellValue('C1', "Causale");
|
|
|
$activeWorksheet->setCellValue('D1', "Nominativo");
|
|
|
$activeWorksheet->setCellValue('E1', "Stato");
|
|
|
|
|
|
@@ -694,18 +694,15 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
$activeWorksheet->fromArray([$totalsData], null, 'A' . $totalRow, true);
|
|
|
}
|
|
|
|
|
|
- // Apply styles more efficiently
|
|
|
private function applyStylesEfficiently($activeWorksheet, $letters)
|
|
|
{
|
|
|
$maxCol = min(count($letters) - 1, count($this->payments) * 2 + 4);
|
|
|
$lastCol = $letters[$maxCol];
|
|
|
- $totalRows = count($this->exportData) + 4; // +4 for headers, spacing, and totals
|
|
|
+ $totalRows = count($this->exportData) + 4;
|
|
|
|
|
|
- // Apply header styles
|
|
|
$headerRange = 'A1:' . $lastCol . '2';
|
|
|
$activeWorksheet->getStyle($headerRange)->getFont()->setBold(true);
|
|
|
|
|
|
- // Apply header background
|
|
|
$activeWorksheet->getStyle('A1:' . $lastCol . '1')
|
|
|
->getFill()
|
|
|
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
|
|
|
@@ -714,7 +711,6 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
$activeWorksheet->getStyle('A1:' . $lastCol . '1')
|
|
|
->getFont()->getColor()->setARGB('FFFFFFFF');
|
|
|
|
|
|
- // Apply totals row styles
|
|
|
$totalsRange = 'A' . $totalRows . ':' . $lastCol . $totalRows;
|
|
|
$activeWorksheet->getStyle($totalsRange)->getFont()->setBold(true);
|
|
|
$activeWorksheet->getStyle($totalsRange)
|
|
|
@@ -723,7 +719,6 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
->getStartColor()->setARGB('FFF0F0F0');
|
|
|
}
|
|
|
|
|
|
- // Set column dimensions efficiently
|
|
|
private function setColumnDimensions($activeWorksheet, $letters)
|
|
|
{
|
|
|
$dimensions = [
|
|
|
@@ -738,8 +733,7 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
$activeWorksheet->getColumnDimension($col)->setWidth($width);
|
|
|
}
|
|
|
|
|
|
- // Set payment method column widths
|
|
|
- for ($i = 5; $i < count($letters) && $i < 50; $i++) { // Limit to prevent excessive loops
|
|
|
+ for ($i = 5; $i < count($letters) && $i < 50; $i++) {
|
|
|
$activeWorksheet->getColumnDimension($letters[$i])->setWidth(15);
|
|
|
}
|
|
|
}
|
|
|
@@ -781,15 +775,12 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
]);
|
|
|
|
|
|
try {
|
|
|
- // Execute every 5 seconds to monitor progress
|
|
|
$lastCheck = $startTime;
|
|
|
$result = null;
|
|
|
|
|
|
- // For non-blocking operations, we can't easily interrupt,
|
|
|
- // but we can log progress
|
|
|
register_tick_function(function () use ($startTime, $maxExecutionTime, $description, &$lastCheck) {
|
|
|
$currentTime = microtime(true);
|
|
|
- if ($currentTime - $lastCheck >= 5) { // Log every 5 seconds
|
|
|
+ if ($currentTime - $lastCheck >= 5) {
|
|
|
$elapsed = $currentTime - $startTime;
|
|
|
$remaining = $maxExecutionTime > 0 ? $maxExecutionTime - $elapsed : 'unlimited';
|
|
|
|
|
|
@@ -842,7 +833,7 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
|
|
|
$maxExecutionTime = ini_get('max_execution_time');
|
|
|
if ($maxExecutionTime <= 0) {
|
|
|
- return false; // No limit set
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
$elapsed = microtime(true) - $startTime;
|
|
|
@@ -868,8 +859,6 @@ class ExportPrimaNota implements ShouldQueue
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // SOLUTION 8: Log configuration and environment info at start
|
|
|
-
|
|
|
public function logEnvironmentInfo()
|
|
|
{
|
|
|
Log::info('=== EXPORT ENVIRONMENT INFO ===', [
|