|
|
@@ -288,6 +288,7 @@ class Istat extends Component
|
|
|
}
|
|
|
} else $loc = ' ';
|
|
|
|
|
|
+
|
|
|
$tipo_strada = ' ';
|
|
|
$types_saved = \App\Models\ReportTipoStrada::where('report_id', $report->id)
|
|
|
->pluck('tipo_strada_id')
|
|
|
@@ -412,16 +413,16 @@ class Istat extends Component
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- $item_data .= $loc;
|
|
|
+ $item_data .= str_pad($loc, 1, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= str_pad($item->nomenclatura_strada_numero, 3, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= str_repeat(' ', 3);
|
|
|
$item_data .= str_repeat(' ', 2);
|
|
|
- $item_data .= $tipo_strada;
|
|
|
- $item_data .= $pav;
|
|
|
- $item_data .= $int;
|
|
|
- $item_data .= $fon;
|
|
|
- $item_data .= $seg;
|
|
|
- $item_data .= $met;
|
|
|
+ $item_data .= str_pad($tipo_strada, 1, ' ', STR_PAD_RIGHT);
|
|
|
+ $item_data .= str_pad($pav, 1, ' ', STR_PAD_RIGHT);
|
|
|
+ $item_data .= str_pad($int, 2, ' ', STR_PAD_RIGHT);
|
|
|
+ $item_data .= str_pad($fon, 1, ' ', STR_PAD_RIGHT);
|
|
|
+ $item_data .= str_pad($seg, 1, ' ', STR_PAD_RIGHT);
|
|
|
+ $item_data .= str_pad($met, 1, ' ', STR_PAD_RIGHT);
|
|
|
$sectionLength = strlen($item_data) - $sectionStart;
|
|
|
$sectionCounts['Section 11-20'] = $sectionLength;
|
|
|
Log::info('Item Data 11-20 Length: ' . $sectionLength);
|
|
|
@@ -789,20 +790,24 @@ class Istat extends Component
|
|
|
}
|
|
|
|
|
|
|
|
|
+ $v_data['tipo'] = str_pad($v_data['tipo'], 6, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= $v_data['tipo'];
|
|
|
$item_data .= str_repeat(' ', 24);
|
|
|
+ $v_data['circostanze'] = str_pad($v_data['circostanze'], 12, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= $v_data['circostanze'];
|
|
|
+ $v_data['veicolo'] = str_pad($v_data['veicolo'], 54, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= $v_data['veicolo'];
|
|
|
+ $v_data['conducente_passeggeri'] = str_pad($v_data['conducente_passeggeri'], 105, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= $v_data['conducente_passeggeri'];
|
|
|
+ $p_data = str_pad($p_data, 24, ' ', STR_PAD_RIGHT);
|
|
|
$item_data .= $p_data;
|
|
|
$item_data .= str_repeat(' ', 10);
|
|
|
$item_data .= str_pad(count($deceduti_24h), 2, '0', STR_PAD_LEFT);
|
|
|
$item_data .= str_pad(count($deceduti_30gg), 2, '0', STR_PAD_LEFT);
|
|
|
$item_data .= str_pad(count($feriti), 2, '0', STR_PAD_LEFT);
|
|
|
$item_data .= str_repeat(' ', 9);
|
|
|
- $totalLength = strlen($item_data);
|
|
|
- $charCounts[] = $totalLength;
|
|
|
- Log::info('Total item data length: ' . $totalLength);
|
|
|
+ $sectionLength = strlen($item_data) - $sectionStart;
|
|
|
+ $sectionCounts['Section 21-30'] = $sectionLength;
|
|
|
} catch (\Exception $e) {
|
|
|
Log::error('Error in section 21-30 for item ' . $item->id . ': ' . $e->getMessage());
|
|
|
}
|
|
|
@@ -886,7 +891,6 @@ class Istat extends Component
|
|
|
$item_data .= str_repeat(' ', 100);
|
|
|
|
|
|
$town = \App\Models\LocationTown::find( $report->localita_uno);
|
|
|
- Log::info('Town: ' . json_encode($town));
|
|
|
$town_title = $town ? $town['istat_code'] : '';
|
|
|
|
|
|
$item_data .= str_pad(substr($town_title, 0, 40), 40, ' ');
|
|
|
@@ -894,6 +898,9 @@ class Istat extends Component
|
|
|
$item_data .= str_repeat(' ', 10);
|
|
|
|
|
|
$item_data .= $v_data['cittadinanza_conducente'];
|
|
|
+ $sectionLength = strlen($item_data) - $sectionStart;
|
|
|
+ $sectionCounts['Section 31-40'] = $sectionLength;
|
|
|
+ Log::info('Item Data 31-40 Length: ' . $sectionLength);
|
|
|
|
|
|
$totalLength = strlen($item_data);
|
|
|
$charCounts[] = $totalLength;
|