|
|
@@ -612,7 +612,7 @@ class FatturazioneGeneraService
|
|
612
|
612
|
if ($allocazione['importo_spesa'] > 0) {
|
|
613
|
613
|
$cliente['voci'][] = [
|
|
614
|
614
|
'tipo' => FatturaRiga::TIPO_SPESA,
|
|
615
|
|
- 'descrizione' => $this->titoloSegnalazione($segnalazione),
|
|
|
615
|
+ 'descrizione' => $this->descrizioneCosto($annotazione, $segnalazione),
|
|
616
|
616
|
'quantita' => 1,
|
|
617
|
617
|
'unita_misura' => 'forfait',
|
|
618
|
618
|
'prezzo_unitario' => $allocazione['importo_spesa'],
|
|
|
@@ -1175,6 +1175,7 @@ class FatturazioneGeneraService
|
|
1175
|
1175
|
|
|
1176
|
1176
|
/**
|
|
1177
|
1177
|
* Una riga per tipo di ticket (es. Assistenza remota), con le ore sommate.
|
|
|
1178
|
+ * I costi restano una riga ciascuno, con la propria descrizione.
|
|
1178
|
1179
|
*
|
|
1179
|
1180
|
* @param array<int, array<string, mixed>> $voci
|
|
1180
|
1181
|
* @return array<int, array<string, mixed>>
|
|
|
@@ -1185,7 +1186,6 @@ class FatturazioneGeneraService
|
|
1185
|
1186
|
FatturaRiga::TIPO_TEMPO,
|
|
1186
|
1187
|
FatturaRiga::TIPO_EXTRA_CONTRATTO,
|
|
1187
|
1188
|
FatturaRiga::TIPO_EXTRA_ORDINE,
|
|
1188
|
|
- FatturaRiga::TIPO_SPESA,
|
|
1189
|
1189
|
FatturaRiga::TIPO_USCITA,
|
|
1190
|
1190
|
];
|
|
1191
|
1191
|
$gruppi = [];
|
|
|
@@ -1246,6 +1246,19 @@ class FatturazioneGeneraService
|
|
1246
|
1246
|
return $titolo !== '' ? $titolo : 'Ticket';
|
|
1247
|
1247
|
}
|
|
1248
|
1248
|
|
|
|
1249
|
+ protected function descrizioneCosto(Annotazione $annotazione, $segnalazione): string
|
|
|
1250
|
+ {
|
|
|
1251
|
+ $descrizione = trim((string) ($annotazione->costo_descrizione ?? ''));
|
|
|
1252
|
+ if ($descrizione === '') {
|
|
|
1253
|
+ $descrizione = $this->titoloSegnalazione($segnalazione);
|
|
|
1254
|
+ }
|
|
|
1255
|
+ if (mb_strlen($descrizione) > 255) {
|
|
|
1256
|
+ $descrizione = mb_substr($descrizione, 0, 252).'…';
|
|
|
1257
|
+ }
|
|
|
1258
|
+
|
|
|
1259
|
+ return $descrizione;
|
|
|
1260
|
+ }
|
|
|
1261
|
+
|
|
1249
|
1262
|
/**
|
|
1250
|
1263
|
* @param array<int, array<string, mixed>> $voci
|
|
1251
|
1264
|
* @return array<int, array{annotazione_id: int, titolo: string, data: string, minuti_ticket: int, minuti_fatturati: int, uscita: ?float}>
|