|
32 | 32 | if ($module->name == 'Fatture di vendita' && $services_enable) { |
33 | 33 | $documenti_scarto = []; |
34 | 34 | $documenti_invio = []; |
35 | | - $codici_scarto = ['EC02', 'ERR', 'ERVAL', 'NS']; |
| 35 | + $codici_scarto = ['EC02', 'NS']; |
| 36 | + $codici_errore = ['ERR', 'ERVAL',]; |
36 | 37 | $codici_invio = ['GEN', 'QUEUE']; |
37 | 38 | $data_limite = (new Carbon())->subMonths(6); |
38 | 39 | $data_limite_invio = (new Carbon())->subDays(10); |
|
52 | 53 | $stato_fe = StatoFE::find($documento->codice_stato_fe); |
53 | 54 | if (in_array($documento->codice_stato_fe, $codici_scarto)) { |
54 | 55 | // In caso di NS verifico che non sia semplicemente un codice 00404 (Fattura duplicata) |
55 | | - if ($documento->codice_stato_fe == 'NS' && ($documento->stato != Stato::where('name', 'Bozza')->first()->id) && ($documento->stato != Stato::where('name', 'Non valida')->first()->id)) { |
| 56 | + if ($documento->stato->name != 'Bozza' && $documento->stato->name != 'Non valida') { |
56 | 57 | $ricevuta_principale = $documento->getRicevutaPrincipale(); |
57 | 58 |
|
58 | 59 | if (!empty($ricevuta_principale)) { |
|
76 | 77 | } |
77 | 78 | } |
78 | 79 | $show_avviso = $show_avviso ?: ($documento->data_stato_fe < (new Carbon())->subDays(4) ? 1 : 0); |
| 80 | + } elseif (in_array($documento->codice_stato_fe, $codici_errore)) { |
| 81 | + $documenti_scarto[] = [ |
| 82 | + 'id' => $documento->id, |
| 83 | + 'label' => tr('_ICON_ Fattura numero _NUM_ del _DATE_ : <b>_STATO_</b>', [ |
| 84 | + '_ICON_' => '<i class="'.$stato_fe->icon.'"></i>', |
| 85 | + '_NUM_' => $documento->numero_esterno, |
| 86 | + '_DATE_' => dateFormat($documento->data), |
| 87 | + '_STATO_' => $stato_fe->name, |
| 88 | + ]), |
| 89 | + ]; |
| 90 | + |
79 | 91 | } elseif (in_array($documento->codice_stato_fe, $codici_invio)) { |
80 | 92 | $is_estera = false; |
81 | 93 |
|
|
0 commit comments