|
|
@@ -577,7 +577,7 @@ class FatturazioneGeneraService
|
|
577
|
577
|
if ($allocazione['minuti_fatturare'] > 0 && $tipoTempo) {
|
|
578
|
578
|
$cliente['voci'][] = [
|
|
579
|
579
|
'tipo' => $tipoTempo,
|
|
580
|
|
- 'descrizione' => $segnalazione->getNumeroLabel().' — '.$segnalazione->titolo,
|
|
|
580
|
+ 'descrizione' => $this->titoloSegnalazione($segnalazione),
|
|
581
|
581
|
'quantita' => round($allocazione['minuti_fatturare'] / 60, 2),
|
|
582
|
582
|
'unita_misura' => 'ora',
|
|
583
|
583
|
'prezzo_unitario' => $allocazione['tariffa'],
|
|
|
@@ -592,14 +592,13 @@ class FatturazioneGeneraService
|
|
592
|
592
|
'prodotto_id' => null,
|
|
593
|
593
|
'periodo_da' => null,
|
|
594
|
594
|
'periodo_a' => null,
|
|
595
|
|
- 'nota' => $allocazione['note'],
|
|
|
595
|
+ 'nota' => $segnalazione->getNumeroLabel(),
|
|
596
|
596
|
];
|
|
597
|
597
|
}
|
|
598
|
598
|
if ($allocazione['importo_spesa'] > 0) {
|
|
599
|
|
- $descSpesa = trim((string) $annotazione->costo_descrizione);
|
|
600
|
599
|
$cliente['voci'][] = [
|
|
601
|
600
|
'tipo' => FatturaRiga::TIPO_SPESA,
|
|
602
|
|
- 'descrizione' => 'Spesa '.$segnalazione->getNumeroLabel().($descSpesa !== '' ? ' — '.$descSpesa : ''),
|
|
|
601
|
+ 'descrizione' => $this->titoloSegnalazione($segnalazione),
|
|
603
|
602
|
'quantita' => 1,
|
|
604
|
603
|
'unita_misura' => 'forfait',
|
|
605
|
604
|
'prezzo_unitario' => $allocazione['importo_spesa'],
|
|
|
@@ -614,13 +613,13 @@ class FatturazioneGeneraService
|
|
614
|
613
|
'prodotto_id' => null,
|
|
615
|
614
|
'periodo_da' => null,
|
|
616
|
615
|
'periodo_a' => null,
|
|
617
|
|
- 'nota' => null,
|
|
|
616
|
+ 'nota' => $segnalazione->getNumeroLabel(),
|
|
618
|
617
|
];
|
|
619
|
618
|
}
|
|
620
|
619
|
if ($importoUscita > 0) {
|
|
621
|
620
|
$cliente['voci'][] = [
|
|
622
|
621
|
'tipo' => FatturaRiga::TIPO_USCITA,
|
|
623
|
|
- 'descrizione' => 'Costo d\'uscita '.$segnalazione->getNumeroLabel().' — '.$segnalazione->titolo,
|
|
|
622
|
+ 'descrizione' => $this->titoloSegnalazione($segnalazione),
|
|
624
|
623
|
'quantita' => 1,
|
|
625
|
624
|
'unita_misura' => 'forfait',
|
|
626
|
625
|
'prezzo_unitario' => $importoUscita,
|
|
|
@@ -635,7 +634,7 @@ class FatturazioneGeneraService
|
|
635
|
634
|
'prodotto_id' => null,
|
|
636
|
635
|
'periodo_da' => null,
|
|
637
|
636
|
'periodo_a' => null,
|
|
638
|
|
- 'nota' => 'Costo d\'uscita',
|
|
|
637
|
+ 'nota' => $segnalazione->getNumeroLabel(),
|
|
639
|
638
|
];
|
|
640
|
639
|
}
|
|
641
|
640
|
|
|
|
@@ -1202,13 +1201,7 @@ class FatturazioneGeneraService
|
|
1202
|
1201
|
if ($qty <= 0) {
|
|
1203
|
1202
|
$qty = 1;
|
|
1204
|
1203
|
}
|
|
1205
|
|
- if ($ore) {
|
|
1206
|
|
- $descrizione = $tipoSegnalazione;
|
|
1207
|
|
- } elseif ($tipo === FatturaRiga::TIPO_SPESA) {
|
|
1208
|
|
- $descrizione = 'Spesa — '.$tipoSegnalazione;
|
|
1209
|
|
- } else {
|
|
1210
|
|
- $descrizione = 'Costo d\'uscita — '.$tipoSegnalazione;
|
|
1211
|
|
- }
|
|
|
1204
|
+ $descrizione = $tipoSegnalazione;
|
|
1212
|
1205
|
$resto[] = [
|
|
1213
|
1206
|
'tipo' => $ore ? FatturaRiga::TIPO_TEMPO : $tipo,
|
|
1214
|
1207
|
'descrizione' => $descrizione,
|
|
|
@@ -1232,6 +1225,13 @@ class FatturazioneGeneraService
|
|
1232
|
1225
|
return $resto;
|
|
1233
|
1226
|
}
|
|
1234
|
1227
|
|
|
|
1228
|
+ protected function titoloSegnalazione($segnalazione): string
|
|
|
1229
|
+ {
|
|
|
1230
|
+ $titolo = trim((string) ($segnalazione->titolo ?? ''));
|
|
|
1231
|
+
|
|
|
1232
|
+ return $titolo !== '' ? $titolo : 'Ticket';
|
|
|
1233
|
+ }
|
|
|
1234
|
+
|
|
1235
|
1235
|
/**
|
|
1236
|
1236
|
* @param array<int, array<string, mixed>> $voci
|
|
1237
|
1237
|
* @return array<int, array{annotazione_id: int, titolo: string, data: string, minuti_ticket: int, minuti_fatturati: int, uscita: ?float}>
|