Fix esportazione csv fatture

This commit is contained in:
Matteo 2022-04-21 17:09:06 +02:00
parent 0e1a92b2be
commit 5c2d6c1c7d
2 changed files with 11 additions and 1 deletions

View File

@ -50,7 +50,7 @@ class CSV extends CSVExporter
'label' => 'Ragione sociale',
],
[
'field' => 'totale',
'field' => 'totaleCSV',
'label' => 'Totale',
],
[

View File

@ -898,4 +898,14 @@ class Fattura extends Document
{
return $this->anagrafica->ragione_sociale;
}
public function getTotaleCSVAttribute()
{
$totale = $this->totale_imponibile + $this->iva + $this->rivalsa_inps + $this->iva_rivalsa_inps;
if($this->isNota()){
return $totale*(-1);
}else{
return $totale;
}
}
}