Fix minore
This commit is contained in:
parent
fda99fd92b
commit
b1c2f56537
|
@ -850,6 +850,9 @@ switch ($op) {
|
|||
case 'autofattura':
|
||||
$fattura = Fattura::find($id_record);
|
||||
|
||||
$imponibile = 0;
|
||||
$sconto = 0;
|
||||
|
||||
$id_segment = post('id_segment');
|
||||
$data = date('Y-m-d');
|
||||
$anagrafica = $fattura->anagrafica;
|
||||
|
@ -859,17 +862,13 @@ switch ($op) {
|
|||
$imponibile = $database->table('co_righe_documenti')
|
||||
->join('co_iva', 'co_iva.id', '=', 'co_righe_documenti.idiva')
|
||||
->where('co_righe_documenti.iddocumento', $fattura->id)
|
||||
->where('co_iva.codice_natura_fe', 'LIKE', 'N3%')
|
||||
->orWhere('co_iva.codice_natura_fe', 'LIKE', 'N6%')
|
||||
->orWhere('co_iva.codice_natura_fe', 'LIKE', 'N2%')
|
||||
->whereIn('co_iva.codice_natura_fe', ['N2', 'N2.1', 'N2.2', 'N3', 'N3.1', 'N3.2', 'N3.3', 'N3.4', 'N3.5', 'N3.6', 'N6', 'N6.1', 'N6.2', 'N6.3', 'N6.4', 'N6.5', 'N6.6', 'N6.7', 'N6.8', 'N6.9'])
|
||||
->sum('subtotale');
|
||||
|
||||
$sconto = $database->table('co_righe_documenti')
|
||||
->join('co_iva', 'co_iva.id', '=', 'co_righe_documenti.idiva')
|
||||
->where('co_righe_documenti.iddocumento', $fattura->id)
|
||||
->where('co_iva.codice_natura_fe', 'LIKE', 'N3%')
|
||||
->orWhere('co_iva.codice_natura_fe', 'LIKE', 'N6%')
|
||||
->orWhere('co_iva.codice_natura_fe', 'LIKE', 'N2%')
|
||||
->whereIn('co_iva.codice_natura_fe', ['N2', 'N2.1', 'N2.2', 'N3', 'N3.1', 'N3.2', 'N3.3', 'N3.4', 'N3.5', 'N3.6', 'N6', 'N6.1', 'N6.2', 'N6.3', 'N6.4', 'N6.5', 'N6.6', 'N6.7', 'N6.8', 'N6.9'])
|
||||
->sum('sconto');
|
||||
|
||||
$totale_imponibile = setting('Utilizza prezzi di vendita comprensivi di IVA') ? ($imponibile - $sconto) + (($imponibile - $sconto) * $iva->percentuale / 100) : ($imponibile - $sconto);
|
||||
|
|
Loading…
Reference in New Issue